From b9ec147eb66d2a63d5756f6b5444b375914391e0 Mon Sep 17 00:00:00 2001 From: premtsd-code Date: Wed, 27 May 2026 11:19:09 +0000 Subject: [PATCH 1/3] test regen --- .gitignore | 3 - .npmrc | 1 - CHANGELOG.md | 195 - LICENSE | 12 - README.md | 175 - .../account/create-anonymous-session.md | 12 - .../account/create-email-password-session.md | 15 - docs/examples/account/create-email-token.md | 16 - .../account/create-email-verification.md | 14 - docs/examples/account/create-jwt.md | 14 - .../account/create-magic-url-token.md | 17 - .../account/create-mfa-authenticator.md | 14 - docs/examples/account/create-mfa-challenge.md | 14 - .../account/create-mfa-recovery-codes.md | 12 - .../examples/account/create-o-auth-2-token.md | 17 - docs/examples/account/create-phone-token.md | 15 - .../account/create-phone-verification.md | 12 - docs/examples/account/create-recovery.md | 15 - docs/examples/account/create-session.md | 15 - docs/examples/account/create-verification.md | 14 - docs/examples/account/create.md | 17 - docs/examples/account/delete-identity.md | 14 - .../account/delete-mfa-authenticator.md | 14 - docs/examples/account/delete-session.md | 14 - docs/examples/account/delete-sessions.md | 12 - .../account/get-mfa-recovery-codes.md | 12 - docs/examples/account/get-prefs.md | 12 - docs/examples/account/get-session.md | 14 - docs/examples/account/get.md | 12 - docs/examples/account/list-identities.md | 15 - docs/examples/account/list-logs.md | 15 - docs/examples/account/list-mfa-factors.md | 12 - docs/examples/account/list-sessions.md | 12 - .../account/update-email-verification.md | 15 - docs/examples/account/update-email.md | 15 - .../account/update-magic-url-session.md | 15 - .../account/update-mfa-authenticator.md | 15 - docs/examples/account/update-mfa-challenge.md | 15 - .../account/update-mfa-recovery-codes.md | 12 - docs/examples/account/update-mfa.md | 14 - docs/examples/account/update-name.md | 14 - docs/examples/account/update-password.md | 15 - docs/examples/account/update-phone-session.md | 15 - .../account/update-phone-verification.md | 15 - docs/examples/account/update-phone.md | 15 - docs/examples/account/update-prefs.md | 18 - docs/examples/account/update-recovery.md | 16 - docs/examples/account/update-session.md | 14 - docs/examples/account/update-status.md | 12 - docs/examples/account/update-verification.md | 15 - docs/examples/activities/get-event.md | 14 - docs/examples/activities/list-events.md | 14 - docs/examples/advisor/delete-report.md | 14 - docs/examples/advisor/get-insight.md | 15 - docs/examples/advisor/get-report.md | 14 - docs/examples/advisor/list-insights.md | 16 - docs/examples/advisor/list-reports.md | 15 - docs/examples/avatars/get-browser.md | 17 - docs/examples/avatars/get-credit-card.md | 17 - docs/examples/avatars/get-favicon.md | 14 - docs/examples/avatars/get-flag.md | 17 - docs/examples/avatars/get-image.md | 16 - docs/examples/avatars/get-initials.md | 17 - docs/examples/avatars/get-qr.md | 17 - docs/examples/avatars/get-screenshot.md | 36 - docs/examples/backups/create-archive.md | 15 - docs/examples/backups/create-policy.md | 20 - docs/examples/backups/create-restoration.md | 17 - docs/examples/backups/delete-archive.md | 14 - docs/examples/backups/delete-policy.md | 14 - docs/examples/backups/get-archive.md | 14 - docs/examples/backups/get-policy.md | 14 - docs/examples/backups/get-restoration.md | 14 - docs/examples/backups/list-archives.md | 14 - docs/examples/backups/list-policies.md | 14 - docs/examples/backups/list-restorations.md | 14 - docs/examples/backups/update-policy.md | 18 - .../databases/create-big-int-attribute.md | 21 - .../databases/create-boolean-attribute.md | 19 - docs/examples/databases/create-collection.md | 21 - .../databases/create-datetime-attribute.md | 19 - docs/examples/databases/create-document.md | 25 - docs/examples/databases/create-documents.md | 17 - .../databases/create-email-attribute.md | 19 - .../databases/create-enum-attribute.md | 20 - .../databases/create-float-attribute.md | 21 - docs/examples/databases/create-index.md | 20 - .../databases/create-integer-attribute.md | 21 - .../examples/databases/create-ip-attribute.md | 19 - .../databases/create-line-attribute.md | 18 - .../databases/create-longtext-attribute.md | 20 - .../databases/create-mediumtext-attribute.md | 20 - docs/examples/databases/create-operations.md | 25 - .../databases/create-point-attribute.md | 18 - .../databases/create-polygon-attribute.md | 18 - .../create-relationship-attribute.md | 21 - .../databases/create-string-attribute.md | 21 - .../databases/create-text-attribute.md | 20 - docs/examples/databases/create-transaction.md | 14 - .../databases/create-url-attribute.md | 19 - .../databases/create-varchar-attribute.md | 21 - docs/examples/databases/create.md | 16 - .../databases/decrement-document-attribute.md | 20 - docs/examples/databases/delete-attribute.md | 16 - docs/examples/databases/delete-collection.md | 15 - docs/examples/databases/delete-document.md | 17 - docs/examples/databases/delete-documents.md | 17 - docs/examples/databases/delete-index.md | 16 - docs/examples/databases/delete-transaction.md | 14 - docs/examples/databases/delete.md | 14 - docs/examples/databases/get-attribute.md | 16 - docs/examples/databases/get-collection.md | 15 - docs/examples/databases/get-document.md | 18 - docs/examples/databases/get-index.md | 16 - docs/examples/databases/get-transaction.md | 14 - docs/examples/databases/get.md | 14 - .../databases/increment-document-attribute.md | 20 - docs/examples/databases/list-attributes.md | 17 - docs/examples/databases/list-collections.md | 17 - docs/examples/databases/list-documents.md | 19 - docs/examples/databases/list-indexes.md | 17 - docs/examples/databases/list-transactions.md | 14 - docs/examples/databases/list.md | 16 - .../databases/update-big-int-attribute.md | 21 - .../databases/update-boolean-attribute.md | 19 - docs/examples/databases/update-collection.md | 20 - .../databases/update-datetime-attribute.md | 19 - docs/examples/databases/update-document.md | 25 - docs/examples/databases/update-documents.md | 24 - .../databases/update-email-attribute.md | 19 - .../databases/update-enum-attribute.md | 20 - .../databases/update-float-attribute.md | 21 - .../databases/update-integer-attribute.md | 21 - .../examples/databases/update-ip-attribute.md | 19 - .../databases/update-line-attribute.md | 19 - .../databases/update-longtext-attribute.md | 19 - .../databases/update-mediumtext-attribute.md | 19 - .../databases/update-point-attribute.md | 19 - .../databases/update-polygon-attribute.md | 19 - .../update-relationship-attribute.md | 18 - .../databases/update-string-attribute.md | 20 - .../databases/update-text-attribute.md | 19 - docs/examples/databases/update-transaction.md | 16 - .../databases/update-url-attribute.md | 19 - .../databases/update-varchar-attribute.md | 20 - docs/examples/databases/update.md | 16 - docs/examples/databases/upsert-document.md | 25 - docs/examples/databases/upsert-documents.md | 17 - docs/examples/functions/create-deployment.md | 19 - .../functions/create-duplicate-deployment.md | 16 - docs/examples/functions/create-execution.md | 20 - .../functions/create-template-deployment.md | 20 - docs/examples/functions/create-variable.md | 18 - .../functions/create-vcs-deployment.md | 17 - docs/examples/functions/create.md | 33 - docs/examples/functions/delete-deployment.md | 15 - docs/examples/functions/delete-execution.md | 15 - docs/examples/functions/delete-variable.md | 15 - docs/examples/functions/delete.md | 14 - .../functions/get-deployment-download.md | 16 - docs/examples/functions/get-deployment.md | 15 - docs/examples/functions/get-execution.md | 15 - docs/examples/functions/get-variable.md | 15 - docs/examples/functions/get.md | 14 - docs/examples/functions/list-deployments.md | 17 - docs/examples/functions/list-executions.md | 16 - docs/examples/functions/list-runtimes.md | 12 - .../examples/functions/list-specifications.md | 12 - docs/examples/functions/list-variables.md | 16 - docs/examples/functions/list.md | 16 - .../functions/update-deployment-status.md | 15 - .../functions/update-function-deployment.md | 15 - docs/examples/functions/update-variable.md | 18 - docs/examples/functions/update.md | 33 - docs/examples/graphql/mutation.md | 14 - docs/examples/graphql/query.md | 14 - docs/examples/health/get-antivirus.md | 12 - docs/examples/health/get-cache.md | 12 - docs/examples/health/get-certificate.md | 14 - docs/examples/health/get-console-pausing.md | 15 - docs/examples/health/get-db.md | 12 - docs/examples/health/get-failed-jobs.md | 15 - docs/examples/health/get-pub-sub.md | 12 - docs/examples/health/get-queue-audits.md | 14 - docs/examples/health/get-queue-builds.md | 14 - .../examples/health/get-queue-certificates.md | 14 - docs/examples/health/get-queue-databases.md | 15 - docs/examples/health/get-queue-deletes.md | 14 - docs/examples/health/get-queue-functions.md | 14 - docs/examples/health/get-queue-logs.md | 14 - docs/examples/health/get-queue-mails.md | 14 - docs/examples/health/get-queue-messaging.md | 14 - docs/examples/health/get-queue-migrations.md | 14 - .../health/get-queue-stats-resources.md | 14 - docs/examples/health/get-queue-usage.md | 14 - docs/examples/health/get-queue-webhooks.md | 14 - docs/examples/health/get-storage-local.md | 12 - docs/examples/health/get-storage.md | 12 - docs/examples/health/get-time.md | 12 - docs/examples/health/get.md | 12 - docs/examples/locale/get.md | 12 - docs/examples/locale/list-codes.md | 12 - docs/examples/locale/list-continents.md | 12 - docs/examples/locale/list-countries-eu.md | 12 - docs/examples/locale/list-countries-phones.md | 12 - docs/examples/locale/list-countries.md | 12 - docs/examples/locale/list-currencies.md | 12 - docs/examples/locale/list-languages.md | 12 - .../messaging/create-apns-provider.md | 21 - docs/examples/messaging/create-email.md | 25 - .../examples/messaging/create-fcm-provider.md | 17 - .../messaging/create-mailgun-provider.md | 23 - .../messaging/create-msg-91-provider.md | 19 - docs/examples/messaging/create-push.md | 32 - .../messaging/create-resend-provider.md | 21 - .../messaging/create-sendgrid-provider.md | 21 - docs/examples/messaging/create-sms.md | 20 - .../messaging/create-smtp-provider.md | 27 - docs/examples/messaging/create-subscriber.md | 16 - .../messaging/create-telesign-provider.md | 19 - .../messaging/create-textmagic-provider.md | 19 - docs/examples/messaging/create-topic.md | 16 - .../messaging/create-twilio-provider.md | 19 - .../messaging/create-vonage-provider.md | 19 - docs/examples/messaging/delete-provider.md | 14 - docs/examples/messaging/delete-subscriber.md | 15 - docs/examples/messaging/delete-topic.md | 14 - docs/examples/messaging/delete.md | 14 - docs/examples/messaging/get-message.md | 14 - docs/examples/messaging/get-provider.md | 14 - docs/examples/messaging/get-subscriber.md | 15 - docs/examples/messaging/get-topic.md | 14 - docs/examples/messaging/list-message-logs.md | 16 - docs/examples/messaging/list-messages.md | 16 - docs/examples/messaging/list-provider-logs.md | 16 - docs/examples/messaging/list-providers.md | 16 - .../messaging/list-subscriber-logs.md | 16 - docs/examples/messaging/list-subscribers.md | 17 - docs/examples/messaging/list-targets.md | 16 - docs/examples/messaging/list-topic-logs.md | 16 - docs/examples/messaging/list-topics.md | 16 - .../messaging/update-apns-provider.md | 21 - docs/examples/messaging/update-email.md | 25 - .../examples/messaging/update-fcm-provider.md | 17 - .../messaging/update-mailgun-provider.md | 23 - .../messaging/update-msg-91-provider.md | 19 - docs/examples/messaging/update-push.md | 32 - .../messaging/update-resend-provider.md | 21 - .../messaging/update-sendgrid-provider.md | 21 - docs/examples/messaging/update-sms.md | 20 - .../messaging/update-smtp-provider.md | 27 - .../messaging/update-telesign-provider.md | 19 - .../messaging/update-textmagic-provider.md | 19 - docs/examples/messaging/update-topic.md | 16 - .../messaging/update-twilio-provider.md | 19 - .../messaging/update-vonage-provider.md | 19 - docs/examples/presences/delete.md | 14 - docs/examples/presences/get.md | 14 - docs/examples/presences/list.md | 16 - docs/examples/presences/update-presence.md | 20 - docs/examples/presences/upsert.md | 19 - .../project/create-android-platform.md | 16 - .../examples/project/create-apple-platform.md | 16 - docs/examples/project/create-ephemeral-key.md | 15 - docs/examples/project/create-key.md | 17 - .../examples/project/create-linux-platform.md | 16 - docs/examples/project/create-mock-phone.md | 15 - docs/examples/project/create-smtp-test.md | 14 - docs/examples/project/create-variable.md | 17 - docs/examples/project/create-web-platform.md | 16 - .../project/create-windows-platform.md | 16 - docs/examples/project/delete-key.md | 14 - docs/examples/project/delete-mock-phone.md | 14 - docs/examples/project/delete-platform.md | 14 - docs/examples/project/delete-variable.md | 14 - docs/examples/project/delete.md | 12 - docs/examples/project/get-email-template.md | 15 - docs/examples/project/get-key.md | 14 - docs/examples/project/get-mock-phone.md | 14 - .../examples/project/get-o-auth-2-provider.md | 14 - docs/examples/project/get-platform.md | 14 - docs/examples/project/get-policy.md | 14 - docs/examples/project/get-variable.md | 14 - docs/examples/project/get.md | 12 - docs/examples/project/list-email-templates.md | 15 - docs/examples/project/list-keys.md | 15 - docs/examples/project/list-mock-phones.md | 15 - .../project/list-o-auth-2-providers.md | 15 - docs/examples/project/list-platforms.md | 15 - docs/examples/project/list-policies.md | 15 - docs/examples/project/list-variables.md | 15 - .../project/update-android-platform.md | 16 - .../examples/project/update-apple-platform.md | 16 - docs/examples/project/update-auth-method.md | 15 - .../update-deny-aliased-email-policy.md | 14 - .../update-deny-disposable-email-policy.md | 14 - .../project/update-deny-free-email-policy.md | 14 - .../examples/project/update-email-template.md | 21 - docs/examples/project/update-key.md | 17 - docs/examples/project/update-labels.md | 14 - .../examples/project/update-linux-platform.md | 16 - .../update-membership-privacy-policy.md | 18 - docs/examples/project/update-mock-phone.md | 15 - .../project/update-o-auth-2-amazon.md | 16 - .../examples/project/update-o-auth-2-apple.md | 18 - .../project/update-o-auth-2-auth-0.md | 17 - .../project/update-o-auth-2-authentik.md | 17 - .../project/update-o-auth-2-autodesk.md | 16 - .../project/update-o-auth-2-bitbucket.md | 16 - .../examples/project/update-o-auth-2-bitly.md | 16 - docs/examples/project/update-o-auth-2-box.md | 16 - .../project/update-o-auth-2-dailymotion.md | 16 - .../project/update-o-auth-2-discord.md | 16 - .../project/update-o-auth-2-disqus.md | 16 - .../project/update-o-auth-2-dropbox.md | 16 - docs/examples/project/update-o-auth-2-etsy.md | 16 - .../project/update-o-auth-2-facebook.md | 16 - .../examples/project/update-o-auth-2-figma.md | 16 - .../project/update-o-auth-2-fusion-auth.md | 17 - .../project/update-o-auth-2-git-hub.md | 16 - .../project/update-o-auth-2-gitlab.md | 17 - .../project/update-o-auth-2-google.md | 17 - .../project/update-o-auth-2-keycloak.md | 18 - docs/examples/project/update-o-auth-2-kick.md | 16 - .../project/update-o-auth-2-linkedin.md | 16 - .../project/update-o-auth-2-microsoft.md | 17 - .../project/update-o-auth-2-notion.md | 16 - docs/examples/project/update-o-auth-2-oidc.md | 20 - docs/examples/project/update-o-auth-2-okta.md | 18 - .../project/update-o-auth-2-paypal-sandbox.md | 16 - .../project/update-o-auth-2-paypal.md | 16 - .../examples/project/update-o-auth-2-podio.md | 16 - .../project/update-o-auth-2-salesforce.md | 16 - .../examples/project/update-o-auth-2-slack.md | 16 - .../project/update-o-auth-2-spotify.md | 16 - .../project/update-o-auth-2-stripe.md | 16 - .../update-o-auth-2-tradeshift-sandbox.md | 16 - .../project/update-o-auth-2-tradeshift.md | 16 - .../project/update-o-auth-2-twitch.md | 16 - .../project/update-o-auth-2-word-press.md | 16 - .../examples/project/update-o-auth-2-yahoo.md | 16 - .../project/update-o-auth-2-yandex.md | 16 - docs/examples/project/update-o-auth-2-zoho.md | 16 - docs/examples/project/update-o-auth-2-zoom.md | 16 - docs/examples/project/update-o-auth-2x.md | 16 - .../update-password-dictionary-policy.md | 14 - .../project/update-password-history-policy.md | 14 - .../update-password-personal-data-policy.md | 14 - docs/examples/project/update-protocol.md | 15 - docs/examples/project/update-service.md | 15 - .../project/update-session-alert-policy.md | 14 - .../project/update-session-duration-policy.md | 14 - .../update-session-invalidation-policy.md | 14 - .../project/update-session-limit-policy.md | 14 - docs/examples/project/update-smtp.md | 23 - .../project/update-user-limit-policy.md | 14 - docs/examples/project/update-variable.md | 17 - docs/examples/project/update-web-platform.md | 16 - .../project/update-windows-platform.md | 16 - docs/examples/proxy/create-api-rule.md | 14 - docs/examples/proxy/create-function-rule.md | 16 - docs/examples/proxy/create-redirect-rule.md | 18 - docs/examples/proxy/create-site-rule.md | 16 - docs/examples/proxy/delete-rule.md | 14 - docs/examples/proxy/get-rule.md | 14 - docs/examples/proxy/list-rules.md | 15 - docs/examples/proxy/update-rule-status.md | 14 - docs/examples/sites/create-deployment.md | 20 - .../sites/create-duplicate-deployment.md | 15 - .../sites/create-template-deployment.md | 20 - docs/examples/sites/create-variable.md | 18 - docs/examples/sites/create-vcs-deployment.md | 17 - docs/examples/sites/create.md | 34 - docs/examples/sites/delete-deployment.md | 15 - docs/examples/sites/delete-log.md | 15 - docs/examples/sites/delete-variable.md | 15 - docs/examples/sites/delete.md | 14 - .../examples/sites/get-deployment-download.md | 16 - docs/examples/sites/get-deployment.md | 15 - docs/examples/sites/get-log.md | 15 - docs/examples/sites/get-variable.md | 15 - docs/examples/sites/get.md | 14 - docs/examples/sites/list-deployments.md | 17 - docs/examples/sites/list-frameworks.md | 12 - docs/examples/sites/list-logs.md | 16 - docs/examples/sites/list-specifications.md | 12 - docs/examples/sites/list-variables.md | 16 - docs/examples/sites/list.md | 16 - .../sites/update-deployment-status.md | 15 - docs/examples/sites/update-site-deployment.md | 15 - docs/examples/sites/update-variable.md | 18 - docs/examples/sites/update.md | 34 - docs/examples/storage/create-bucket.md | 24 - docs/examples/storage/create-file.md | 18 - docs/examples/storage/delete-bucket.md | 14 - docs/examples/storage/delete-file.md | 15 - docs/examples/storage/get-bucket.md | 14 - docs/examples/storage/get-file-download.md | 16 - docs/examples/storage/get-file-preview.md | 27 - docs/examples/storage/get-file-view.md | 16 - docs/examples/storage/get-file.md | 15 - docs/examples/storage/list-buckets.md | 16 - docs/examples/storage/list-files.md | 17 - docs/examples/storage/update-bucket.md | 24 - docs/examples/storage/update-file.md | 17 - .../tablesdb/create-big-int-column.md | 21 - .../tablesdb/create-boolean-column.md | 19 - .../tablesdb/create-datetime-column.md | 19 - docs/examples/tablesdb/create-email-column.md | 19 - docs/examples/tablesdb/create-enum-column.md | 20 - docs/examples/tablesdb/create-float-column.md | 21 - docs/examples/tablesdb/create-index.md | 20 - .../tablesdb/create-integer-column.md | 21 - docs/examples/tablesdb/create-ip-column.md | 19 - docs/examples/tablesdb/create-line-column.md | 18 - .../tablesdb/create-longtext-column.md | 20 - .../tablesdb/create-mediumtext-column.md | 20 - docs/examples/tablesdb/create-operations.md | 25 - docs/examples/tablesdb/create-point-column.md | 18 - .../tablesdb/create-polygon-column.md | 18 - .../tablesdb/create-relationship-column.md | 21 - docs/examples/tablesdb/create-row.md | 25 - docs/examples/tablesdb/create-rows.md | 17 - .../examples/tablesdb/create-string-column.md | 21 - docs/examples/tablesdb/create-table.md | 21 - docs/examples/tablesdb/create-text-column.md | 20 - docs/examples/tablesdb/create-transaction.md | 14 - docs/examples/tablesdb/create-url-column.md | 19 - .../tablesdb/create-varchar-column.md | 21 - docs/examples/tablesdb/create.md | 16 - .../examples/tablesdb/decrement-row-column.md | 20 - docs/examples/tablesdb/delete-column.md | 16 - docs/examples/tablesdb/delete-index.md | 16 - docs/examples/tablesdb/delete-row.md | 17 - docs/examples/tablesdb/delete-rows.md | 17 - docs/examples/tablesdb/delete-table.md | 15 - docs/examples/tablesdb/delete-transaction.md | 14 - docs/examples/tablesdb/delete.md | 14 - docs/examples/tablesdb/get-column.md | 16 - docs/examples/tablesdb/get-index.md | 16 - docs/examples/tablesdb/get-row.md | 18 - docs/examples/tablesdb/get-table.md | 15 - docs/examples/tablesdb/get-transaction.md | 14 - docs/examples/tablesdb/get.md | 14 - .../examples/tablesdb/increment-row-column.md | 20 - docs/examples/tablesdb/list-columns.md | 17 - docs/examples/tablesdb/list-indexes.md | 17 - docs/examples/tablesdb/list-rows.md | 19 - docs/examples/tablesdb/list-tables.md | 17 - docs/examples/tablesdb/list-transactions.md | 14 - docs/examples/tablesdb/list.md | 16 - .../tablesdb/update-big-int-column.md | 21 - .../tablesdb/update-boolean-column.md | 19 - .../tablesdb/update-datetime-column.md | 19 - docs/examples/tablesdb/update-email-column.md | 19 - docs/examples/tablesdb/update-enum-column.md | 20 - docs/examples/tablesdb/update-float-column.md | 21 - .../tablesdb/update-integer-column.md | 21 - docs/examples/tablesdb/update-ip-column.md | 19 - docs/examples/tablesdb/update-line-column.md | 19 - .../tablesdb/update-longtext-column.md | 19 - .../tablesdb/update-mediumtext-column.md | 19 - docs/examples/tablesdb/update-point-column.md | 19 - .../tablesdb/update-polygon-column.md | 19 - .../tablesdb/update-relationship-column.md | 18 - docs/examples/tablesdb/update-row.md | 25 - docs/examples/tablesdb/update-rows.md | 24 - .../examples/tablesdb/update-string-column.md | 20 - docs/examples/tablesdb/update-table.md | 20 - docs/examples/tablesdb/update-text-column.md | 19 - docs/examples/tablesdb/update-transaction.md | 16 - docs/examples/tablesdb/update-url-column.md | 19 - .../tablesdb/update-varchar-column.md | 20 - docs/examples/tablesdb/update.md | 16 - docs/examples/tablesdb/upsert-row.md | 25 - docs/examples/tablesdb/upsert-rows.md | 17 - docs/examples/teams/create-membership.md | 20 - docs/examples/teams/create.md | 16 - docs/examples/teams/delete-membership.md | 15 - docs/examples/teams/delete.md | 14 - docs/examples/teams/get-membership.md | 15 - docs/examples/teams/get-prefs.md | 14 - docs/examples/teams/get.md | 14 - docs/examples/teams/list-memberships.md | 17 - docs/examples/teams/list.md | 16 - .../teams/update-membership-status.md | 17 - docs/examples/teams/update-membership.md | 16 - docs/examples/teams/update-name.md | 15 - docs/examples/teams/update-prefs.md | 15 - docs/examples/tokens/create-file-token.md | 16 - docs/examples/tokens/delete.md | 14 - docs/examples/tokens/get.md | 14 - docs/examples/tokens/list.md | 17 - docs/examples/tokens/update.md | 15 - docs/examples/usage/list-events.md | 15 - docs/examples/usage/list-gauges.md | 15 - docs/examples/users/create-argon-2-user.md | 17 - docs/examples/users/create-bcrypt-user.md | 17 - docs/examples/users/create-jwt.md | 16 - docs/examples/users/create-md-5-user.md | 17 - .../users/create-mfa-recovery-codes.md | 14 - docs/examples/users/create-ph-pass-user.md | 17 - .../users/create-scrypt-modified-user.md | 20 - docs/examples/users/create-scrypt-user.md | 22 - docs/examples/users/create-session.md | 14 - docs/examples/users/create-sha-user.md | 18 - docs/examples/users/create-target.md | 19 - docs/examples/users/create-token.md | 16 - docs/examples/users/create.md | 18 - docs/examples/users/delete-identity.md | 14 - .../users/delete-mfa-authenticator.md | 15 - docs/examples/users/delete-session.md | 15 - docs/examples/users/delete-sessions.md | 14 - docs/examples/users/delete-target.md | 15 - docs/examples/users/delete.md | 14 - docs/examples/users/get-mfa-recovery-codes.md | 14 - docs/examples/users/get-prefs.md | 14 - docs/examples/users/get-target.md | 15 - docs/examples/users/get.md | 14 - docs/examples/users/list-identities.md | 16 - docs/examples/users/list-logs.md | 16 - docs/examples/users/list-memberships.md | 17 - docs/examples/users/list-mfa-factors.md | 14 - docs/examples/users/list-sessions.md | 15 - docs/examples/users/list-targets.md | 16 - docs/examples/users/list.md | 16 - .../users/update-email-verification.md | 15 - docs/examples/users/update-email.md | 15 - docs/examples/users/update-impersonator.md | 15 - docs/examples/users/update-labels.md | 15 - .../users/update-mfa-recovery-codes.md | 14 - docs/examples/users/update-mfa.md | 15 - docs/examples/users/update-name.md | 15 - docs/examples/users/update-password.md | 15 - .../users/update-phone-verification.md | 15 - docs/examples/users/update-phone.md | 15 - docs/examples/users/update-prefs.md | 15 - docs/examples/users/update-status.md | 15 - docs/examples/users/update-target.md | 18 - docs/examples/webhooks/create.md | 22 - docs/examples/webhooks/delete.md | 14 - docs/examples/webhooks/get.md | 14 - docs/examples/webhooks/list.md | 15 - docs/examples/webhooks/update-secret.md | 15 - docs/examples/webhooks/update.md | 21 - package-lock.json | 5093 ------------ package.json | 57 - src/client.ts | 573 -- src/enums/adapter.ts | 4 - src/enums/attribute-status.ts | 7 - src/enums/authentication-factor.ts | 6 - src/enums/authenticator-type.ts | 3 - src/enums/backup-services.ts | 8 - src/enums/browser-permission.ts | 22 - src/enums/browser.ts | 16 - src/enums/build-runtime.ts | 94 - src/enums/column-status.ts | 7 - src/enums/compression.ts | 5 - src/enums/credit-card.ts | 19 - src/enums/database-type.ts | 6 - src/enums/databases-index-type.ts | 6 - src/enums/deployment-download-type.ts | 4 - src/enums/deployment-status.ts | 8 - src/enums/execution-method.ts | 9 - src/enums/execution-status.ts | 7 - src/enums/execution-trigger.ts | 5 - src/enums/flag.ts | 197 - src/enums/framework.ts | 17 - src/enums/health-antivirus-status.ts | 5 - src/enums/health-check-status.ts | 4 - src/enums/image-format.ts | 9 - src/enums/image-gravity.ts | 11 - src/enums/index-status.ts | 7 - src/enums/message-priority.ts | 4 - src/enums/message-status.ts | 7 - src/enums/messaging-provider-type.ts | 5 - src/enums/name.ts | 15 - src/enums/o-auth-2-google-prompt.ts | 5 - src/enums/o-auth-provider.ts | 45 - src/enums/order-by.ts | 4 - src/enums/password-hash.ts | 13 - src/enums/platform-type.ts | 7 - src/enums/project-auth-method-id.ts | 9 - src/enums/project-email-template-id.ts | 9 - src/enums/project-email-template-locale.ts | 133 - src/enums/project-key-scopes.ts | 96 - src/enums/project-o-auth-2-google-prompt.ts | 5 - src/enums/project-o-auth-provider-id.ts | 47 - src/enums/project-policy-id.ts | 11 - src/enums/project-protocol-id.ts | 5 - src/enums/project-service-id.ts | 20 - src/enums/project-smtp-secure.ts | 4 - src/enums/proxy-resource-type.ts | 4 - .../proxy-rule-deployment-resource-type.ts | 4 - src/enums/proxy-rule-status.ts | 5 - src/enums/relation-mutate.ts | 5 - src/enums/relationship-type.ts | 6 - src/enums/runtime.ts | 94 - src/enums/scopes.ts | 96 - src/enums/smtp-encryption.ts | 5 - src/enums/status-code.ts | 6 - src/enums/tables-db-index-type.ts | 6 - src/enums/template-reference-type.ts | 5 - src/enums/theme.ts | 4 - src/enums/timezone.ts | 421 - src/enums/vcs-reference-type.ts | 5 - src/id.ts | 47 - src/index.ts | 87 - src/inputFile.ts | 144 - src/models.ts | 7091 ----------------- src/operator.ts | 308 - src/permission.ts | 57 - src/query.ts | 576 -- src/role.ts | 100 - src/services/account.ts | 2831 ------- src/services/activities.ts | 116 - src/services/advisor.ts | 309 - src/services/avatars.ts | 754 -- src/services/backups.ts | 754 -- src/services/databases.ts | 6224 --------------- src/services/functions.ts | 2003 ----- src/services/graphql.ts | 124 - src/services/health.ts | 1043 --- src/services/locale.ts | 198 - src/services/messaging.ts | 5194 ------------ src/services/presences.ts | 383 - src/services/project.ts | 6459 --------------- src/services/proxy.ts | 541 -- src/services/sites.ts | 1917 ----- src/services/storage.ts | 1082 --- src/services/tables-db.ts | 6167 -------------- src/services/teams.ts | 893 --- src/services/tokens.ts | 315 - src/services/usage.ts | 130 - src/services/users.ts | 3270 -------- src/services/webhooks.ts | 466 -- test/id.test.js | 6 - test/operator.test.js | 99 - test/permission.test.js | 10 - test/query.test.js | 155 - test/role.test.js | 14 - test/services/account.test.js | 1307 --- test/services/activities.test.js | 73 - test/services/advisor.test.js | 111 - test/services/avatars.test.js | 123 - test/services/backups.test.js | 256 - test/services/databases.test.js | 1624 ---- test/services/functions.test.js | 751 -- test/services/graphql.test.js | 40 - test/services/health.test.js | 368 - test/services/locale.test.js | 137 - test/services/messaging.test.js | 1200 --- test/services/presences.test.js | 104 - test/services/project.test.js | 2194 ----- test/services/proxy.test.js | 215 - test/services/sites.test.js | 729 -- test/services/storage.test.js | 291 - test/services/tables-d-b.test.js | 1624 ---- test/services/teams.test.js | 282 - test/services/tokens.test.js | 107 - test/services/usage.test.js | 42 - test/services/users.test.js | 1145 --- test/services/webhooks.test.js | 155 - tsconfig.json | 18 - tsup.config.ts | 27 - 665 files changed, 79519 deletions(-) delete mode 100644 .gitignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 docs/examples/account/create-anonymous-session.md delete mode 100644 docs/examples/account/create-email-password-session.md delete mode 100644 docs/examples/account/create-email-token.md delete mode 100644 docs/examples/account/create-email-verification.md delete mode 100644 docs/examples/account/create-jwt.md delete mode 100644 docs/examples/account/create-magic-url-token.md delete mode 100644 docs/examples/account/create-mfa-authenticator.md delete mode 100644 docs/examples/account/create-mfa-challenge.md delete mode 100644 docs/examples/account/create-mfa-recovery-codes.md delete mode 100644 docs/examples/account/create-o-auth-2-token.md delete mode 100644 docs/examples/account/create-phone-token.md delete mode 100644 docs/examples/account/create-phone-verification.md delete mode 100644 docs/examples/account/create-recovery.md delete mode 100644 docs/examples/account/create-session.md delete mode 100644 docs/examples/account/create-verification.md delete mode 100644 docs/examples/account/create.md delete mode 100644 docs/examples/account/delete-identity.md delete mode 100644 docs/examples/account/delete-mfa-authenticator.md delete mode 100644 docs/examples/account/delete-session.md delete mode 100644 docs/examples/account/delete-sessions.md delete mode 100644 docs/examples/account/get-mfa-recovery-codes.md delete mode 100644 docs/examples/account/get-prefs.md delete mode 100644 docs/examples/account/get-session.md delete mode 100644 docs/examples/account/get.md delete mode 100644 docs/examples/account/list-identities.md delete mode 100644 docs/examples/account/list-logs.md delete mode 100644 docs/examples/account/list-mfa-factors.md delete mode 100644 docs/examples/account/list-sessions.md delete mode 100644 docs/examples/account/update-email-verification.md delete mode 100644 docs/examples/account/update-email.md delete mode 100644 docs/examples/account/update-magic-url-session.md delete mode 100644 docs/examples/account/update-mfa-authenticator.md delete mode 100644 docs/examples/account/update-mfa-challenge.md delete mode 100644 docs/examples/account/update-mfa-recovery-codes.md delete mode 100644 docs/examples/account/update-mfa.md delete mode 100644 docs/examples/account/update-name.md delete mode 100644 docs/examples/account/update-password.md delete mode 100644 docs/examples/account/update-phone-session.md delete mode 100644 docs/examples/account/update-phone-verification.md delete mode 100644 docs/examples/account/update-phone.md delete mode 100644 docs/examples/account/update-prefs.md delete mode 100644 docs/examples/account/update-recovery.md delete mode 100644 docs/examples/account/update-session.md delete mode 100644 docs/examples/account/update-status.md delete mode 100644 docs/examples/account/update-verification.md delete mode 100644 docs/examples/activities/get-event.md delete mode 100644 docs/examples/activities/list-events.md delete mode 100644 docs/examples/advisor/delete-report.md delete mode 100644 docs/examples/advisor/get-insight.md delete mode 100644 docs/examples/advisor/get-report.md delete mode 100644 docs/examples/advisor/list-insights.md delete mode 100644 docs/examples/advisor/list-reports.md delete mode 100644 docs/examples/avatars/get-browser.md delete mode 100644 docs/examples/avatars/get-credit-card.md delete mode 100644 docs/examples/avatars/get-favicon.md delete mode 100644 docs/examples/avatars/get-flag.md delete mode 100644 docs/examples/avatars/get-image.md delete mode 100644 docs/examples/avatars/get-initials.md delete mode 100644 docs/examples/avatars/get-qr.md delete mode 100644 docs/examples/avatars/get-screenshot.md delete mode 100644 docs/examples/backups/create-archive.md delete mode 100644 docs/examples/backups/create-policy.md delete mode 100644 docs/examples/backups/create-restoration.md delete mode 100644 docs/examples/backups/delete-archive.md delete mode 100644 docs/examples/backups/delete-policy.md delete mode 100644 docs/examples/backups/get-archive.md delete mode 100644 docs/examples/backups/get-policy.md delete mode 100644 docs/examples/backups/get-restoration.md delete mode 100644 docs/examples/backups/list-archives.md delete mode 100644 docs/examples/backups/list-policies.md delete mode 100644 docs/examples/backups/list-restorations.md delete mode 100644 docs/examples/backups/update-policy.md delete mode 100644 docs/examples/databases/create-big-int-attribute.md delete mode 100644 docs/examples/databases/create-boolean-attribute.md delete mode 100644 docs/examples/databases/create-collection.md delete mode 100644 docs/examples/databases/create-datetime-attribute.md delete mode 100644 docs/examples/databases/create-document.md delete mode 100644 docs/examples/databases/create-documents.md delete mode 100644 docs/examples/databases/create-email-attribute.md delete mode 100644 docs/examples/databases/create-enum-attribute.md delete mode 100644 docs/examples/databases/create-float-attribute.md delete mode 100644 docs/examples/databases/create-index.md delete mode 100644 docs/examples/databases/create-integer-attribute.md delete mode 100644 docs/examples/databases/create-ip-attribute.md delete mode 100644 docs/examples/databases/create-line-attribute.md delete mode 100644 docs/examples/databases/create-longtext-attribute.md delete mode 100644 docs/examples/databases/create-mediumtext-attribute.md delete mode 100644 docs/examples/databases/create-operations.md delete mode 100644 docs/examples/databases/create-point-attribute.md delete mode 100644 docs/examples/databases/create-polygon-attribute.md delete mode 100644 docs/examples/databases/create-relationship-attribute.md delete mode 100644 docs/examples/databases/create-string-attribute.md delete mode 100644 docs/examples/databases/create-text-attribute.md delete mode 100644 docs/examples/databases/create-transaction.md delete mode 100644 docs/examples/databases/create-url-attribute.md delete mode 100644 docs/examples/databases/create-varchar-attribute.md delete mode 100644 docs/examples/databases/create.md delete mode 100644 docs/examples/databases/decrement-document-attribute.md delete mode 100644 docs/examples/databases/delete-attribute.md delete mode 100644 docs/examples/databases/delete-collection.md delete mode 100644 docs/examples/databases/delete-document.md delete mode 100644 docs/examples/databases/delete-documents.md delete mode 100644 docs/examples/databases/delete-index.md delete mode 100644 docs/examples/databases/delete-transaction.md delete mode 100644 docs/examples/databases/delete.md delete mode 100644 docs/examples/databases/get-attribute.md delete mode 100644 docs/examples/databases/get-collection.md delete mode 100644 docs/examples/databases/get-document.md delete mode 100644 docs/examples/databases/get-index.md delete mode 100644 docs/examples/databases/get-transaction.md delete mode 100644 docs/examples/databases/get.md delete mode 100644 docs/examples/databases/increment-document-attribute.md delete mode 100644 docs/examples/databases/list-attributes.md delete mode 100644 docs/examples/databases/list-collections.md delete mode 100644 docs/examples/databases/list-documents.md delete mode 100644 docs/examples/databases/list-indexes.md delete mode 100644 docs/examples/databases/list-transactions.md delete mode 100644 docs/examples/databases/list.md delete mode 100644 docs/examples/databases/update-big-int-attribute.md delete mode 100644 docs/examples/databases/update-boolean-attribute.md delete mode 100644 docs/examples/databases/update-collection.md delete mode 100644 docs/examples/databases/update-datetime-attribute.md delete mode 100644 docs/examples/databases/update-document.md delete mode 100644 docs/examples/databases/update-documents.md delete mode 100644 docs/examples/databases/update-email-attribute.md delete mode 100644 docs/examples/databases/update-enum-attribute.md delete mode 100644 docs/examples/databases/update-float-attribute.md delete mode 100644 docs/examples/databases/update-integer-attribute.md delete mode 100644 docs/examples/databases/update-ip-attribute.md delete mode 100644 docs/examples/databases/update-line-attribute.md delete mode 100644 docs/examples/databases/update-longtext-attribute.md delete mode 100644 docs/examples/databases/update-mediumtext-attribute.md delete mode 100644 docs/examples/databases/update-point-attribute.md delete mode 100644 docs/examples/databases/update-polygon-attribute.md delete mode 100644 docs/examples/databases/update-relationship-attribute.md delete mode 100644 docs/examples/databases/update-string-attribute.md delete mode 100644 docs/examples/databases/update-text-attribute.md delete mode 100644 docs/examples/databases/update-transaction.md delete mode 100644 docs/examples/databases/update-url-attribute.md delete mode 100644 docs/examples/databases/update-varchar-attribute.md delete mode 100644 docs/examples/databases/update.md delete mode 100644 docs/examples/databases/upsert-document.md delete mode 100644 docs/examples/databases/upsert-documents.md delete mode 100644 docs/examples/functions/create-deployment.md delete mode 100644 docs/examples/functions/create-duplicate-deployment.md delete mode 100644 docs/examples/functions/create-execution.md delete mode 100644 docs/examples/functions/create-template-deployment.md delete mode 100644 docs/examples/functions/create-variable.md delete mode 100644 docs/examples/functions/create-vcs-deployment.md delete mode 100644 docs/examples/functions/create.md delete mode 100644 docs/examples/functions/delete-deployment.md delete mode 100644 docs/examples/functions/delete-execution.md delete mode 100644 docs/examples/functions/delete-variable.md delete mode 100644 docs/examples/functions/delete.md delete mode 100644 docs/examples/functions/get-deployment-download.md delete mode 100644 docs/examples/functions/get-deployment.md delete mode 100644 docs/examples/functions/get-execution.md delete mode 100644 docs/examples/functions/get-variable.md delete mode 100644 docs/examples/functions/get.md delete mode 100644 docs/examples/functions/list-deployments.md delete mode 100644 docs/examples/functions/list-executions.md delete mode 100644 docs/examples/functions/list-runtimes.md delete mode 100644 docs/examples/functions/list-specifications.md delete mode 100644 docs/examples/functions/list-variables.md delete mode 100644 docs/examples/functions/list.md delete mode 100644 docs/examples/functions/update-deployment-status.md delete mode 100644 docs/examples/functions/update-function-deployment.md delete mode 100644 docs/examples/functions/update-variable.md delete mode 100644 docs/examples/functions/update.md delete mode 100644 docs/examples/graphql/mutation.md delete mode 100644 docs/examples/graphql/query.md delete mode 100644 docs/examples/health/get-antivirus.md delete mode 100644 docs/examples/health/get-cache.md delete mode 100644 docs/examples/health/get-certificate.md delete mode 100644 docs/examples/health/get-console-pausing.md delete mode 100644 docs/examples/health/get-db.md delete mode 100644 docs/examples/health/get-failed-jobs.md delete mode 100644 docs/examples/health/get-pub-sub.md delete mode 100644 docs/examples/health/get-queue-audits.md delete mode 100644 docs/examples/health/get-queue-builds.md delete mode 100644 docs/examples/health/get-queue-certificates.md delete mode 100644 docs/examples/health/get-queue-databases.md delete mode 100644 docs/examples/health/get-queue-deletes.md delete mode 100644 docs/examples/health/get-queue-functions.md delete mode 100644 docs/examples/health/get-queue-logs.md delete mode 100644 docs/examples/health/get-queue-mails.md delete mode 100644 docs/examples/health/get-queue-messaging.md delete mode 100644 docs/examples/health/get-queue-migrations.md delete mode 100644 docs/examples/health/get-queue-stats-resources.md delete mode 100644 docs/examples/health/get-queue-usage.md delete mode 100644 docs/examples/health/get-queue-webhooks.md delete mode 100644 docs/examples/health/get-storage-local.md delete mode 100644 docs/examples/health/get-storage.md delete mode 100644 docs/examples/health/get-time.md delete mode 100644 docs/examples/health/get.md delete mode 100644 docs/examples/locale/get.md delete mode 100644 docs/examples/locale/list-codes.md delete mode 100644 docs/examples/locale/list-continents.md delete mode 100644 docs/examples/locale/list-countries-eu.md delete mode 100644 docs/examples/locale/list-countries-phones.md delete mode 100644 docs/examples/locale/list-countries.md delete mode 100644 docs/examples/locale/list-currencies.md delete mode 100644 docs/examples/locale/list-languages.md delete mode 100644 docs/examples/messaging/create-apns-provider.md delete mode 100644 docs/examples/messaging/create-email.md delete mode 100644 docs/examples/messaging/create-fcm-provider.md delete mode 100644 docs/examples/messaging/create-mailgun-provider.md delete mode 100644 docs/examples/messaging/create-msg-91-provider.md delete mode 100644 docs/examples/messaging/create-push.md delete mode 100644 docs/examples/messaging/create-resend-provider.md delete mode 100644 docs/examples/messaging/create-sendgrid-provider.md delete mode 100644 docs/examples/messaging/create-sms.md delete mode 100644 docs/examples/messaging/create-smtp-provider.md delete mode 100644 docs/examples/messaging/create-subscriber.md delete mode 100644 docs/examples/messaging/create-telesign-provider.md delete mode 100644 docs/examples/messaging/create-textmagic-provider.md delete mode 100644 docs/examples/messaging/create-topic.md delete mode 100644 docs/examples/messaging/create-twilio-provider.md delete mode 100644 docs/examples/messaging/create-vonage-provider.md delete mode 100644 docs/examples/messaging/delete-provider.md delete mode 100644 docs/examples/messaging/delete-subscriber.md delete mode 100644 docs/examples/messaging/delete-topic.md delete mode 100644 docs/examples/messaging/delete.md delete mode 100644 docs/examples/messaging/get-message.md delete mode 100644 docs/examples/messaging/get-provider.md delete mode 100644 docs/examples/messaging/get-subscriber.md delete mode 100644 docs/examples/messaging/get-topic.md delete mode 100644 docs/examples/messaging/list-message-logs.md delete mode 100644 docs/examples/messaging/list-messages.md delete mode 100644 docs/examples/messaging/list-provider-logs.md delete mode 100644 docs/examples/messaging/list-providers.md delete mode 100644 docs/examples/messaging/list-subscriber-logs.md delete mode 100644 docs/examples/messaging/list-subscribers.md delete mode 100644 docs/examples/messaging/list-targets.md delete mode 100644 docs/examples/messaging/list-topic-logs.md delete mode 100644 docs/examples/messaging/list-topics.md delete mode 100644 docs/examples/messaging/update-apns-provider.md delete mode 100644 docs/examples/messaging/update-email.md delete mode 100644 docs/examples/messaging/update-fcm-provider.md delete mode 100644 docs/examples/messaging/update-mailgun-provider.md delete mode 100644 docs/examples/messaging/update-msg-91-provider.md delete mode 100644 docs/examples/messaging/update-push.md delete mode 100644 docs/examples/messaging/update-resend-provider.md delete mode 100644 docs/examples/messaging/update-sendgrid-provider.md delete mode 100644 docs/examples/messaging/update-sms.md delete mode 100644 docs/examples/messaging/update-smtp-provider.md delete mode 100644 docs/examples/messaging/update-telesign-provider.md delete mode 100644 docs/examples/messaging/update-textmagic-provider.md delete mode 100644 docs/examples/messaging/update-topic.md delete mode 100644 docs/examples/messaging/update-twilio-provider.md delete mode 100644 docs/examples/messaging/update-vonage-provider.md delete mode 100644 docs/examples/presences/delete.md delete mode 100644 docs/examples/presences/get.md delete mode 100644 docs/examples/presences/list.md delete mode 100644 docs/examples/presences/update-presence.md delete mode 100644 docs/examples/presences/upsert.md delete mode 100644 docs/examples/project/create-android-platform.md delete mode 100644 docs/examples/project/create-apple-platform.md delete mode 100644 docs/examples/project/create-ephemeral-key.md delete mode 100644 docs/examples/project/create-key.md delete mode 100644 docs/examples/project/create-linux-platform.md delete mode 100644 docs/examples/project/create-mock-phone.md delete mode 100644 docs/examples/project/create-smtp-test.md delete mode 100644 docs/examples/project/create-variable.md delete mode 100644 docs/examples/project/create-web-platform.md delete mode 100644 docs/examples/project/create-windows-platform.md delete mode 100644 docs/examples/project/delete-key.md delete mode 100644 docs/examples/project/delete-mock-phone.md delete mode 100644 docs/examples/project/delete-platform.md delete mode 100644 docs/examples/project/delete-variable.md delete mode 100644 docs/examples/project/delete.md delete mode 100644 docs/examples/project/get-email-template.md delete mode 100644 docs/examples/project/get-key.md delete mode 100644 docs/examples/project/get-mock-phone.md delete mode 100644 docs/examples/project/get-o-auth-2-provider.md delete mode 100644 docs/examples/project/get-platform.md delete mode 100644 docs/examples/project/get-policy.md delete mode 100644 docs/examples/project/get-variable.md delete mode 100644 docs/examples/project/get.md delete mode 100644 docs/examples/project/list-email-templates.md delete mode 100644 docs/examples/project/list-keys.md delete mode 100644 docs/examples/project/list-mock-phones.md delete mode 100644 docs/examples/project/list-o-auth-2-providers.md delete mode 100644 docs/examples/project/list-platforms.md delete mode 100644 docs/examples/project/list-policies.md delete mode 100644 docs/examples/project/list-variables.md delete mode 100644 docs/examples/project/update-android-platform.md delete mode 100644 docs/examples/project/update-apple-platform.md delete mode 100644 docs/examples/project/update-auth-method.md delete mode 100644 docs/examples/project/update-deny-aliased-email-policy.md delete mode 100644 docs/examples/project/update-deny-disposable-email-policy.md delete mode 100644 docs/examples/project/update-deny-free-email-policy.md delete mode 100644 docs/examples/project/update-email-template.md delete mode 100644 docs/examples/project/update-key.md delete mode 100644 docs/examples/project/update-labels.md delete mode 100644 docs/examples/project/update-linux-platform.md delete mode 100644 docs/examples/project/update-membership-privacy-policy.md delete mode 100644 docs/examples/project/update-mock-phone.md delete mode 100644 docs/examples/project/update-o-auth-2-amazon.md delete mode 100644 docs/examples/project/update-o-auth-2-apple.md delete mode 100644 docs/examples/project/update-o-auth-2-auth-0.md delete mode 100644 docs/examples/project/update-o-auth-2-authentik.md delete mode 100644 docs/examples/project/update-o-auth-2-autodesk.md delete mode 100644 docs/examples/project/update-o-auth-2-bitbucket.md delete mode 100644 docs/examples/project/update-o-auth-2-bitly.md delete mode 100644 docs/examples/project/update-o-auth-2-box.md delete mode 100644 docs/examples/project/update-o-auth-2-dailymotion.md delete mode 100644 docs/examples/project/update-o-auth-2-discord.md delete mode 100644 docs/examples/project/update-o-auth-2-disqus.md delete mode 100644 docs/examples/project/update-o-auth-2-dropbox.md delete mode 100644 docs/examples/project/update-o-auth-2-etsy.md delete mode 100644 docs/examples/project/update-o-auth-2-facebook.md delete mode 100644 docs/examples/project/update-o-auth-2-figma.md delete mode 100644 docs/examples/project/update-o-auth-2-fusion-auth.md delete mode 100644 docs/examples/project/update-o-auth-2-git-hub.md delete mode 100644 docs/examples/project/update-o-auth-2-gitlab.md delete mode 100644 docs/examples/project/update-o-auth-2-google.md delete mode 100644 docs/examples/project/update-o-auth-2-keycloak.md delete mode 100644 docs/examples/project/update-o-auth-2-kick.md delete mode 100644 docs/examples/project/update-o-auth-2-linkedin.md delete mode 100644 docs/examples/project/update-o-auth-2-microsoft.md delete mode 100644 docs/examples/project/update-o-auth-2-notion.md delete mode 100644 docs/examples/project/update-o-auth-2-oidc.md delete mode 100644 docs/examples/project/update-o-auth-2-okta.md delete mode 100644 docs/examples/project/update-o-auth-2-paypal-sandbox.md delete mode 100644 docs/examples/project/update-o-auth-2-paypal.md delete mode 100644 docs/examples/project/update-o-auth-2-podio.md delete mode 100644 docs/examples/project/update-o-auth-2-salesforce.md delete mode 100644 docs/examples/project/update-o-auth-2-slack.md delete mode 100644 docs/examples/project/update-o-auth-2-spotify.md delete mode 100644 docs/examples/project/update-o-auth-2-stripe.md delete mode 100644 docs/examples/project/update-o-auth-2-tradeshift-sandbox.md delete mode 100644 docs/examples/project/update-o-auth-2-tradeshift.md delete mode 100644 docs/examples/project/update-o-auth-2-twitch.md delete mode 100644 docs/examples/project/update-o-auth-2-word-press.md delete mode 100644 docs/examples/project/update-o-auth-2-yahoo.md delete mode 100644 docs/examples/project/update-o-auth-2-yandex.md delete mode 100644 docs/examples/project/update-o-auth-2-zoho.md delete mode 100644 docs/examples/project/update-o-auth-2-zoom.md delete mode 100644 docs/examples/project/update-o-auth-2x.md delete mode 100644 docs/examples/project/update-password-dictionary-policy.md delete mode 100644 docs/examples/project/update-password-history-policy.md delete mode 100644 docs/examples/project/update-password-personal-data-policy.md delete mode 100644 docs/examples/project/update-protocol.md delete mode 100644 docs/examples/project/update-service.md delete mode 100644 docs/examples/project/update-session-alert-policy.md delete mode 100644 docs/examples/project/update-session-duration-policy.md delete mode 100644 docs/examples/project/update-session-invalidation-policy.md delete mode 100644 docs/examples/project/update-session-limit-policy.md delete mode 100644 docs/examples/project/update-smtp.md delete mode 100644 docs/examples/project/update-user-limit-policy.md delete mode 100644 docs/examples/project/update-variable.md delete mode 100644 docs/examples/project/update-web-platform.md delete mode 100644 docs/examples/project/update-windows-platform.md delete mode 100644 docs/examples/proxy/create-api-rule.md delete mode 100644 docs/examples/proxy/create-function-rule.md delete mode 100644 docs/examples/proxy/create-redirect-rule.md delete mode 100644 docs/examples/proxy/create-site-rule.md delete mode 100644 docs/examples/proxy/delete-rule.md delete mode 100644 docs/examples/proxy/get-rule.md delete mode 100644 docs/examples/proxy/list-rules.md delete mode 100644 docs/examples/proxy/update-rule-status.md delete mode 100644 docs/examples/sites/create-deployment.md delete mode 100644 docs/examples/sites/create-duplicate-deployment.md delete mode 100644 docs/examples/sites/create-template-deployment.md delete mode 100644 docs/examples/sites/create-variable.md delete mode 100644 docs/examples/sites/create-vcs-deployment.md delete mode 100644 docs/examples/sites/create.md delete mode 100644 docs/examples/sites/delete-deployment.md delete mode 100644 docs/examples/sites/delete-log.md delete mode 100644 docs/examples/sites/delete-variable.md delete mode 100644 docs/examples/sites/delete.md delete mode 100644 docs/examples/sites/get-deployment-download.md delete mode 100644 docs/examples/sites/get-deployment.md delete mode 100644 docs/examples/sites/get-log.md delete mode 100644 docs/examples/sites/get-variable.md delete mode 100644 docs/examples/sites/get.md delete mode 100644 docs/examples/sites/list-deployments.md delete mode 100644 docs/examples/sites/list-frameworks.md delete mode 100644 docs/examples/sites/list-logs.md delete mode 100644 docs/examples/sites/list-specifications.md delete mode 100644 docs/examples/sites/list-variables.md delete mode 100644 docs/examples/sites/list.md delete mode 100644 docs/examples/sites/update-deployment-status.md delete mode 100644 docs/examples/sites/update-site-deployment.md delete mode 100644 docs/examples/sites/update-variable.md delete mode 100644 docs/examples/sites/update.md delete mode 100644 docs/examples/storage/create-bucket.md delete mode 100644 docs/examples/storage/create-file.md delete mode 100644 docs/examples/storage/delete-bucket.md delete mode 100644 docs/examples/storage/delete-file.md delete mode 100644 docs/examples/storage/get-bucket.md delete mode 100644 docs/examples/storage/get-file-download.md delete mode 100644 docs/examples/storage/get-file-preview.md delete mode 100644 docs/examples/storage/get-file-view.md delete mode 100644 docs/examples/storage/get-file.md delete mode 100644 docs/examples/storage/list-buckets.md delete mode 100644 docs/examples/storage/list-files.md delete mode 100644 docs/examples/storage/update-bucket.md delete mode 100644 docs/examples/storage/update-file.md delete mode 100644 docs/examples/tablesdb/create-big-int-column.md delete mode 100644 docs/examples/tablesdb/create-boolean-column.md delete mode 100644 docs/examples/tablesdb/create-datetime-column.md delete mode 100644 docs/examples/tablesdb/create-email-column.md delete mode 100644 docs/examples/tablesdb/create-enum-column.md delete mode 100644 docs/examples/tablesdb/create-float-column.md delete mode 100644 docs/examples/tablesdb/create-index.md delete mode 100644 docs/examples/tablesdb/create-integer-column.md delete mode 100644 docs/examples/tablesdb/create-ip-column.md delete mode 100644 docs/examples/tablesdb/create-line-column.md delete mode 100644 docs/examples/tablesdb/create-longtext-column.md delete mode 100644 docs/examples/tablesdb/create-mediumtext-column.md delete mode 100644 docs/examples/tablesdb/create-operations.md delete mode 100644 docs/examples/tablesdb/create-point-column.md delete mode 100644 docs/examples/tablesdb/create-polygon-column.md delete mode 100644 docs/examples/tablesdb/create-relationship-column.md delete mode 100644 docs/examples/tablesdb/create-row.md delete mode 100644 docs/examples/tablesdb/create-rows.md delete mode 100644 docs/examples/tablesdb/create-string-column.md delete mode 100644 docs/examples/tablesdb/create-table.md delete mode 100644 docs/examples/tablesdb/create-text-column.md delete mode 100644 docs/examples/tablesdb/create-transaction.md delete mode 100644 docs/examples/tablesdb/create-url-column.md delete mode 100644 docs/examples/tablesdb/create-varchar-column.md delete mode 100644 docs/examples/tablesdb/create.md delete mode 100644 docs/examples/tablesdb/decrement-row-column.md delete mode 100644 docs/examples/tablesdb/delete-column.md delete mode 100644 docs/examples/tablesdb/delete-index.md delete mode 100644 docs/examples/tablesdb/delete-row.md delete mode 100644 docs/examples/tablesdb/delete-rows.md delete mode 100644 docs/examples/tablesdb/delete-table.md delete mode 100644 docs/examples/tablesdb/delete-transaction.md delete mode 100644 docs/examples/tablesdb/delete.md delete mode 100644 docs/examples/tablesdb/get-column.md delete mode 100644 docs/examples/tablesdb/get-index.md delete mode 100644 docs/examples/tablesdb/get-row.md delete mode 100644 docs/examples/tablesdb/get-table.md delete mode 100644 docs/examples/tablesdb/get-transaction.md delete mode 100644 docs/examples/tablesdb/get.md delete mode 100644 docs/examples/tablesdb/increment-row-column.md delete mode 100644 docs/examples/tablesdb/list-columns.md delete mode 100644 docs/examples/tablesdb/list-indexes.md delete mode 100644 docs/examples/tablesdb/list-rows.md delete mode 100644 docs/examples/tablesdb/list-tables.md delete mode 100644 docs/examples/tablesdb/list-transactions.md delete mode 100644 docs/examples/tablesdb/list.md delete mode 100644 docs/examples/tablesdb/update-big-int-column.md delete mode 100644 docs/examples/tablesdb/update-boolean-column.md delete mode 100644 docs/examples/tablesdb/update-datetime-column.md delete mode 100644 docs/examples/tablesdb/update-email-column.md delete mode 100644 docs/examples/tablesdb/update-enum-column.md delete mode 100644 docs/examples/tablesdb/update-float-column.md delete mode 100644 docs/examples/tablesdb/update-integer-column.md delete mode 100644 docs/examples/tablesdb/update-ip-column.md delete mode 100644 docs/examples/tablesdb/update-line-column.md delete mode 100644 docs/examples/tablesdb/update-longtext-column.md delete mode 100644 docs/examples/tablesdb/update-mediumtext-column.md delete mode 100644 docs/examples/tablesdb/update-point-column.md delete mode 100644 docs/examples/tablesdb/update-polygon-column.md delete mode 100644 docs/examples/tablesdb/update-relationship-column.md delete mode 100644 docs/examples/tablesdb/update-row.md delete mode 100644 docs/examples/tablesdb/update-rows.md delete mode 100644 docs/examples/tablesdb/update-string-column.md delete mode 100644 docs/examples/tablesdb/update-table.md delete mode 100644 docs/examples/tablesdb/update-text-column.md delete mode 100644 docs/examples/tablesdb/update-transaction.md delete mode 100644 docs/examples/tablesdb/update-url-column.md delete mode 100644 docs/examples/tablesdb/update-varchar-column.md delete mode 100644 docs/examples/tablesdb/update.md delete mode 100644 docs/examples/tablesdb/upsert-row.md delete mode 100644 docs/examples/tablesdb/upsert-rows.md delete mode 100644 docs/examples/teams/create-membership.md delete mode 100644 docs/examples/teams/create.md delete mode 100644 docs/examples/teams/delete-membership.md delete mode 100644 docs/examples/teams/delete.md delete mode 100644 docs/examples/teams/get-membership.md delete mode 100644 docs/examples/teams/get-prefs.md delete mode 100644 docs/examples/teams/get.md delete mode 100644 docs/examples/teams/list-memberships.md delete mode 100644 docs/examples/teams/list.md delete mode 100644 docs/examples/teams/update-membership-status.md delete mode 100644 docs/examples/teams/update-membership.md delete mode 100644 docs/examples/teams/update-name.md delete mode 100644 docs/examples/teams/update-prefs.md delete mode 100644 docs/examples/tokens/create-file-token.md delete mode 100644 docs/examples/tokens/delete.md delete mode 100644 docs/examples/tokens/get.md delete mode 100644 docs/examples/tokens/list.md delete mode 100644 docs/examples/tokens/update.md delete mode 100644 docs/examples/usage/list-events.md delete mode 100644 docs/examples/usage/list-gauges.md delete mode 100644 docs/examples/users/create-argon-2-user.md delete mode 100644 docs/examples/users/create-bcrypt-user.md delete mode 100644 docs/examples/users/create-jwt.md delete mode 100644 docs/examples/users/create-md-5-user.md delete mode 100644 docs/examples/users/create-mfa-recovery-codes.md delete mode 100644 docs/examples/users/create-ph-pass-user.md delete mode 100644 docs/examples/users/create-scrypt-modified-user.md delete mode 100644 docs/examples/users/create-scrypt-user.md delete mode 100644 docs/examples/users/create-session.md delete mode 100644 docs/examples/users/create-sha-user.md delete mode 100644 docs/examples/users/create-target.md delete mode 100644 docs/examples/users/create-token.md delete mode 100644 docs/examples/users/create.md delete mode 100644 docs/examples/users/delete-identity.md delete mode 100644 docs/examples/users/delete-mfa-authenticator.md delete mode 100644 docs/examples/users/delete-session.md delete mode 100644 docs/examples/users/delete-sessions.md delete mode 100644 docs/examples/users/delete-target.md delete mode 100644 docs/examples/users/delete.md delete mode 100644 docs/examples/users/get-mfa-recovery-codes.md delete mode 100644 docs/examples/users/get-prefs.md delete mode 100644 docs/examples/users/get-target.md delete mode 100644 docs/examples/users/get.md delete mode 100644 docs/examples/users/list-identities.md delete mode 100644 docs/examples/users/list-logs.md delete mode 100644 docs/examples/users/list-memberships.md delete mode 100644 docs/examples/users/list-mfa-factors.md delete mode 100644 docs/examples/users/list-sessions.md delete mode 100644 docs/examples/users/list-targets.md delete mode 100644 docs/examples/users/list.md delete mode 100644 docs/examples/users/update-email-verification.md delete mode 100644 docs/examples/users/update-email.md delete mode 100644 docs/examples/users/update-impersonator.md delete mode 100644 docs/examples/users/update-labels.md delete mode 100644 docs/examples/users/update-mfa-recovery-codes.md delete mode 100644 docs/examples/users/update-mfa.md delete mode 100644 docs/examples/users/update-name.md delete mode 100644 docs/examples/users/update-password.md delete mode 100644 docs/examples/users/update-phone-verification.md delete mode 100644 docs/examples/users/update-phone.md delete mode 100644 docs/examples/users/update-prefs.md delete mode 100644 docs/examples/users/update-status.md delete mode 100644 docs/examples/users/update-target.md delete mode 100644 docs/examples/webhooks/create.md delete mode 100644 docs/examples/webhooks/delete.md delete mode 100644 docs/examples/webhooks/get.md delete mode 100644 docs/examples/webhooks/list.md delete mode 100644 docs/examples/webhooks/update-secret.md delete mode 100644 docs/examples/webhooks/update.md delete mode 100644 package-lock.json delete mode 100644 package.json delete mode 100644 src/client.ts delete mode 100644 src/enums/adapter.ts delete mode 100644 src/enums/attribute-status.ts delete mode 100644 src/enums/authentication-factor.ts delete mode 100644 src/enums/authenticator-type.ts delete mode 100644 src/enums/backup-services.ts delete mode 100644 src/enums/browser-permission.ts delete mode 100644 src/enums/browser.ts delete mode 100644 src/enums/build-runtime.ts delete mode 100644 src/enums/column-status.ts delete mode 100644 src/enums/compression.ts delete mode 100644 src/enums/credit-card.ts delete mode 100644 src/enums/database-type.ts delete mode 100644 src/enums/databases-index-type.ts delete mode 100644 src/enums/deployment-download-type.ts delete mode 100644 src/enums/deployment-status.ts delete mode 100644 src/enums/execution-method.ts delete mode 100644 src/enums/execution-status.ts delete mode 100644 src/enums/execution-trigger.ts delete mode 100644 src/enums/flag.ts delete mode 100644 src/enums/framework.ts delete mode 100644 src/enums/health-antivirus-status.ts delete mode 100644 src/enums/health-check-status.ts delete mode 100644 src/enums/image-format.ts delete mode 100644 src/enums/image-gravity.ts delete mode 100644 src/enums/index-status.ts delete mode 100644 src/enums/message-priority.ts delete mode 100644 src/enums/message-status.ts delete mode 100644 src/enums/messaging-provider-type.ts delete mode 100644 src/enums/name.ts delete mode 100644 src/enums/o-auth-2-google-prompt.ts delete mode 100644 src/enums/o-auth-provider.ts delete mode 100644 src/enums/order-by.ts delete mode 100644 src/enums/password-hash.ts delete mode 100644 src/enums/platform-type.ts delete mode 100644 src/enums/project-auth-method-id.ts delete mode 100644 src/enums/project-email-template-id.ts delete mode 100644 src/enums/project-email-template-locale.ts delete mode 100644 src/enums/project-key-scopes.ts delete mode 100644 src/enums/project-o-auth-2-google-prompt.ts delete mode 100644 src/enums/project-o-auth-provider-id.ts delete mode 100644 src/enums/project-policy-id.ts delete mode 100644 src/enums/project-protocol-id.ts delete mode 100644 src/enums/project-service-id.ts delete mode 100644 src/enums/project-smtp-secure.ts delete mode 100644 src/enums/proxy-resource-type.ts delete mode 100644 src/enums/proxy-rule-deployment-resource-type.ts delete mode 100644 src/enums/proxy-rule-status.ts delete mode 100644 src/enums/relation-mutate.ts delete mode 100644 src/enums/relationship-type.ts delete mode 100644 src/enums/runtime.ts delete mode 100644 src/enums/scopes.ts delete mode 100644 src/enums/smtp-encryption.ts delete mode 100644 src/enums/status-code.ts delete mode 100644 src/enums/tables-db-index-type.ts delete mode 100644 src/enums/template-reference-type.ts delete mode 100644 src/enums/theme.ts delete mode 100644 src/enums/timezone.ts delete mode 100644 src/enums/vcs-reference-type.ts delete mode 100644 src/id.ts delete mode 100644 src/index.ts delete mode 100644 src/inputFile.ts delete mode 100644 src/models.ts delete mode 100644 src/operator.ts delete mode 100644 src/permission.ts delete mode 100644 src/query.ts delete mode 100644 src/role.ts delete mode 100644 src/services/account.ts delete mode 100644 src/services/activities.ts delete mode 100644 src/services/advisor.ts delete mode 100644 src/services/avatars.ts delete mode 100644 src/services/backups.ts delete mode 100644 src/services/databases.ts delete mode 100644 src/services/functions.ts delete mode 100644 src/services/graphql.ts delete mode 100644 src/services/health.ts delete mode 100644 src/services/locale.ts delete mode 100644 src/services/messaging.ts delete mode 100644 src/services/presences.ts delete mode 100644 src/services/project.ts delete mode 100644 src/services/proxy.ts delete mode 100644 src/services/sites.ts delete mode 100644 src/services/storage.ts delete mode 100644 src/services/tables-db.ts delete mode 100644 src/services/teams.ts delete mode 100644 src/services/tokens.ts delete mode 100644 src/services/usage.ts delete mode 100644 src/services/users.ts delete mode 100644 src/services/webhooks.ts delete mode 100644 test/id.test.js delete mode 100644 test/operator.test.js delete mode 100644 test/permission.test.js delete mode 100644 test/query.test.js delete mode 100644 test/role.test.js delete mode 100644 test/services/account.test.js delete mode 100644 test/services/activities.test.js delete mode 100644 test/services/advisor.test.js delete mode 100644 test/services/avatars.test.js delete mode 100644 test/services/backups.test.js delete mode 100644 test/services/databases.test.js delete mode 100644 test/services/functions.test.js delete mode 100644 test/services/graphql.test.js delete mode 100644 test/services/health.test.js delete mode 100644 test/services/locale.test.js delete mode 100644 test/services/messaging.test.js delete mode 100644 test/services/presences.test.js delete mode 100644 test/services/project.test.js delete mode 100644 test/services/proxy.test.js delete mode 100644 test/services/sites.test.js delete mode 100644 test/services/storage.test.js delete mode 100644 test/services/tables-d-b.test.js delete mode 100644 test/services/teams.test.js delete mode 100644 test/services/tokens.test.js delete mode 100644 test/services/usage.test.js delete mode 100644 test/services/users.test.js delete mode 100644 test/services/webhooks.test.js delete mode 100644 tsconfig.json delete mode 100644 tsup.config.ts diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3bdd52eb..00000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -dist/ -.DS_Store diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 7253a5ce..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -min-release-age=7 diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index a47aa7fc..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,195 +0,0 @@ -# Change Log - -## 25.1.0 - -* Added `sizeActual` property to file model for actual stored size after compression -* Added `Deno121`, `Deno124`, and `Deno135` runtime options to `BuildRuntime` and `Runtime` enums -* Updated advisor authentication examples to use API key instead of session -* Updated billing limits properties to be optional in project models - -## 25.0.0 - -* Breaking: Renamed `AuthMethod` enum to `ProjectAuthMethodId` -* Breaking: Renamed `EmailTemplateType` to `ProjectEmailTemplateId` and `EmailTemplateLocale` to `ProjectEmailTemplateLocale` -* Breaking: Renamed `ServiceId` to `ProjectServiceId`, `ProtocolId` to `ProjectProtocolId`, `Secure` to `ProjectSMTPSecure`, `ProjectPolicy` to `ProjectPolicyId` -* Breaking: Replaced `Scopes` enum with `ProjectKeyScopes` for project key endpoints -* Breaking: Removed `updateDenyCanonicalEmailPolicy`; replaced with `updateDenyAliasedEmailPolicy`, `updateDenyDisposableEmailPolicy`, and `updateDenyFreeEmailPolicy` -* Breaking: Removed `AuthProvider` model; use new `ProjectOAuthProviderId` enum instead -* Added: `Project.get` method to fetch current project details -* Added: `Advisor`, `Presences`, and `Usage` services -* Added: `Insight`, `Presence`, `Report`, `UsageEvent`, and `UsageGauge` models with list variants -* Added: `ProjectAuthMethod`, `ProjectProtocol`, and `ProjectService` models -* Added: `ProjectOAuthProviderId` and `ProjectOAuth2GooglePrompt` enums -* Updated: `Project`, `Database`, and `OAuth2Google` model schemas -* Updated: `X-Appwrite-Response-Format` header to `1.9.5` - -## 24.1.0 - -* Added: Introduced `bigint` create/update APIs for legacy Databases attributes -* Added: Introduced `bigint` create/update APIs for `TablesDB` columns -* Updated: Extended key-list query filters with `key`, `resourceType`, `resourceId`, and `secret` - -## 24.0.0 - -* [BREAKING] Renamed Webhook model fields: `security` → `tls`, `httpUser` → `authUsername`, `httpPass` → `authPassword`, `signatureKey` → `secret` -* [BREAKING] Renamed Webhook service parameters to match: `security` → `tls`, `httpUser` → `authUsername`, `httpPass` → `authPassword` -* [BREAKING] Renamed `Webhooks.updateSignature()` to `Webhooks.updateSecret()` with new optional `secret` parameter -* Added `Client.getHeaders()` method to retrieve request headers -* Added `secret` parameter to Webhook create and update methods -* Added `x` OAuth provider to `OAuthProvider` enum -* Added `userType` field to `Log` model -* Added `purge` parameter to `updateCollection` and `updateTable` for cache invalidation -* Added Project service: platform CRUD, key CRUD, protocol/service status management -* Added new models: `Key`, `KeyList`, `Project`, `DevKey`, `MockNumber`, `AuthProvider`, `PlatformAndroid`, `PlatformApple`, `PlatformLinux`, `PlatformList`, `PlatformWeb`, `PlatformWindows`, `BillingLimits`, `Block` -* Added new enums: `PlatformType`, `ProtocolId`, `ServiceId` -* Updated `BuildRuntime`, `Runtime` enums with `dart-3.11` and `flutter-3.41` -* Updated `Scopes` enum with `keysRead`, `keysWrite`, `platformsRead`, `platformsWrite` -* Updated `X-Appwrite-Response-Format` header to `1.9.1` -* Updated TTL description for list caching in Databases and TablesDB - -## 23.1.0 - -* Added: Added `getHeaders()` method to `Client` to expose current request headers -* Added: Added `package-lock.json` to track dependency lockfile in version control -* Updated: Improved MFA authenticator test data with realistic TOTP secret and URI values - -## 23.0.0 - -* [BREAKING] Changed `$sequence` type from `number` to `string` for `Row` and `Document` models -* [BREAKING] Renamed `IndexType` enum: split into `DatabasesIndexType` (with new `Spatial` value) and `TablesDBIndexType` -* [BREAKING] Replaced `specification` parameter with `buildSpecification` and `runtimeSpecification` in `Functions.create()`, `Functions.update()`, `Sites.create()`, `Sites.update()` -* Added new `Project` service with full CRUD for project-level environment variables -* Added new `Webhooks` service with full CRUD for project webhooks (including `updateSignature`) -* Added `Users.updateImpersonator()` method for enabling/disabling user impersonation -* Added impersonation support: `setImpersonateUserId()`, `setImpersonateUserEmail()`, `setImpersonateUserPhone()` on `Client` -* Added `impersonator` and `impersonatorUserId` optional fields to `User` model -* Added `deploymentRetention` parameter to Functions and Sites create/update -* Added `startCommand` parameter to Sites create/update -* Added `Webhook` and `WebhookList` models -* Added `Documentsdb`, `Vectorsdb` values to `BackupServices` and `DatabaseType` enums -* Added `WebhooksRead`, `WebhooksWrite`, `ProjectRead`, `ProjectWrite` scopes -* Added custom `toString()` on response data using `JSONbig.stringify` for BigInt support -* Removed `getQueueBillingProjectAggregation`, `getQueueBillingTeamAggregation`, `getQueuePriorityBuilds`, `getQueueRegionManager`, `getQueueThreats` from `Health` service -* Updated `Log` model field descriptions to clarify impersonation behavior -* Updated `X-Appwrite-Response-Format` header to `1.9.0` - -## 22.1.2 - -* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals - -## 22.1.1 - -* Removed unused BigNumber import from src/client.ts to clean up dependencies -* Updated documentation examples to include the new encrypt option for text-like attributes (encrypt: false) across multiple examples -* Updated README to specify Appwrite server compatibility with 1.8.x -* Repo cleanup: removed obsolete GitHub workflow and issue template files as part of repository cleanup (non-breaking) - -## 22.0.1 - -* Fix doc examples with proper formatting -* Add support for the new `Backups` service - -## 22.0.0 - -* Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`). -* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. -* Add `getQueueAudits` support to `Health` service. -* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. - -## 21.1.0 - -* Added ability to create columns and indexes synchronously while creating a table - -## 21.0.0 - -* Rename `VCSDeploymentType` enum to `VCSReferenceType` -* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters -* Add `getScreenshot` method to `Avatars` service -* Add `Theme`, `Timezone` and `Output` enums - -## 20.3.0 - -* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance -* Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations -* Add `createResendProvider` and `updateResendProvider` methods to `Messaging` service - -## 20.2.1 - -* Add transaction support for Databases and TablesDB - -## 20.1.0 - -* Deprecate `createVerification` method in `Account` service -* Add `createEmailVerification` method in `Account` service - -## 17.2.0 - -* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service -* Fix autocompletion not working for `Document` model even when generic is passed - -## 17.1.0 - -* Add `upsertDocument` method -* Add `dart-3.8` and `flutter-3.32` runtimes -* Add `gif` image format -* Update bulk operation methods to reflect warning message -* Fix file parameter handling in chunked upload method - -## 17.0.0 - -* Add `REGION` to doc examples due to the new multi region endpoints -* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. -* Add doc examples, class and methods for new `Sites` service -* Add doc examples, class and methods for new `Tokens` service -* Add enums for `BuildRuntime`, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` -* Updates enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 -* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage -* Add `queries` and `search` params to `listMemberships` method -* Removes `search` param from `listExecutions` method - -## 16.0.0 - -* Fix: remove content-type from GET requests -* Update (breaking): min and max params are now optional in `updateFloatAttribute` and `updateIntegerAttribute` methods (changes their positioning in method definition) - -## 15.0.1 - -* Remove titles from all function descriptions -* Fix typing for collection "attribute" key -* Remove unnecessary awaits and asyncs -* Ensure `AppwriteException` response is always string - -## 15.0.0 - -* Fix: pong response & chunked upload - -## 14.2.0 - -* Add new push message parameters - -## 14.1.0 - -* Support updating attribute name and size - -## 14.0.0 - -* Support for Appwrite 1.6 -* Add `key` attribute to `Runtime` response model. -* Add `buildSize` attribute to `Deployments` response model -* Add `scheduledAt` attribute to `Executions` response model -* Add `scopes` attribute to `Functions` response model -* Add `specifications` attribute to `Functions` response model -* Add new response model for `Specifications` -* Add new response model for `Builds` -* Add `createJWT()` : Enables creating a JWT using the `userId` -* Add `listSpecifications()`: Enables listing available runtime specifications -* Add `deleteExecution()` : Enables deleting executions -* Add `updateDeploymentBuild()`: Enables cancelling a deployment -* Add `scheduledAt` parameter to `createExecution()`: Enables creating a delayed execution -* Breaking changes - * Remove `otp` parameter from `deleteMFAAuthenticator`. - * Add `scopes` parameter for create/update function. - * Rename `templateBranch` to `templateVersion` in `createFunction()`. - * Rename `downloadDeployment()` to `getDeploymentDownload()` - -> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 6f8702b5..00000000 --- a/LICENSE +++ /dev/null @@ -1,12 +0,0 @@ -Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 62fd49f6..00000000 --- a/README.md +++ /dev/null @@ -1,175 +0,0 @@ -# Appwrite Node.js SDK - -![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square) -[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) -[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) -[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) - -**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** - - > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. - If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) - -Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Node.js SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) - -![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) - -## Installation - -To install via [NPM](https://www.npmjs.com/): - -```bash -npm install node-appwrite --save -``` - - -## Getting Started - -### Init your SDK - -Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key project API keys section. - -```js -const sdk = require('node-appwrite'); - -let client = new sdk.Client(); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - .setSelfSigned() // Use only on dev mode with a self-signed SSL cert -; -``` - -### Make Your First Request - -Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section. - -```js -let users = new sdk.Users(client); - -let promise = users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); -``` - -### Full Example -```js -const sdk = require('node-appwrite'); - -let client = new sdk.Client(); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key - .setSelfSigned() // Use only on dev mode with a self-signed SSL cert -; - -let users = new sdk.Users(client); -let promise = users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); -``` - -### Type Safety with Models - -The Appwrite Node SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a generic type parameter that allows you to specify your custom model type for full type safety. - -**TypeScript:** -```typescript -interface Book { - name: string; - author: string; - releaseYear?: string; - category?: string; - genre?: string[]; - isCheckedOut: boolean; -} - -const databases = new Databases(client); - -try { - const documents = await databases.listDocuments( - 'your-database-id', - 'your-collection-id' - ); - - documents.documents.forEach(book => { - console.log(`Book: ${book.name} by ${book.author}`); // Now you have full type safety - }); -} catch (error) { - console.error('Appwrite error:', error); -} -``` - -**JavaScript (with JSDoc for type hints):** -```javascript -/** - * @typedef {Object} Book - * @property {string} name - * @property {string} author - * @property {string} [releaseYear] - * @property {string} [category] - * @property {string[]} [genre] - * @property {boolean} isCheckedOut - */ - -const databases = new Databases(client); - -try { - /** @type {Models.DocumentList} */ - const documents = await databases.listDocuments( - 'your-database-id', - 'your-collection-id' - ); - - documents.documents.forEach(book => { - console.log(`Book: ${book.name} by ${book.author}`); // Type hints available in IDE - }); -} catch (error) { - console.error('Appwrite error:', error); -} -``` - -**Tip**: You can use the `appwrite types` command to automatically generate TypeScript interfaces based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation). - -### Error Handling - -The Appwrite Node SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example. - -```js -let users = new sdk.Users(client); - -try { - let res = await users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); -} catch(e) { - console.log(e.message); -} -``` - -### Learn more -You can use the following resources to learn more and get help -- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) -- 📜 [Appwrite Docs](https://appwrite.io/docs) -- 💬 [Discord Community](https://appwrite.io/discord) -- 🚂 [Appwrite Node Playground](https://github.com/appwrite/playground-for-node) - - -## Contribution - -This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. - -## License - -Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md deleted file mode 100644 index 036df9b9..00000000 --- a/docs/examples/account/create-anonymous-session.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createAnonymousSession(); -``` diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md deleted file mode 100644 index 125d73bb..00000000 --- a/docs/examples/account/create-email-password-session.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createEmailPasswordSession({ - email: 'email@example.com', - password: 'password' -}); -``` diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md deleted file mode 100644 index cebf1f61..00000000 --- a/docs/examples/account/create-email-token.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createEmailToken({ - userId: '', - email: 'email@example.com', - phrase: false // optional -}); -``` diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md deleted file mode 100644 index 6c74da96..00000000 --- a/docs/examples/account/create-email-verification.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createEmailVerification({ - url: 'https://example.com' -}); -``` diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md deleted file mode 100644 index c7204e0f..00000000 --- a/docs/examples/account/create-jwt.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createJWT({ - duration: 0 // optional -}); -``` diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md deleted file mode 100644 index ee5f1432..00000000 --- a/docs/examples/account/create-magic-url-token.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createMagicURLToken({ - userId: '', - email: 'email@example.com', - url: 'https://example.com', // optional - phrase: false // optional -}); -``` diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md deleted file mode 100644 index 25081e27..00000000 --- a/docs/examples/account/create-mfa-authenticator.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createMFAAuthenticator({ - type: sdk.AuthenticatorType.Totp -}); -``` diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md deleted file mode 100644 index af4e0448..00000000 --- a/docs/examples/account/create-mfa-challenge.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createMFAChallenge({ - factor: sdk.AuthenticationFactor.Email -}); -``` diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md deleted file mode 100644 index 5e8e4021..00000000 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createMFARecoveryCodes(); -``` diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md deleted file mode 100644 index 7bc8a243..00000000 --- a/docs/examples/account/create-o-auth-2-token.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createOAuth2Token({ - provider: sdk.OAuthProvider.Amazon, - success: 'https://example.com', // optional - failure: 'https://example.com', // optional - scopes: [] // optional -}); -``` diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md deleted file mode 100644 index 999f3e10..00000000 --- a/docs/examples/account/create-phone-token.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createPhoneToken({ - userId: '', - phone: '+12065550100' -}); -``` diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md deleted file mode 100644 index 05708153..00000000 --- a/docs/examples/account/create-phone-verification.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createPhoneVerification(); -``` diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md deleted file mode 100644 index 4dd41d7e..00000000 --- a/docs/examples/account/create-recovery.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createRecovery({ - email: 'email@example.com', - url: 'https://example.com' -}); -``` diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md deleted file mode 100644 index 3ab786f9..00000000 --- a/docs/examples/account/create-session.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createSession({ - userId: '', - secret: '' -}); -``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md deleted file mode 100644 index 95dec7e3..00000000 --- a/docs/examples/account/create-verification.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.createVerification({ - url: 'https://example.com' -}); -``` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md deleted file mode 100644 index db31f30b..00000000 --- a/docs/examples/account/create.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.create({ - userId: '', - email: 'email@example.com', - password: '', - name: '' // optional -}); -``` diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md deleted file mode 100644 index 53a043bf..00000000 --- a/docs/examples/account/delete-identity.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.deleteIdentity({ - identityId: '' -}); -``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md deleted file mode 100644 index 18522f2d..00000000 --- a/docs/examples/account/delete-mfa-authenticator.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.deleteMFAAuthenticator({ - type: sdk.AuthenticatorType.Totp -}); -``` diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md deleted file mode 100644 index 7fe49e3f..00000000 --- a/docs/examples/account/delete-session.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.deleteSession({ - sessionId: '' -}); -``` diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md deleted file mode 100644 index 912575ce..00000000 --- a/docs/examples/account/delete-sessions.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.deleteSessions(); -``` diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md deleted file mode 100644 index cb08fe7c..00000000 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.getMFARecoveryCodes(); -``` diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md deleted file mode 100644 index 67edf19f..00000000 --- a/docs/examples/account/get-prefs.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.getPrefs(); -``` diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md deleted file mode 100644 index dab81595..00000000 --- a/docs/examples/account/get-session.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.getSession({ - sessionId: '' -}); -``` diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md deleted file mode 100644 index e755aa46..00000000 --- a/docs/examples/account/get.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.get(); -``` diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md deleted file mode 100644 index 00d60b9e..00000000 --- a/docs/examples/account/list-identities.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.listIdentities({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md deleted file mode 100644 index d7e89331..00000000 --- a/docs/examples/account/list-logs.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.listLogs({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md deleted file mode 100644 index 31362190..00000000 --- a/docs/examples/account/list-mfa-factors.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.listMFAFactors(); -``` diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md deleted file mode 100644 index 0bbd093e..00000000 --- a/docs/examples/account/list-sessions.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.listSessions(); -``` diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md deleted file mode 100644 index 4fd5953b..00000000 --- a/docs/examples/account/update-email-verification.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateEmailVerification({ - userId: '', - secret: '' -}); -``` diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md deleted file mode 100644 index 985c189b..00000000 --- a/docs/examples/account/update-email.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateEmail({ - email: 'email@example.com', - password: 'password' -}); -``` diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md deleted file mode 100644 index 1811200a..00000000 --- a/docs/examples/account/update-magic-url-session.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateMagicURLSession({ - userId: '', - secret: '' -}); -``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md deleted file mode 100644 index fa34ef45..00000000 --- a/docs/examples/account/update-mfa-authenticator.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateMFAAuthenticator({ - type: sdk.AuthenticatorType.Totp, - otp: '' -}); -``` diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md deleted file mode 100644 index a584356b..00000000 --- a/docs/examples/account/update-mfa-challenge.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateMFAChallenge({ - challengeId: '', - otp: '' -}); -``` diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md deleted file mode 100644 index c893c231..00000000 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateMFARecoveryCodes(); -``` diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md deleted file mode 100644 index 38604a3b..00000000 --- a/docs/examples/account/update-mfa.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateMFA({ - mfa: false -}); -``` diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md deleted file mode 100644 index 24fb8692..00000000 --- a/docs/examples/account/update-name.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateName({ - name: '' -}); -``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md deleted file mode 100644 index f6b7bb54..00000000 --- a/docs/examples/account/update-password.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updatePassword({ - password: '', - oldPassword: 'password' // optional -}); -``` diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md deleted file mode 100644 index 204c33a7..00000000 --- a/docs/examples/account/update-phone-session.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updatePhoneSession({ - userId: '', - secret: '' -}); -``` diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md deleted file mode 100644 index c5e1abd3..00000000 --- a/docs/examples/account/update-phone-verification.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updatePhoneVerification({ - userId: '', - secret: '' -}); -``` diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md deleted file mode 100644 index c6763022..00000000 --- a/docs/examples/account/update-phone.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updatePhone({ - phone: '+12065550100', - password: 'password' -}); -``` diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md deleted file mode 100644 index 65c70e0e..00000000 --- a/docs/examples/account/update-prefs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updatePrefs({ - prefs: { - "language": "en", - "timezone": "UTC", - "darkTheme": true - } -}); -``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md deleted file mode 100644 index 268f3e97..00000000 --- a/docs/examples/account/update-recovery.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateRecovery({ - userId: '', - secret: '', - password: '' -}); -``` diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md deleted file mode 100644 index 9dfcbf26..00000000 --- a/docs/examples/account/update-session.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateSession({ - sessionId: '' -}); -``` diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md deleted file mode 100644 index ffb3f25e..00000000 --- a/docs/examples/account/update-status.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateStatus(); -``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md deleted file mode 100644 index 0486ce39..00000000 --- a/docs/examples/account/update-verification.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const account = new sdk.Account(client); - -const result = await account.updateVerification({ - userId: '', - secret: '' -}); -``` diff --git a/docs/examples/activities/get-event.md b/docs/examples/activities/get-event.md deleted file mode 100644 index da7c261f..00000000 --- a/docs/examples/activities/get-event.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const activities = new sdk.Activities(client); - -const result = await activities.getEvent({ - eventId: '' -}); -``` diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md deleted file mode 100644 index 11407e89..00000000 --- a/docs/examples/activities/list-events.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const activities = new sdk.Activities(client); - -const result = await activities.listEvents({ - queries: '' // optional -}); -``` diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md deleted file mode 100644 index 8169db07..00000000 --- a/docs/examples/advisor/delete-report.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const advisor = new sdk.Advisor(client); - -const result = await advisor.deleteReport({ - reportId: '' -}); -``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md deleted file mode 100644 index 7a625d28..00000000 --- a/docs/examples/advisor/get-insight.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const advisor = new sdk.Advisor(client); - -const result = await advisor.getInsight({ - reportId: '', - insightId: '' -}); -``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md deleted file mode 100644 index abd111c0..00000000 --- a/docs/examples/advisor/get-report.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const advisor = new sdk.Advisor(client); - -const result = await advisor.getReport({ - reportId: '' -}); -``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md deleted file mode 100644 index a4adefac..00000000 --- a/docs/examples/advisor/list-insights.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const advisor = new sdk.Advisor(client); - -const result = await advisor.listInsights({ - reportId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md deleted file mode 100644 index 6fa66f10..00000000 --- a/docs/examples/advisor/list-reports.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const advisor = new sdk.Advisor(client); - -const result = await advisor.listReports({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md deleted file mode 100644 index 6ffb388d..00000000 --- a/docs/examples/avatars/get-browser.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getBrowser({ - code: sdk.Browser.AvantBrowser, - width: 0, // optional - height: 0, // optional - quality: -1 // optional -}); -``` diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md deleted file mode 100644 index ea806baf..00000000 --- a/docs/examples/avatars/get-credit-card.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getCreditCard({ - code: sdk.CreditCard.AmericanExpress, - width: 0, // optional - height: 0, // optional - quality: -1 // optional -}); -``` diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md deleted file mode 100644 index bd9ae2ca..00000000 --- a/docs/examples/avatars/get-favicon.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getFavicon({ - url: 'https://example.com' -}); -``` diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md deleted file mode 100644 index d05b666b..00000000 --- a/docs/examples/avatars/get-flag.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getFlag({ - code: sdk.Flag.Afghanistan, - width: 0, // optional - height: 0, // optional - quality: -1 // optional -}); -``` diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md deleted file mode 100644 index 6f013db1..00000000 --- a/docs/examples/avatars/get-image.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getImage({ - url: 'https://example.com', - width: 0, // optional - height: 0 // optional -}); -``` diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md deleted file mode 100644 index 3d35c6df..00000000 --- a/docs/examples/avatars/get-initials.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getInitials({ - name: '', // optional - width: 0, // optional - height: 0, // optional - background: '' // optional -}); -``` diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md deleted file mode 100644 index e4235a38..00000000 --- a/docs/examples/avatars/get-qr.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getQR({ - text: '', - size: 1, // optional - margin: 0, // optional - download: false // optional -}); -``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md deleted file mode 100644 index 1aab6cd3..00000000 --- a/docs/examples/avatars/get-screenshot.md +++ /dev/null @@ -1,36 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const avatars = new sdk.Avatars(client); - -const result = await avatars.getScreenshot({ - url: 'https://example.com', - headers: { - "Authorization": "Bearer token123", - "X-Custom-Header": "value" - }, // optional - viewportWidth: 1920, // optional - viewportHeight: 1080, // optional - scale: 2, // optional - theme: sdk.Theme.Dark, // optional - userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional - fullpage: true, // optional - locale: 'en-US', // optional - timezone: sdk.Timezone.AmericaNewYork, // optional - latitude: 37.7749, // optional - longitude: -122.4194, // optional - accuracy: 100, // optional - touch: true, // optional - permissions: [sdk.BrowserPermission.Geolocation, sdk.BrowserPermission.Notifications], // optional - sleep: 3, // optional - width: 800, // optional - height: 600, // optional - quality: 85, // optional - output: sdk.ImageFormat.Jpeg // optional -}); -``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md deleted file mode 100644 index 1a11d459..00000000 --- a/docs/examples/backups/create-archive.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.createArchive({ - services: [sdk.BackupServices.Databases], - resourceId: '' // optional -}); -``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md deleted file mode 100644 index 71670929..00000000 --- a/docs/examples/backups/create-policy.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.createPolicy({ - policyId: '', - services: [sdk.BackupServices.Databases], - retention: 1, - schedule: '', - name: '', // optional - resourceId: '', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md deleted file mode 100644 index f41a2344..00000000 --- a/docs/examples/backups/create-restoration.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.createRestoration({ - archiveId: '', - services: [sdk.BackupServices.Databases], - newResourceId: '', // optional - newResourceName: '' // optional -}); -``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md deleted file mode 100644 index f0c5615d..00000000 --- a/docs/examples/backups/delete-archive.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.deleteArchive({ - archiveId: '' -}); -``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md deleted file mode 100644 index 493e89ef..00000000 --- a/docs/examples/backups/delete-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.deletePolicy({ - policyId: '' -}); -``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md deleted file mode 100644 index ade4e222..00000000 --- a/docs/examples/backups/get-archive.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.getArchive({ - archiveId: '' -}); -``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md deleted file mode 100644 index 391c0196..00000000 --- a/docs/examples/backups/get-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.getPolicy({ - policyId: '' -}); -``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md deleted file mode 100644 index 46d18f3a..00000000 --- a/docs/examples/backups/get-restoration.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.getRestoration({ - restorationId: '' -}); -``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md deleted file mode 100644 index d6f51c56..00000000 --- a/docs/examples/backups/list-archives.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.listArchives({ - queries: [] // optional -}); -``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md deleted file mode 100644 index 7f87b1d6..00000000 --- a/docs/examples/backups/list-policies.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.listPolicies({ - queries: [] // optional -}); -``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md deleted file mode 100644 index 4475a17d..00000000 --- a/docs/examples/backups/list-restorations.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.listRestorations({ - queries: [] // optional -}); -``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md deleted file mode 100644 index 5912b39f..00000000 --- a/docs/examples/backups/update-policy.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const backups = new sdk.Backups(client); - -const result = await backups.updatePolicy({ - policyId: '', - name: '', // optional - retention: 1, // optional - schedule: '', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md deleted file mode 100644 index 3d40ce75..00000000 --- a/docs/examples/databases/create-big-int-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createBigIntAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md deleted file mode 100644 index 606ca49c..00000000 --- a/docs/examples/databases/create-boolean-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createBooleanAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: false, // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md deleted file mode 100644 index b58e0919..00000000 --- a/docs/examples/databases/create-collection.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createCollection({ - databaseId: '', - collectionId: '', - name: '', - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - documentSecurity: false, // optional - enabled: false, // optional - attributes: [], // optional - indexes: [] // optional -}); -``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md deleted file mode 100644 index 361ee95e..00000000 --- a/docs/examples/databases/create-datetime-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createDatetimeAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md deleted file mode 100644 index 3c38b69e..00000000 --- a/docs/examples/databases/create-document.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.createDocument({ - databaseId: '', - collectionId: '', - documentId: '', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 30, - "isAdmin": false - }, - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md deleted file mode 100644 index 60f4eab8..00000000 --- a/docs/examples/databases/create-documents.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createDocuments({ - databaseId: '', - collectionId: '', - documents: [], - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md deleted file mode 100644 index 13382c3d..00000000 --- a/docs/examples/databases/create-email-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createEmailAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: 'email@example.com', // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md deleted file mode 100644 index fe7abce4..00000000 --- a/docs/examples/databases/create-enum-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createEnumAttribute({ - databaseId: '', - collectionId: '', - key: '', - elements: [], - required: false, - xdefault: '', // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md deleted file mode 100644 index f179528f..00000000 --- a/docs/examples/databases/create-float-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createFloatAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md deleted file mode 100644 index ba3bf3a6..00000000 --- a/docs/examples/databases/create-index.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createIndex({ - databaseId: '', - collectionId: '', - key: '', - type: sdk.DatabasesIndexType.Key, - attributes: [], - orders: [sdk.OrderBy.Asc], // optional - lengths: [] // optional -}); -``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md deleted file mode 100644 index d0dbed90..00000000 --- a/docs/examples/databases/create-integer-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createIntegerAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md deleted file mode 100644 index c21ad541..00000000 --- a/docs/examples/databases/create-ip-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createIpAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md deleted file mode 100644 index 8d615095..00000000 --- a/docs/examples/databases/create-line-attribute.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createLineAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional -}); -``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md deleted file mode 100644 index b49077ee..00000000 --- a/docs/examples/databases/create-longtext-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createLongtextAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md deleted file mode 100644 index 44d9199f..00000000 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createMediumtextAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md deleted file mode 100644 index 06a3c468..00000000 --- a/docs/examples/databases/create-operations.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createOperations({ - transactionId: '', - operations: [ - { - "action": "create", - "databaseId": "", - "collectionId": "", - "documentId": "", - "data": { - "name": "Walter O'Brien" - } - } - ] // optional -}); -``` diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md deleted file mode 100644 index 57058752..00000000 --- a/docs/examples/databases/create-point-attribute.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createPointAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: [1, 2] // optional -}); -``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md deleted file mode 100644 index f3562ab4..00000000 --- a/docs/examples/databases/create-polygon-attribute.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createPolygonAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -}); -``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md deleted file mode 100644 index 30d4dfd7..00000000 --- a/docs/examples/databases/create-relationship-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createRelationshipAttribute({ - databaseId: '', - collectionId: '', - relatedCollectionId: '', - type: sdk.RelationshipType.OneToOne, - twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: sdk.RelationMutate.Cascade // optional -}); -``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md deleted file mode 100644 index e0c2cdb4..00000000 --- a/docs/examples/databases/create-string-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createStringAttribute({ - databaseId: '', - collectionId: '', - key: '', - size: 1, - required: false, - xdefault: '', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md deleted file mode 100644 index 48fd6ded..00000000 --- a/docs/examples/databases/create-text-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createTextAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md deleted file mode 100644 index 8785149a..00000000 --- a/docs/examples/databases/create-transaction.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createTransaction({ - ttl: 60 // optional -}); -``` diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md deleted file mode 100644 index f0d1a29a..00000000 --- a/docs/examples/databases/create-url-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createUrlAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: 'https://example.com', // optional - array: false // optional -}); -``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md deleted file mode 100644 index 64582747..00000000 --- a/docs/examples/databases/create-varchar-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.createVarcharAttribute({ - databaseId: '', - collectionId: '', - key: '', - size: 1, - required: false, - xdefault: '', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md deleted file mode 100644 index d35731b6..00000000 --- a/docs/examples/databases/create.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.create({ - databaseId: '', - name: '', - enabled: false // optional -}); -``` diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md deleted file mode 100644 index 80fe2486..00000000 --- a/docs/examples/databases/decrement-document-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.decrementDocumentAttribute({ - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - value: null, // optional - min: null, // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md deleted file mode 100644 index 30501051..00000000 --- a/docs/examples/databases/delete-attribute.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.deleteAttribute({ - databaseId: '', - collectionId: '', - key: '' -}); -``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md deleted file mode 100644 index 2da5c205..00000000 --- a/docs/examples/databases/delete-collection.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.deleteCollection({ - databaseId: '', - collectionId: '' -}); -``` diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md deleted file mode 100644 index 22bc7143..00000000 --- a/docs/examples/databases/delete-document.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.deleteDocument({ - databaseId: '', - collectionId: '', - documentId: '', - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md deleted file mode 100644 index 4851243e..00000000 --- a/docs/examples/databases/delete-documents.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.deleteDocuments({ - databaseId: '', - collectionId: '', - queries: [], // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md deleted file mode 100644 index b7a8f0c3..00000000 --- a/docs/examples/databases/delete-index.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.deleteIndex({ - databaseId: '', - collectionId: '', - key: '' -}); -``` diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md deleted file mode 100644 index b89214ba..00000000 --- a/docs/examples/databases/delete-transaction.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.deleteTransaction({ - transactionId: '' -}); -``` diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md deleted file mode 100644 index 00009485..00000000 --- a/docs/examples/databases/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.delete({ - databaseId: '' -}); -``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md deleted file mode 100644 index eade77dd..00000000 --- a/docs/examples/databases/get-attribute.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.getAttribute({ - databaseId: '', - collectionId: '', - key: '' -}); -``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md deleted file mode 100644 index 8b96abaf..00000000 --- a/docs/examples/databases/get-collection.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.getCollection({ - databaseId: '', - collectionId: '' -}); -``` diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md deleted file mode 100644 index 9a66df4f..00000000 --- a/docs/examples/databases/get-document.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.getDocument({ - databaseId: '', - collectionId: '', - documentId: '', - queries: [], // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md deleted file mode 100644 index 1900b0f5..00000000 --- a/docs/examples/databases/get-index.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.getIndex({ - databaseId: '', - collectionId: '', - key: '' -}); -``` diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md deleted file mode 100644 index 09c0255a..00000000 --- a/docs/examples/databases/get-transaction.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.getTransaction({ - transactionId: '' -}); -``` diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md deleted file mode 100644 index 9533a738..00000000 --- a/docs/examples/databases/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.get({ - databaseId: '' -}); -``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md deleted file mode 100644 index cb24d704..00000000 --- a/docs/examples/databases/increment-document-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.incrementDocumentAttribute({ - databaseId: '', - collectionId: '', - documentId: '', - attribute: '', - value: null, // optional - max: null, // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md deleted file mode 100644 index 635391cd..00000000 --- a/docs/examples/databases/list-attributes.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.listAttributes({ - databaseId: '', - collectionId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md deleted file mode 100644 index 38f1f3eb..00000000 --- a/docs/examples/databases/list-collections.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.listCollections({ - databaseId: '', - queries: [], // optional - search: '', // optional - total: false // optional -}); -``` diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md deleted file mode 100644 index 11fcec2d..00000000 --- a/docs/examples/databases/list-documents.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.listDocuments({ - databaseId: '', - collectionId: '', - queries: [], // optional - transactionId: '', // optional - total: false, // optional - ttl: 0 // optional -}); -``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md deleted file mode 100644 index c6411092..00000000 --- a/docs/examples/databases/list-indexes.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.listIndexes({ - databaseId: '', - collectionId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md deleted file mode 100644 index 4707b131..00000000 --- a/docs/examples/databases/list-transactions.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.listTransactions({ - queries: [] // optional -}); -``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md deleted file mode 100644 index d88d05ee..00000000 --- a/docs/examples/databases/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.list({ - queries: [], // optional - search: '', // optional - total: false // optional -}); -``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md deleted file mode 100644 index 1ff012a5..00000000 --- a/docs/examples/databases/update-big-int-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateBigIntAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md deleted file mode 100644 index c9b165e9..00000000 --- a/docs/examples/databases/update-boolean-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateBooleanAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: false, - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md deleted file mode 100644 index f7f65c32..00000000 --- a/docs/examples/databases/update-collection.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateCollection({ - databaseId: '', - collectionId: '', - name: '', // optional - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - documentSecurity: false, // optional - enabled: false, // optional - purge: false // optional -}); -``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md deleted file mode 100644 index 6c65696b..00000000 --- a/docs/examples/databases/update-datetime-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateDatetimeAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md deleted file mode 100644 index cae4ccfe..00000000 --- a/docs/examples/databases/update-document.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.updateDocument({ - databaseId: '', - collectionId: '', - documentId: '', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false - }, // optional - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md deleted file mode 100644 index 168074c1..00000000 --- a/docs/examples/databases/update-documents.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateDocuments({ - databaseId: '', - collectionId: '', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false - }, // optional - queries: [], // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md deleted file mode 100644 index fa6c4319..00000000 --- a/docs/examples/databases/update-email-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateEmailAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: 'email@example.com', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md deleted file mode 100644 index 0fc74cdf..00000000 --- a/docs/examples/databases/update-enum-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateEnumAttribute({ - databaseId: '', - collectionId: '', - key: '', - elements: [], - required: false, - xdefault: '', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md deleted file mode 100644 index 894ab665..00000000 --- a/docs/examples/databases/update-float-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateFloatAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md deleted file mode 100644 index 10ddb38f..00000000 --- a/docs/examples/databases/update-integer-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateIntegerAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md deleted file mode 100644 index 5e53e5d7..00000000 --- a/docs/examples/databases/update-ip-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateIpAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md deleted file mode 100644 index c106a035..00000000 --- a/docs/examples/databases/update-line-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateLineAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md deleted file mode 100644 index d21f3988..00000000 --- a/docs/examples/databases/update-longtext-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateLongtextAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md deleted file mode 100644 index 25857d5d..00000000 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateMediumtextAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md deleted file mode 100644 index 96a4ae85..00000000 --- a/docs/examples/databases/update-point-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updatePointAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: [1, 2], // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md deleted file mode 100644 index 72828a8a..00000000 --- a/docs/examples/databases/update-polygon-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updatePolygonAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md deleted file mode 100644 index 9dc8ebd7..00000000 --- a/docs/examples/databases/update-relationship-attribute.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateRelationshipAttribute({ - databaseId: '', - collectionId: '', - key: '', - onDelete: sdk.RelationMutate.Cascade, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md deleted file mode 100644 index 1c509d28..00000000 --- a/docs/examples/databases/update-string-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateStringAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', - size: 1, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md deleted file mode 100644 index 3154f5a9..00000000 --- a/docs/examples/databases/update-text-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateTextAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md deleted file mode 100644 index a83cb03b..00000000 --- a/docs/examples/databases/update-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateTransaction({ - transactionId: '', - commit: false, // optional - rollback: false // optional -}); -``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md deleted file mode 100644 index 1cebc2f4..00000000 --- a/docs/examples/databases/update-url-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateUrlAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: 'https://example.com', - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md deleted file mode 100644 index 43a1cf03..00000000 --- a/docs/examples/databases/update-varchar-attribute.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.updateVarcharAttribute({ - databaseId: '', - collectionId: '', - key: '', - required: false, - xdefault: '', - size: 1, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md deleted file mode 100644 index 36ff3bd1..00000000 --- a/docs/examples/databases/update.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.update({ - databaseId: '', - name: '', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md deleted file mode 100644 index 13e882ad..00000000 --- a/docs/examples/databases/upsert-document.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const databases = new sdk.Databases(client); - -const result = await databases.upsertDocument({ - databaseId: '', - collectionId: '', - documentId: '', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 30, - "isAdmin": false - }, // optional - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '' // optional -}); -``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md deleted file mode 100644 index 2a304924..00000000 --- a/docs/examples/databases/upsert-documents.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const databases = new sdk.Databases(client); - -const result = await databases.upsertDocuments({ - databaseId: '', - collectionId: '', - documents: [], - transactionId: '' // optional -}); -``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md deleted file mode 100644 index 0cd67cbf..00000000 --- a/docs/examples/functions/create-deployment.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); -const fs = require('fs'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.createDeployment({ - functionId: '', - code: InputFile.fromPath('/path/to/file', 'filename'), - activate: false, - entrypoint: '', // optional - commands: '' // optional -}); -``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md deleted file mode 100644 index f5abb222..00000000 --- a/docs/examples/functions/create-duplicate-deployment.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.createDuplicateDeployment({ - functionId: '', - deploymentId: '', - buildId: '' // optional -}); -``` diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md deleted file mode 100644 index f93d87e4..00000000 --- a/docs/examples/functions/create-execution.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const functions = new sdk.Functions(client); - -const result = await functions.createExecution({ - functionId: '', - body: '', // optional - async: false, // optional - xpath: '', // optional - method: sdk.ExecutionMethod.GET, // optional - headers: {}, // optional - scheduledAt: '' // optional -}); -``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md deleted file mode 100644 index 20977559..00000000 --- a/docs/examples/functions/create-template-deployment.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.createTemplateDeployment({ - functionId: '', - repository: '', - owner: '', - rootDirectory: '', - type: sdk.TemplateReferenceType.Commit, - reference: '', - activate: false // optional -}); -``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md deleted file mode 100644 index 21246bbe..00000000 --- a/docs/examples/functions/create-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.createVariable({ - functionId: '', - variableId: '', - key: '', - value: '', - secret: false // optional -}); -``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md deleted file mode 100644 index 4bf9d23b..00000000 --- a/docs/examples/functions/create-vcs-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.createVcsDeployment({ - functionId: '', - type: sdk.VCSReferenceType.Branch, - reference: '', - activate: false // optional -}); -``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md deleted file mode 100644 index 4e3d5e95..00000000 --- a/docs/examples/functions/create.md +++ /dev/null @@ -1,33 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.create({ - functionId: '', - name: '', - runtime: sdk.Runtime.Node145, - execute: ["any"], // optional - events: [], // optional - schedule: '', // optional - timeout: 1, // optional - enabled: false, // optional - logging: false, // optional - entrypoint: '', // optional - commands: '', // optional - scopes: [sdk.Scopes.ProjectRead], // optional - installationId: '', // optional - providerRepositoryId: '', // optional - providerBranch: '', // optional - providerSilentMode: false, // optional - providerRootDirectory: '', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); -``` diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md deleted file mode 100644 index 20120ebd..00000000 --- a/docs/examples/functions/delete-deployment.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.deleteDeployment({ - functionId: '', - deploymentId: '' -}); -``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md deleted file mode 100644 index 4d78ad9c..00000000 --- a/docs/examples/functions/delete-execution.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.deleteExecution({ - functionId: '', - executionId: '' -}); -``` diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md deleted file mode 100644 index b8ed9d54..00000000 --- a/docs/examples/functions/delete-variable.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.deleteVariable({ - functionId: '', - variableId: '' -}); -``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md deleted file mode 100644 index 446ca2a5..00000000 --- a/docs/examples/functions/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.delete({ - functionId: '' -}); -``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md deleted file mode 100644 index 5e9a956d..00000000 --- a/docs/examples/functions/get-deployment-download.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.getDeploymentDownload({ - functionId: '', - deploymentId: '', - type: sdk.DeploymentDownloadType.Source // optional -}); -``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md deleted file mode 100644 index 29d9b2e6..00000000 --- a/docs/examples/functions/get-deployment.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.getDeployment({ - functionId: '', - deploymentId: '' -}); -``` diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md deleted file mode 100644 index c987772d..00000000 --- a/docs/examples/functions/get-execution.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const functions = new sdk.Functions(client); - -const result = await functions.getExecution({ - functionId: '', - executionId: '' -}); -``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md deleted file mode 100644 index abc2e91d..00000000 --- a/docs/examples/functions/get-variable.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.getVariable({ - functionId: '', - variableId: '' -}); -``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md deleted file mode 100644 index 97050f04..00000000 --- a/docs/examples/functions/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.get({ - functionId: '' -}); -``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md deleted file mode 100644 index c53aaa45..00000000 --- a/docs/examples/functions/list-deployments.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.listDeployments({ - functionId: '', - queries: [], // optional - search: '', // optional - total: false // optional -}); -``` diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md deleted file mode 100644 index b549100f..00000000 --- a/docs/examples/functions/list-executions.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const functions = new sdk.Functions(client); - -const result = await functions.listExecutions({ - functionId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md deleted file mode 100644 index fdaefd3a..00000000 --- a/docs/examples/functions/list-runtimes.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.listRuntimes(); -``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md deleted file mode 100644 index 0fc8b8d7..00000000 --- a/docs/examples/functions/list-specifications.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.listSpecifications(); -``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md deleted file mode 100644 index d09e5d05..00000000 --- a/docs/examples/functions/list-variables.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.listVariables({ - functionId: '', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md deleted file mode 100644 index faeeaae7..00000000 --- a/docs/examples/functions/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.list({ - queries: [], // optional - search: '', // optional - total: false // optional -}); -``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md deleted file mode 100644 index 5d45a02a..00000000 --- a/docs/examples/functions/update-deployment-status.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.updateDeploymentStatus({ - functionId: '', - deploymentId: '' -}); -``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md deleted file mode 100644 index 0dfd06f5..00000000 --- a/docs/examples/functions/update-function-deployment.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.updateFunctionDeployment({ - functionId: '', - deploymentId: '' -}); -``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md deleted file mode 100644 index e0bdec98..00000000 --- a/docs/examples/functions/update-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.updateVariable({ - functionId: '', - variableId: '', - key: '', // optional - value: '', // optional - secret: false // optional -}); -``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md deleted file mode 100644 index fe60cad3..00000000 --- a/docs/examples/functions/update.md +++ /dev/null @@ -1,33 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const functions = new sdk.Functions(client); - -const result = await functions.update({ - functionId: '', - name: '', - runtime: sdk.Runtime.Node145, // optional - execute: ["any"], // optional - events: [], // optional - schedule: '', // optional - timeout: 1, // optional - enabled: false, // optional - logging: false, // optional - entrypoint: '', // optional - commands: '', // optional - scopes: [sdk.Scopes.ProjectRead], // optional - installationId: '', // optional - providerRepositoryId: '', // optional - providerBranch: '', // optional - providerSilentMode: false, // optional - providerRootDirectory: '', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); -``` diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md deleted file mode 100644 index 31aa4bf3..00000000 --- a/docs/examples/graphql/mutation.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const graphql = new sdk.Graphql(client); - -const result = await graphql.mutation({ - query: {} -}); -``` diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md deleted file mode 100644 index 3bd436e0..00000000 --- a/docs/examples/graphql/query.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const graphql = new sdk.Graphql(client); - -const result = await graphql.query({ - query: {} -}); -``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md deleted file mode 100644 index 3f0c8345..00000000 --- a/docs/examples/health/get-antivirus.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getAntivirus(); -``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md deleted file mode 100644 index a9525064..00000000 --- a/docs/examples/health/get-cache.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getCache(); -``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md deleted file mode 100644 index 571b3cdc..00000000 --- a/docs/examples/health/get-certificate.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getCertificate({ - domain: '' // optional -}); -``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md deleted file mode 100644 index a3dfca6f..00000000 --- a/docs/examples/health/get-console-pausing.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getConsolePausing({ - threshold: null, // optional - inactivityDays: null // optional -}); -``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md deleted file mode 100644 index 45a840c9..00000000 --- a/docs/examples/health/get-db.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getDB(); -``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md deleted file mode 100644 index e495453c..00000000 --- a/docs/examples/health/get-failed-jobs.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getFailedJobs({ - name: sdk.Name.V1Database, - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md deleted file mode 100644 index c03bb59e..00000000 --- a/docs/examples/health/get-pub-sub.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getPubSub(); -``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md deleted file mode 100644 index dcc7c6ce..00000000 --- a/docs/examples/health/get-queue-audits.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueAudits({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md deleted file mode 100644 index da49e020..00000000 --- a/docs/examples/health/get-queue-builds.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueBuilds({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md deleted file mode 100644 index ef065d59..00000000 --- a/docs/examples/health/get-queue-certificates.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueCertificates({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md deleted file mode 100644 index 181621ec..00000000 --- a/docs/examples/health/get-queue-databases.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueDatabases({ - name: '', // optional - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md deleted file mode 100644 index e1b5bc00..00000000 --- a/docs/examples/health/get-queue-deletes.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueDeletes({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md deleted file mode 100644 index f40904a2..00000000 --- a/docs/examples/health/get-queue-functions.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueFunctions({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md deleted file mode 100644 index 437a86b0..00000000 --- a/docs/examples/health/get-queue-logs.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueLogs({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md deleted file mode 100644 index 3da627b8..00000000 --- a/docs/examples/health/get-queue-mails.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueMails({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md deleted file mode 100644 index 504ad1de..00000000 --- a/docs/examples/health/get-queue-messaging.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueMessaging({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md deleted file mode 100644 index 59e45509..00000000 --- a/docs/examples/health/get-queue-migrations.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueMigrations({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md deleted file mode 100644 index 542d11e0..00000000 --- a/docs/examples/health/get-queue-stats-resources.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueStatsResources({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md deleted file mode 100644 index 86dbfb83..00000000 --- a/docs/examples/health/get-queue-usage.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueUsage({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md deleted file mode 100644 index 36c3037a..00000000 --- a/docs/examples/health/get-queue-webhooks.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getQueueWebhooks({ - threshold: null // optional -}); -``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md deleted file mode 100644 index 15933394..00000000 --- a/docs/examples/health/get-storage-local.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getStorageLocal(); -``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md deleted file mode 100644 index 75ec5cb8..00000000 --- a/docs/examples/health/get-storage.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getStorage(); -``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md deleted file mode 100644 index 86d86174..00000000 --- a/docs/examples/health/get-time.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.getTime(); -``` diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md deleted file mode 100644 index bfb883b6..00000000 --- a/docs/examples/health/get.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const health = new sdk.Health(client); - -const result = await health.get(); -``` diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md deleted file mode 100644 index 004a9325..00000000 --- a/docs/examples/locale/get.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.get(); -``` diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md deleted file mode 100644 index 136992f4..00000000 --- a/docs/examples/locale/list-codes.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.listCodes(); -``` diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md deleted file mode 100644 index aa58ec57..00000000 --- a/docs/examples/locale/list-continents.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.listContinents(); -``` diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md deleted file mode 100644 index 538b4927..00000000 --- a/docs/examples/locale/list-countries-eu.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.listCountriesEU(); -``` diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md deleted file mode 100644 index c2701418..00000000 --- a/docs/examples/locale/list-countries-phones.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.listCountriesPhones(); -``` diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md deleted file mode 100644 index 99ee2d35..00000000 --- a/docs/examples/locale/list-countries.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.listCountries(); -``` diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md deleted file mode 100644 index c381774d..00000000 --- a/docs/examples/locale/list-currencies.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.listCurrencies(); -``` diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md deleted file mode 100644 index cfd522c6..00000000 --- a/docs/examples/locale/list-languages.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setSession(''); // The user session to authenticate with - -const locale = new sdk.Locale(client); - -const result = await locale.listLanguages(); -``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md deleted file mode 100644 index dc203a39..00000000 --- a/docs/examples/messaging/create-apns-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createAPNSProvider({ - providerId: '', - name: '', - authKey: '', // optional - authKeyId: '', // optional - teamId: '', // optional - bundleId: '', // optional - sandbox: false, // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md deleted file mode 100644 index 1662aae1..00000000 --- a/docs/examples/messaging/create-email.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createEmail({ - messageId: '', - subject: '', - content: '', - topics: [], // optional - users: [], // optional - targets: [], // optional - cc: [], // optional - bcc: [], // optional - attachments: [], // optional - draft: false, // optional - html: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional -}); -``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md deleted file mode 100644 index 78b6d06c..00000000 --- a/docs/examples/messaging/create-fcm-provider.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createFCMProvider({ - providerId: '', - name: '', - serviceAccountJSON: {}, // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md deleted file mode 100644 index f2961b6d..00000000 --- a/docs/examples/messaging/create-mailgun-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createMailgunProvider({ - providerId: '', - name: '', - apiKey: '', // optional - domain: '', // optional - isEuRegion: false, // optional - fromName: '', // optional - fromEmail: 'email@example.com', // optional - replyToName: '', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md deleted file mode 100644 index ba6829a6..00000000 --- a/docs/examples/messaging/create-msg-91-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createMsg91Provider({ - providerId: '', - name: '', - templateId: '', // optional - senderId: '', // optional - authKey: '', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md deleted file mode 100644 index 467cde4a..00000000 --- a/docs/examples/messaging/create-push.md +++ /dev/null @@ -1,32 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('') // Your project ID - .setKey(''); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createPush({ - messageId: '', - title: '', // optional - body: '<BODY>', // optional - topics: [], // optional - users: [], // optional - targets: [], // optional - data: {}, // optional - action: '<ACTION>', // optional - image: '<ID1:ID2>', // optional - icon: '<ICON>', // optional - sound: '<SOUND>', // optional - color: '<COLOR>', // optional - tag: '<TAG>', // optional - badge: null, // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - contentAvailable: false, // optional - critical: false, // optional - priority: sdk.MessagePriority.Normal // optional -}); -``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md deleted file mode 100644 index d1c391d0..00000000 --- a/docs/examples/messaging/create-resend-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createResendProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md deleted file mode 100644 index 9c3be00c..00000000 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createSendgridProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md deleted file mode 100644 index 31d75c00..00000000 --- a/docs/examples/messaging/create-sms.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createSMS({ - messageId: '<MESSAGE_ID>', - content: '<CONTENT>', - topics: [], // optional - users: [], // optional - targets: [], // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional -}); -``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md deleted file mode 100644 index e17fdc19..00000000 --- a/docs/examples/messaging/create-smtp-provider.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createSMTPProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - host: '<HOST>', - port: 1, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - encryption: sdk.SmtpEncryption.None, // optional - autoTLS: false, // optional - mailer: '<MAILER>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: 'email@example.com', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md deleted file mode 100644 index 51410af7..00000000 --- a/docs/examples/messaging/create-subscriber.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createSubscriber({ - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>', - targetId: '<TARGET_ID>' -}); -``` diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md deleted file mode 100644 index baf83a6c..00000000 --- a/docs/examples/messaging/create-telesign-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createTelesignProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - customerId: '<CUSTOMER_ID>', // optional - apiKey: '<API_KEY>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md deleted file mode 100644 index 655a2248..00000000 --- a/docs/examples/messaging/create-textmagic-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createTextmagicProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - username: '<USERNAME>', // optional - apiKey: '<API_KEY>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md deleted file mode 100644 index 4625517a..00000000 --- a/docs/examples/messaging/create-topic.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createTopic({ - topicId: '<TOPIC_ID>', - name: '<NAME>', - subscribe: ["any"] // optional -}); -``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md deleted file mode 100644 index 0db55435..00000000 --- a/docs/examples/messaging/create-twilio-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createTwilioProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - accountSid: '<ACCOUNT_SID>', // optional - authToken: '<AUTH_TOKEN>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md deleted file mode 100644 index cf8cd38a..00000000 --- a/docs/examples/messaging/create-vonage-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.createVonageProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - from: '+12065550100', // optional - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md deleted file mode 100644 index 53fc2aea..00000000 --- a/docs/examples/messaging/delete-provider.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.deleteProvider({ - providerId: '<PROVIDER_ID>' -}); -``` diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md deleted file mode 100644 index 99c61d7a..00000000 --- a/docs/examples/messaging/delete-subscriber.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token - -const messaging = new sdk.Messaging(client); - -const result = await messaging.deleteSubscriber({ - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>' -}); -``` diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md deleted file mode 100644 index 3ffa99f9..00000000 --- a/docs/examples/messaging/delete-topic.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.deleteTopic({ - topicId: '<TOPIC_ID>' -}); -``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md deleted file mode 100644 index 62e7d61a..00000000 --- a/docs/examples/messaging/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.delete({ - messageId: '<MESSAGE_ID>' -}); -``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md deleted file mode 100644 index 894a74ac..00000000 --- a/docs/examples/messaging/get-message.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.getMessage({ - messageId: '<MESSAGE_ID>' -}); -``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md deleted file mode 100644 index c7e91ff0..00000000 --- a/docs/examples/messaging/get-provider.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.getProvider({ - providerId: '<PROVIDER_ID>' -}); -``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md deleted file mode 100644 index 8a915341..00000000 --- a/docs/examples/messaging/get-subscriber.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.getSubscriber({ - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>' -}); -``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md deleted file mode 100644 index f352c9d7..00000000 --- a/docs/examples/messaging/get-topic.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.getTopic({ - topicId: '<TOPIC_ID>' -}); -``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md deleted file mode 100644 index c9c8a471..00000000 --- a/docs/examples/messaging/list-message-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listMessageLogs({ - messageId: '<MESSAGE_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md deleted file mode 100644 index 053adc9f..00000000 --- a/docs/examples/messaging/list-messages.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listMessages({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md deleted file mode 100644 index 92b4c2f4..00000000 --- a/docs/examples/messaging/list-provider-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listProviderLogs({ - providerId: '<PROVIDER_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md deleted file mode 100644 index 603ff0bd..00000000 --- a/docs/examples/messaging/list-providers.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listProviders({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md deleted file mode 100644 index 2f892254..00000000 --- a/docs/examples/messaging/list-subscriber-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listSubscriberLogs({ - subscriberId: '<SUBSCRIBER_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md deleted file mode 100644 index bba6aae4..00000000 --- a/docs/examples/messaging/list-subscribers.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listSubscribers({ - topicId: '<TOPIC_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md deleted file mode 100644 index dc053961..00000000 --- a/docs/examples/messaging/list-targets.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listTargets({ - messageId: '<MESSAGE_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md deleted file mode 100644 index ee76366c..00000000 --- a/docs/examples/messaging/list-topic-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listTopicLogs({ - topicId: '<TOPIC_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md deleted file mode 100644 index 62fecb61..00000000 --- a/docs/examples/messaging/list-topics.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.listTopics({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md deleted file mode 100644 index 6cd012d9..00000000 --- a/docs/examples/messaging/update-apns-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateAPNSProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - authKey: '<AUTH_KEY>', // optional - authKeyId: '<AUTH_KEY_ID>', // optional - teamId: '<TEAM_ID>', // optional - bundleId: '<BUNDLE_ID>', // optional - sandbox: false // optional -}); -``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md deleted file mode 100644 index f4e27865..00000000 --- a/docs/examples/messaging/update-email.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateEmail({ - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - subject: '<SUBJECT>', // optional - content: '<CONTENT>', // optional - draft: false, // optional - html: false, // optional - cc: [], // optional - bcc: [], // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - attachments: [] // optional -}); -``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md deleted file mode 100644 index 4d76843e..00000000 --- a/docs/examples/messaging/update-fcm-provider.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateFCMProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - serviceAccountJSON: {} // optional -}); -``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md deleted file mode 100644 index 5725f1eb..00000000 --- a/docs/examples/messaging/update-mailgun-provider.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateMailgunProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - apiKey: '<API_KEY>', // optional - domain: '<DOMAIN>', // optional - isEuRegion: false, // optional - enabled: false, // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -}); -``` diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md deleted file mode 100644 index d66ba73f..00000000 --- a/docs/examples/messaging/update-msg-91-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateMsg91Provider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - templateId: '<TEMPLATE_ID>', // optional - senderId: '<SENDER_ID>', // optional - authKey: '<AUTH_KEY>' // optional -}); -``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md deleted file mode 100644 index f0e5e324..00000000 --- a/docs/examples/messaging/update-push.md +++ /dev/null @@ -1,32 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updatePush({ - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - title: '<TITLE>', // optional - body: '<BODY>', // optional - data: {}, // optional - action: '<ACTION>', // optional - image: '<ID1:ID2>', // optional - icon: '<ICON>', // optional - sound: '<SOUND>', // optional - color: '<COLOR>', // optional - tag: '<TAG>', // optional - badge: null, // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional - contentAvailable: false, // optional - critical: false, // optional - priority: sdk.MessagePriority.Normal // optional -}); -``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md deleted file mode 100644 index 563c907f..00000000 --- a/docs/examples/messaging/update-resend-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateResendProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -}); -``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md deleted file mode 100644 index ece8ae7c..00000000 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateSendgridProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>' // optional -}); -``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md deleted file mode 100644 index 074cab2e..00000000 --- a/docs/examples/messaging/update-sms.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateSMS({ - messageId: '<MESSAGE_ID>', - topics: [], // optional - users: [], // optional - targets: [], // optional - content: '<CONTENT>', // optional - draft: false, // optional - scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional -}); -``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md deleted file mode 100644 index d860736f..00000000 --- a/docs/examples/messaging/update-smtp-provider.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateSMTPProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - host: '<HOST>', // optional - port: 1, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - encryption: sdk.SmtpEncryption.None, // optional - autoTLS: false, // optional - mailer: '<MAILER>', // optional - fromName: '<FROM_NAME>', // optional - fromEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - replyToEmail: '<REPLY_TO_EMAIL>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md deleted file mode 100644 index b8b7ea08..00000000 --- a/docs/examples/messaging/update-telesign-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateTelesignProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - customerId: '<CUSTOMER_ID>', // optional - apiKey: '<API_KEY>', // optional - from: '<FROM>' // optional -}); -``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md deleted file mode 100644 index bf35cef8..00000000 --- a/docs/examples/messaging/update-textmagic-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateTextmagicProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - username: '<USERNAME>', // optional - apiKey: '<API_KEY>', // optional - from: '<FROM>' // optional -}); -``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md deleted file mode 100644 index 8ec30739..00000000 --- a/docs/examples/messaging/update-topic.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateTopic({ - topicId: '<TOPIC_ID>', - name: '<NAME>', // optional - subscribe: ["any"] // optional -}); -``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md deleted file mode 100644 index da83c43c..00000000 --- a/docs/examples/messaging/update-twilio-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateTwilioProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - accountSid: '<ACCOUNT_SID>', // optional - authToken: '<AUTH_TOKEN>', // optional - from: '<FROM>' // optional -}); -``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md deleted file mode 100644 index caefea0d..00000000 --- a/docs/examples/messaging/update-vonage-provider.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const messaging = new sdk.Messaging(client); - -const result = await messaging.updateVonageProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - from: '<FROM>' // optional -}); -``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md deleted file mode 100644 index 4c1cfc24..00000000 --- a/docs/examples/presences/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const presences = new sdk.Presences(client); - -const result = await presences.delete({ - presenceId: '<PRESENCE_ID>' -}); -``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md deleted file mode 100644 index 1e8a332d..00000000 --- a/docs/examples/presences/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const presences = new sdk.Presences(client); - -const result = await presences.get({ - presenceId: '<PRESENCE_ID>' -}); -``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md deleted file mode 100644 index fbb18d4d..00000000 --- a/docs/examples/presences/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const presences = new sdk.Presences(client); - -const result = await presences.list({ - queries: [], // optional - total: false, // optional - ttl: 0 // optional -}); -``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md deleted file mode 100644 index ffb1272f..00000000 --- a/docs/examples/presences/update-presence.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const presences = new sdk.Presences(client); - -const result = await presences.updatePresence({ - presenceId: '<PRESENCE_ID>', - userId: '<USER_ID>', - status: '<STATUS>', // optional - expiresAt: '2020-10-15T06:38:00.000+00:00', // optional - metadata: {}, // optional - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - purge: false // optional -}); -``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md deleted file mode 100644 index 63b9267f..00000000 --- a/docs/examples/presences/upsert.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const presences = new sdk.Presences(client); - -const result = await presences.upsert({ - presenceId: '<PRESENCE_ID>', - userId: '<USER_ID>', - status: '<STATUS>', - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - expiresAt: '2020-10-15T06:38:00.000+00:00', // optional - metadata: {} // optional -}); -``` diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md deleted file mode 100644 index 09a9f337..00000000 --- a/docs/examples/project/create-android-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createAndroidPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - applicationId: '<APPLICATION_ID>' -}); -``` diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md deleted file mode 100644 index 6ffe87b7..00000000 --- a/docs/examples/project/create-apple-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createApplePlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - bundleIdentifier: '<BUNDLE_IDENTIFIER>' -}); -``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md deleted file mode 100644 index e368a605..00000000 --- a/docs/examples/project/create-ephemeral-key.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createEphemeralKey({ - scopes: [sdk.ProjectKeyScopes.ProjectRead], - duration: 600 -}); -``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md deleted file mode 100644 index 362821b3..00000000 --- a/docs/examples/project/create-key.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createKey({ - keyId: '<KEY_ID>', - name: '<NAME>', - scopes: [sdk.ProjectKeyScopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); -``` diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md deleted file mode 100644 index aa51173c..00000000 --- a/docs/examples/project/create-linux-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createLinuxPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageName: '<PACKAGE_NAME>' -}); -``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md deleted file mode 100644 index 6bb2962c..00000000 --- a/docs/examples/project/create-mock-phone.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createMockPhone({ - number: '+12065550100', - otp: '<OTP>' -}); -``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md deleted file mode 100644 index 708daf85..00000000 --- a/docs/examples/project/create-smtp-test.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createSMTPTest({ - emails: [] -}); -``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md deleted file mode 100644 index 6333b935..00000000 --- a/docs/examples/project/create-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createVariable({ - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); -``` diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md deleted file mode 100644 index 84e36ce1..00000000 --- a/docs/examples/project/create-web-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createWebPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - hostname: 'app.example.com' -}); -``` diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md deleted file mode 100644 index 369f0349..00000000 --- a/docs/examples/project/create-windows-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.createWindowsPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' -}); -``` diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md deleted file mode 100644 index bbe19c2a..00000000 --- a/docs/examples/project/delete-key.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.deleteKey({ - keyId: '<KEY_ID>' -}); -``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md deleted file mode 100644 index 94d341a7..00000000 --- a/docs/examples/project/delete-mock-phone.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.deleteMockPhone({ - number: '+12065550100' -}); -``` diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md deleted file mode 100644 index cb734805..00000000 --- a/docs/examples/project/delete-platform.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.deletePlatform({ - platformId: '<PLATFORM_ID>' -}); -``` diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md deleted file mode 100644 index c930811b..00000000 --- a/docs/examples/project/delete-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.deleteVariable({ - variableId: '<VARIABLE_ID>' -}); -``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md deleted file mode 100644 index 150939ed..00000000 --- a/docs/examples/project/delete.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.delete(); -``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md deleted file mode 100644 index d4683e56..00000000 --- a/docs/examples/project/get-email-template.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.getEmailTemplate({ - templateId: sdk.ProjectEmailTemplateId.Verification, - locale: sdk.ProjectEmailTemplateLocale.Af // optional -}); -``` diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md deleted file mode 100644 index 81b7e2f1..00000000 --- a/docs/examples/project/get-key.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.getKey({ - keyId: '<KEY_ID>' -}); -``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md deleted file mode 100644 index 73082c43..00000000 --- a/docs/examples/project/get-mock-phone.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.getMockPhone({ - number: '+12065550100' -}); -``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md deleted file mode 100644 index 7c1d85c5..00000000 --- a/docs/examples/project/get-o-auth-2-provider.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.getOAuth2Provider({ - providerId: sdk.ProjectOAuthProviderId.Amazon -}); -``` diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md deleted file mode 100644 index 4f450e4b..00000000 --- a/docs/examples/project/get-platform.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.getPlatform({ - platformId: '<PLATFORM_ID>' -}); -``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md deleted file mode 100644 index e55cb859..00000000 --- a/docs/examples/project/get-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.getPolicy({ - policyId: sdk.ProjectPolicyId.PasswordDictionary -}); -``` diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md deleted file mode 100644 index 5232de86..00000000 --- a/docs/examples/project/get-variable.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.getVariable({ - variableId: '<VARIABLE_ID>' -}); -``` diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md deleted file mode 100644 index 5ee86b8a..00000000 --- a/docs/examples/project/get.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.get(); -``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md deleted file mode 100644 index 34bc7778..00000000 --- a/docs/examples/project/list-email-templates.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.listEmailTemplates({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md deleted file mode 100644 index e9266822..00000000 --- a/docs/examples/project/list-keys.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.listKeys({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md deleted file mode 100644 index 0816b18a..00000000 --- a/docs/examples/project/list-mock-phones.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.listMockPhones({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md deleted file mode 100644 index 244767d3..00000000 --- a/docs/examples/project/list-o-auth-2-providers.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.listOAuth2Providers({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md deleted file mode 100644 index c180b9d7..00000000 --- a/docs/examples/project/list-platforms.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.listPlatforms({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md deleted file mode 100644 index f7b6260f..00000000 --- a/docs/examples/project/list-policies.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.listPolicies({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md deleted file mode 100644 index 3ffd1b95..00000000 --- a/docs/examples/project/list-variables.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.listVariables({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md deleted file mode 100644 index 8164b0d0..00000000 --- a/docs/examples/project/update-android-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateAndroidPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - applicationId: '<APPLICATION_ID>' -}); -``` diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md deleted file mode 100644 index 93abb676..00000000 --- a/docs/examples/project/update-apple-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateApplePlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - bundleIdentifier: '<BUNDLE_IDENTIFIER>' -}); -``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md deleted file mode 100644 index 8e2e4bbb..00000000 --- a/docs/examples/project/update-auth-method.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateAuthMethod({ - methodId: sdk.ProjectAuthMethodId.EmailPassword, - enabled: false -}); -``` diff --git a/docs/examples/project/update-deny-aliased-email-policy.md b/docs/examples/project/update-deny-aliased-email-policy.md deleted file mode 100644 index 92b7e648..00000000 --- a/docs/examples/project/update-deny-aliased-email-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateDenyAliasedEmailPolicy({ - enabled: false -}); -``` diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md deleted file mode 100644 index e2b25316..00000000 --- a/docs/examples/project/update-deny-disposable-email-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateDenyDisposableEmailPolicy({ - enabled: false -}); -``` diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md deleted file mode 100644 index 85799e8e..00000000 --- a/docs/examples/project/update-deny-free-email-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateDenyFreeEmailPolicy({ - enabled: false -}); -``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md deleted file mode 100644 index ddf6ca67..00000000 --- a/docs/examples/project/update-email-template.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateEmailTemplate({ - templateId: sdk.ProjectEmailTemplateId.Verification, - locale: sdk.ProjectEmailTemplateLocale.Af, // optional - subject: '<SUBJECT>', // optional - message: '<MESSAGE>', // optional - senderName: '<SENDER_NAME>', // optional - senderEmail: 'email@example.com', // optional - replyToEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>' // optional -}); -``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md deleted file mode 100644 index 39be329e..00000000 --- a/docs/examples/project/update-key.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateKey({ - keyId: '<KEY_ID>', - name: '<NAME>', - scopes: [sdk.ProjectKeyScopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); -``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md deleted file mode 100644 index f924ec09..00000000 --- a/docs/examples/project/update-labels.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateLabels({ - labels: [] -}); -``` diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md deleted file mode 100644 index cb483d60..00000000 --- a/docs/examples/project/update-linux-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateLinuxPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageName: '<PACKAGE_NAME>' -}); -``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md deleted file mode 100644 index 66eff9f3..00000000 --- a/docs/examples/project/update-membership-privacy-policy.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateMembershipPrivacyPolicy({ - userId: false, // optional - userEmail: false, // optional - userPhone: false, // optional - userName: false, // optional - userMFA: false // optional -}); -``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md deleted file mode 100644 index a0c70abc..00000000 --- a/docs/examples/project/update-mock-phone.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateMockPhone({ - number: '+12065550100', - otp: '<OTP>' -}); -``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md deleted file mode 100644 index 12a535ff..00000000 --- a/docs/examples/project/update-o-auth-2-amazon.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Amazon({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md deleted file mode 100644 index ae985a4a..00000000 --- a/docs/examples/project/update-o-auth-2-apple.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Apple({ - serviceId: '<SERVICE_ID>', // optional - keyId: '<KEY_ID>', // optional - teamId: '<TEAM_ID>', // optional - p8File: '<P8_FILE>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md deleted file mode 100644 index 37bf4a56..00000000 --- a/docs/examples/project/update-o-auth-2-auth-0.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Auth0({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md deleted file mode 100644 index e500466b..00000000 --- a/docs/examples/project/update-o-auth-2-authentik.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Authentik({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md deleted file mode 100644 index 0b8aabce..00000000 --- a/docs/examples/project/update-o-auth-2-autodesk.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Autodesk({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md deleted file mode 100644 index d3b5dc7b..00000000 --- a/docs/examples/project/update-o-auth-2-bitbucket.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Bitbucket({ - key: '<KEY>', // optional - secret: '<SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md deleted file mode 100644 index feecad27..00000000 --- a/docs/examples/project/update-o-auth-2-bitly.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Bitly({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md deleted file mode 100644 index c9724638..00000000 --- a/docs/examples/project/update-o-auth-2-box.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Box({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md deleted file mode 100644 index 8d176339..00000000 --- a/docs/examples/project/update-o-auth-2-dailymotion.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Dailymotion({ - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md deleted file mode 100644 index 5469509f..00000000 --- a/docs/examples/project/update-o-auth-2-discord.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Discord({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md deleted file mode 100644 index c71bebfe..00000000 --- a/docs/examples/project/update-o-auth-2-disqus.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Disqus({ - publicKey: '<PUBLIC_KEY>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md deleted file mode 100644 index 9f2654dc..00000000 --- a/docs/examples/project/update-o-auth-2-dropbox.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Dropbox({ - appKey: '<APP_KEY>', // optional - appSecret: '<APP_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md deleted file mode 100644 index 684c4243..00000000 --- a/docs/examples/project/update-o-auth-2-etsy.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Etsy({ - keyString: '<KEY_STRING>', // optional - sharedSecret: '<SHARED_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md deleted file mode 100644 index 7fca48a6..00000000 --- a/docs/examples/project/update-o-auth-2-facebook.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Facebook({ - appId: '<APP_ID>', // optional - appSecret: '<APP_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md deleted file mode 100644 index 3b805738..00000000 --- a/docs/examples/project/update-o-auth-2-figma.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Figma({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md deleted file mode 100644 index 654991c9..00000000 --- a/docs/examples/project/update-o-auth-2-fusion-auth.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2FusionAuth({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md deleted file mode 100644 index cc2be084..00000000 --- a/docs/examples/project/update-o-auth-2-git-hub.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2GitHub({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md deleted file mode 100644 index 40e1943e..00000000 --- a/docs/examples/project/update-o-auth-2-gitlab.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Gitlab({ - applicationId: '<APPLICATION_ID>', // optional - secret: '<SECRET>', // optional - endpoint: 'https://example.com', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md deleted file mode 100644 index 726d6059..00000000 --- a/docs/examples/project/update-o-auth-2-google.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Google({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - prompt: [sdk.ProjectOAuth2GooglePrompt.None], // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md deleted file mode 100644 index bce76ee5..00000000 --- a/docs/examples/project/update-o-auth-2-keycloak.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Keycloak({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - realmName: '<REALM_NAME>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md deleted file mode 100644 index 1d581052..00000000 --- a/docs/examples/project/update-o-auth-2-kick.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Kick({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md deleted file mode 100644 index 02c68d99..00000000 --- a/docs/examples/project/update-o-auth-2-linkedin.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Linkedin({ - clientId: '<CLIENT_ID>', // optional - primaryClientSecret: '<PRIMARY_CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md deleted file mode 100644 index cc5a8c27..00000000 --- a/docs/examples/project/update-o-auth-2-microsoft.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Microsoft({ - applicationId: '<APPLICATION_ID>', // optional - applicationSecret: '<APPLICATION_SECRET>', // optional - tenant: '<TENANT>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md deleted file mode 100644 index c3297799..00000000 --- a/docs/examples/project/update-o-auth-2-notion.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Notion({ - oauthClientId: '<OAUTH_CLIENT_ID>', // optional - oauthClientSecret: '<OAUTH_CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md deleted file mode 100644 index 7f1f6eb7..00000000 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Oidc({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - wellKnownURL: 'https://example.com', // optional - authorizationURL: 'https://example.com', // optional - tokenURL: 'https://example.com', // optional - userInfoURL: 'https://example.com', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md deleted file mode 100644 index a85c9809..00000000 --- a/docs/examples/project/update-o-auth-2-okta.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Okta({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - domain: '', // optional - authorizationServerId: '<AUTHORIZATION_SERVER_ID>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md deleted file mode 100644 index e6b8de7f..00000000 --- a/docs/examples/project/update-o-auth-2-paypal-sandbox.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2PaypalSandbox({ - clientId: '<CLIENT_ID>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md deleted file mode 100644 index 8f7162c7..00000000 --- a/docs/examples/project/update-o-auth-2-paypal.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Paypal({ - clientId: '<CLIENT_ID>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md deleted file mode 100644 index 3d6c2c44..00000000 --- a/docs/examples/project/update-o-auth-2-podio.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Podio({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md deleted file mode 100644 index a1937639..00000000 --- a/docs/examples/project/update-o-auth-2-salesforce.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Salesforce({ - customerKey: '<CUSTOMER_KEY>', // optional - customerSecret: '<CUSTOMER_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md deleted file mode 100644 index 6dab9092..00000000 --- a/docs/examples/project/update-o-auth-2-slack.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Slack({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md deleted file mode 100644 index 72ffa64d..00000000 --- a/docs/examples/project/update-o-auth-2-spotify.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Spotify({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md deleted file mode 100644 index 1df015f1..00000000 --- a/docs/examples/project/update-o-auth-2-stripe.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Stripe({ - clientId: '<CLIENT_ID>', // optional - apiSecretKey: '<API_SECRET_KEY>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md deleted file mode 100644 index df090e92..00000000 --- a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2TradeshiftSandbox({ - oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional - oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md deleted file mode 100644 index afddd8c0..00000000 --- a/docs/examples/project/update-o-auth-2-tradeshift.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Tradeshift({ - oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional - oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md deleted file mode 100644 index ad096ea9..00000000 --- a/docs/examples/project/update-o-auth-2-twitch.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Twitch({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md deleted file mode 100644 index 597ccd5b..00000000 --- a/docs/examples/project/update-o-auth-2-word-press.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2WordPress({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md deleted file mode 100644 index 79b3b021..00000000 --- a/docs/examples/project/update-o-auth-2-yahoo.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Yahoo({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md deleted file mode 100644 index 2f79c448..00000000 --- a/docs/examples/project/update-o-auth-2-yandex.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Yandex({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md deleted file mode 100644 index 031a2816..00000000 --- a/docs/examples/project/update-o-auth-2-zoho.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Zoho({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md deleted file mode 100644 index 985400b1..00000000 --- a/docs/examples/project/update-o-auth-2-zoom.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2Zoom({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md deleted file mode 100644 index 183e2257..00000000 --- a/docs/examples/project/update-o-auth-2x.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateOAuth2X({ - customerKey: '<CUSTOMER_KEY>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md deleted file mode 100644 index 8b8bdd02..00000000 --- a/docs/examples/project/update-password-dictionary-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updatePasswordDictionaryPolicy({ - enabled: false -}); -``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md deleted file mode 100644 index b8ab9d03..00000000 --- a/docs/examples/project/update-password-history-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updatePasswordHistoryPolicy({ - total: 1 -}); -``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md deleted file mode 100644 index df490a4a..00000000 --- a/docs/examples/project/update-password-personal-data-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updatePasswordPersonalDataPolicy({ - enabled: false -}); -``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md deleted file mode 100644 index 373e9178..00000000 --- a/docs/examples/project/update-protocol.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateProtocol({ - protocolId: sdk.ProjectProtocolId.Rest, - enabled: false -}); -``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md deleted file mode 100644 index ded8eb76..00000000 --- a/docs/examples/project/update-service.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateService({ - serviceId: sdk.ProjectServiceId.Account, - enabled: false -}); -``` diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md deleted file mode 100644 index 54546084..00000000 --- a/docs/examples/project/update-session-alert-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateSessionAlertPolicy({ - enabled: false -}); -``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md deleted file mode 100644 index 2a4873be..00000000 --- a/docs/examples/project/update-session-duration-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateSessionDurationPolicy({ - duration: 5 -}); -``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md deleted file mode 100644 index a5840bc2..00000000 --- a/docs/examples/project/update-session-invalidation-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateSessionInvalidationPolicy({ - enabled: false -}); -``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md deleted file mode 100644 index 514d77aa..00000000 --- a/docs/examples/project/update-session-limit-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateSessionLimitPolicy({ - total: 1 -}); -``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md deleted file mode 100644 index fe7258a5..00000000 --- a/docs/examples/project/update-smtp.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateSMTP({ - host: '', // optional - port: null, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - senderEmail: 'email@example.com', // optional - senderName: '<SENDER_NAME>', // optional - replyToEmail: 'email@example.com', // optional - replyToName: '<REPLY_TO_NAME>', // optional - secure: sdk.ProjectSMTPSecure.Tls, // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md deleted file mode 100644 index bb372042..00000000 --- a/docs/examples/project/update-user-limit-policy.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateUserLimitPolicy({ - total: 1 -}); -``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md deleted file mode 100644 index 58e738ed..00000000 --- a/docs/examples/project/update-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateVariable({ - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); -``` diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md deleted file mode 100644 index 9c4f9bd1..00000000 --- a/docs/examples/project/update-web-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateWebPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - hostname: 'app.example.com' -}); -``` diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md deleted file mode 100644 index 3fd19d7d..00000000 --- a/docs/examples/project/update-windows-platform.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const project = new sdk.Project(client); - -const result = await project.updateWindowsPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' -}); -``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md deleted file mode 100644 index 25fcf691..00000000 --- a/docs/examples/proxy/create-api-rule.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.createAPIRule({ - domain: '' -}); -``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md deleted file mode 100644 index cf225f67..00000000 --- a/docs/examples/proxy/create-function-rule.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.createFunctionRule({ - domain: '', - functionId: '<FUNCTION_ID>', - branch: '<BRANCH>' // optional -}); -``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md deleted file mode 100644 index 0f33abd6..00000000 --- a/docs/examples/proxy/create-redirect-rule.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.createRedirectRule({ - domain: '', - url: 'https://example.com', - statusCode: sdk.StatusCode.MovedPermanently301, - resourceId: '<RESOURCE_ID>', - resourceType: sdk.ProxyResourceType.Site -}); -``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md deleted file mode 100644 index bafbee3d..00000000 --- a/docs/examples/proxy/create-site-rule.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.createSiteRule({ - domain: '', - siteId: '<SITE_ID>', - branch: '<BRANCH>' // optional -}); -``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md deleted file mode 100644 index 2d07a110..00000000 --- a/docs/examples/proxy/delete-rule.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.deleteRule({ - ruleId: '<RULE_ID>' -}); -``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md deleted file mode 100644 index e89612dc..00000000 --- a/docs/examples/proxy/get-rule.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.getRule({ - ruleId: '<RULE_ID>' -}); -``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md deleted file mode 100644 index b161a085..00000000 --- a/docs/examples/proxy/list-rules.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.listRules({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md deleted file mode 100644 index 9e050fc7..00000000 --- a/docs/examples/proxy/update-rule-status.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const proxy = new sdk.Proxy(client); - -const result = await proxy.updateRuleStatus({ - ruleId: '<RULE_ID>' -}); -``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md deleted file mode 100644 index 2603dda9..00000000 --- a/docs/examples/sites/create-deployment.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); -const fs = require('fs'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.createDeployment({ - siteId: '<SITE_ID>', - code: InputFile.fromPath('/path/to/file', 'filename'), - installCommand: '<INSTALL_COMMAND>', // optional - buildCommand: '<BUILD_COMMAND>', // optional - outputDirectory: '<OUTPUT_DIRECTORY>', // optional - activate: false // optional -}); -``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md deleted file mode 100644 index e14d8585..00000000 --- a/docs/examples/sites/create-duplicate-deployment.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.createDuplicateDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); -``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md deleted file mode 100644 index b08d94ab..00000000 --- a/docs/examples/sites/create-template-deployment.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.createTemplateDeployment({ - siteId: '<SITE_ID>', - repository: '<REPOSITORY>', - owner: '<OWNER>', - rootDirectory: '<ROOT_DIRECTORY>', - type: sdk.TemplateReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); -``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md deleted file mode 100644 index cad7be76..00000000 --- a/docs/examples/sites/create-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.createVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); -``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md deleted file mode 100644 index 6d28546e..00000000 --- a/docs/examples/sites/create-vcs-deployment.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.createVcsDeployment({ - siteId: '<SITE_ID>', - type: sdk.VCSReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); -``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md deleted file mode 100644 index 65e5c64c..00000000 --- a/docs/examples/sites/create.md +++ /dev/null @@ -1,34 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.create({ - siteId: '<SITE_ID>', - name: '<NAME>', - framework: sdk.Framework.Analog, - buildRuntime: sdk.BuildRuntime.Node145, - enabled: false, // optional - logging: false, // optional - timeout: 1, // optional - installCommand: '<INSTALL_COMMAND>', // optional - buildCommand: '<BUILD_COMMAND>', // optional - startCommand: '<START_COMMAND>', // optional - outputDirectory: '<OUTPUT_DIRECTORY>', // optional - adapter: sdk.Adapter.Static, // optional - installationId: '<INSTALLATION_ID>', // optional - fallbackFile: '<FALLBACK_FILE>', // optional - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional - providerBranch: '<PROVIDER_BRANCH>', // optional - providerSilentMode: false, // optional - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); -``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md deleted file mode 100644 index 533f2985..00000000 --- a/docs/examples/sites/delete-deployment.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.deleteDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); -``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md deleted file mode 100644 index 38f7c3a3..00000000 --- a/docs/examples/sites/delete-log.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.deleteLog({ - siteId: '<SITE_ID>', - logId: '<LOG_ID>' -}); -``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md deleted file mode 100644 index 11ebaca9..00000000 --- a/docs/examples/sites/delete-variable.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.deleteVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>' -}); -``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md deleted file mode 100644 index 03bd1a57..00000000 --- a/docs/examples/sites/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.delete({ - siteId: '<SITE_ID>' -}); -``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md deleted file mode 100644 index 6e7ee4aa..00000000 --- a/docs/examples/sites/get-deployment-download.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.getDeploymentDownload({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>', - type: sdk.DeploymentDownloadType.Source // optional -}); -``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md deleted file mode 100644 index 1f1430ca..00000000 --- a/docs/examples/sites/get-deployment.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.getDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); -``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md deleted file mode 100644 index f8190b4a..00000000 --- a/docs/examples/sites/get-log.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.getLog({ - siteId: '<SITE_ID>', - logId: '<LOG_ID>' -}); -``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md deleted file mode 100644 index cafb71b1..00000000 --- a/docs/examples/sites/get-variable.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.getVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>' -}); -``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md deleted file mode 100644 index 0b21b2bb..00000000 --- a/docs/examples/sites/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.get({ - siteId: '<SITE_ID>' -}); -``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md deleted file mode 100644 index 1b544a0a..00000000 --- a/docs/examples/sites/list-deployments.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.listDeployments({ - siteId: '<SITE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md deleted file mode 100644 index 9a417bfd..00000000 --- a/docs/examples/sites/list-frameworks.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.listFrameworks(); -``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md deleted file mode 100644 index 62b16945..00000000 --- a/docs/examples/sites/list-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.listLogs({ - siteId: '<SITE_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md deleted file mode 100644 index 6e882891..00000000 --- a/docs/examples/sites/list-specifications.md +++ /dev/null @@ -1,12 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.listSpecifications(); -``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md deleted file mode 100644 index 26ae3212..00000000 --- a/docs/examples/sites/list-variables.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.listVariables({ - siteId: '<SITE_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md deleted file mode 100644 index 518aa709..00000000 --- a/docs/examples/sites/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md deleted file mode 100644 index 73a74758..00000000 --- a/docs/examples/sites/update-deployment-status.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.updateDeploymentStatus({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); -``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md deleted file mode 100644 index 1221d370..00000000 --- a/docs/examples/sites/update-site-deployment.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.updateSiteDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); -``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md deleted file mode 100644 index 2853a180..00000000 --- a/docs/examples/sites/update-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.updateVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); -``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md deleted file mode 100644 index 0411752f..00000000 --- a/docs/examples/sites/update.md +++ /dev/null @@ -1,34 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const sites = new sdk.Sites(client); - -const result = await sites.update({ - siteId: '<SITE_ID>', - name: '<NAME>', - framework: sdk.Framework.Analog, - enabled: false, // optional - logging: false, // optional - timeout: 1, // optional - installCommand: '<INSTALL_COMMAND>', // optional - buildCommand: '<BUILD_COMMAND>', // optional - startCommand: '<START_COMMAND>', // optional - outputDirectory: '<OUTPUT_DIRECTORY>', // optional - buildRuntime: sdk.BuildRuntime.Node145, // optional - adapter: sdk.Adapter.Static, // optional - fallbackFile: '<FALLBACK_FILE>', // optional - installationId: '<INSTALLATION_ID>', // optional - providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional - providerBranch: '<PROVIDER_BRANCH>', // optional - providerSilentMode: false, // optional - providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional - buildSpecification: '', // optional - runtimeSpecification: '', // optional - deploymentRetention: 0 // optional -}); -``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md deleted file mode 100644 index 47dc8b31..00000000 --- a/docs/examples/storage/create-bucket.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new sdk.Storage(client); - -const result = await storage.createBucket({ - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: sdk.Compression.None, // optional - encryption: false, // optional - antivirus: false, // optional - transformations: false // optional -}); -``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md deleted file mode 100644 index 055e5ab5..00000000 --- a/docs/examples/storage/create-file.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); -const fs = require('fs'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.createFile({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - file: InputFile.fromPath('/path/to/file', 'filename'), - permissions: [sdk.Permission.read(sdk.Role.any())] // optional -}); -``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md deleted file mode 100644 index bf6fa1b6..00000000 --- a/docs/examples/storage/delete-bucket.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new sdk.Storage(client); - -const result = await storage.deleteBucket({ - bucketId: '<BUCKET_ID>' -}); -``` diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md deleted file mode 100644 index d49838e1..00000000 --- a/docs/examples/storage/delete-file.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.deleteFile({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>' -}); -``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md deleted file mode 100644 index 380db535..00000000 --- a/docs/examples/storage/get-bucket.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new sdk.Storage(client); - -const result = await storage.getBucket({ - bucketId: '<BUCKET_ID>' -}); -``` diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md deleted file mode 100644 index c0a10d96..00000000 --- a/docs/examples/storage/get-file-download.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.getFileDownload({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - token: '<TOKEN>' // optional -}); -``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md deleted file mode 100644 index 984333db..00000000 --- a/docs/examples/storage/get-file-preview.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.getFilePreview({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - width: 0, // optional - height: 0, // optional - gravity: sdk.ImageGravity.Center, // optional - quality: -1, // optional - borderWidth: 0, // optional - borderColor: '', // optional - borderRadius: 0, // optional - opacity: 0, // optional - rotation: -360, // optional - background: '', // optional - output: sdk.ImageFormat.Jpg, // optional - token: '<TOKEN>' // optional -}); -``` diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md deleted file mode 100644 index a20c4ac2..00000000 --- a/docs/examples/storage/get-file-view.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.getFileView({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - token: '<TOKEN>' // optional -}); -``` diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md deleted file mode 100644 index d8bdf4dd..00000000 --- a/docs/examples/storage/get-file.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.getFile({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>' -}); -``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md deleted file mode 100644 index c17389e5..00000000 --- a/docs/examples/storage/list-buckets.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new sdk.Storage(client); - -const result = await storage.listBuckets({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md deleted file mode 100644 index f51fad9d..00000000 --- a/docs/examples/storage/list-files.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.listFiles({ - bucketId: '<BUCKET_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md deleted file mode 100644 index c17c9691..00000000 --- a/docs/examples/storage/update-bucket.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const storage = new sdk.Storage(client); - -const result = await storage.updateBucket({ - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: sdk.Compression.None, // optional - encryption: false, // optional - antivirus: false, // optional - transformations: false // optional -}); -``` diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md deleted file mode 100644 index 8d2294ff..00000000 --- a/docs/examples/storage/update-file.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const storage = new sdk.Storage(client); - -const result = await storage.updateFile({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - name: '<NAME>', // optional - permissions: [sdk.Permission.read(sdk.Role.any())] // optional -}); -``` diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md deleted file mode 100644 index 21ca0bfd..00000000 --- a/docs/examples/tablesdb/create-big-int-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createBigIntColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md deleted file mode 100644 index b9df8ba8..00000000 --- a/docs/examples/tablesdb/create-boolean-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createBooleanColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: false, // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md deleted file mode 100644 index 602c2a1a..00000000 --- a/docs/examples/tablesdb/create-datetime-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createDatetimeColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md deleted file mode 100644 index bdd59341..00000000 --- a/docs/examples/tablesdb/create-email-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createEmailColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'email@example.com', // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md deleted file mode 100644 index 4016ce71..00000000 --- a/docs/examples/tablesdb/create-enum-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createEnumColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md deleted file mode 100644 index b533f38a..00000000 --- a/docs/examples/tablesdb/create-float-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createFloatColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md deleted file mode 100644 index 6a7523ba..00000000 --- a/docs/examples/tablesdb/create-index.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - type: sdk.TablesDBIndexType.Key, - columns: [], - orders: [sdk.OrderBy.Asc], // optional - lengths: [] // optional -}); -``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md deleted file mode 100644 index 6e99e93e..00000000 --- a/docs/examples/tablesdb/create-integer-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createIntegerColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - min: null, // optional - max: null, // optional - xdefault: null, // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md deleted file mode 100644 index 7d176b6a..00000000 --- a/docs/examples/tablesdb/create-ip-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createIpColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '', // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md deleted file mode 100644 index f99194c6..00000000 --- a/docs/examples/tablesdb/create-line-column.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createLineColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional -}); -``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md deleted file mode 100644 index 89d37c47..00000000 --- a/docs/examples/tablesdb/create-longtext-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createLongtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md deleted file mode 100644 index daa59589..00000000 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createMediumtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md deleted file mode 100644 index d1823aa8..00000000 --- a/docs/examples/tablesdb/create-operations.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createOperations({ - transactionId: '<TRANSACTION_ID>', - operations: [ - { - "action": "create", - "databaseId": "<DATABASE_ID>", - "tableId": "<TABLE_ID>", - "rowId": "<ROW_ID>", - "data": { - "name": "Walter O'Brien" - } - } - ] // optional -}); -``` diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md deleted file mode 100644 index a68d1e43..00000000 --- a/docs/examples/tablesdb/create-point-column.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createPointColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [1, 2] // optional -}); -``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md deleted file mode 100644 index 0f4631bc..00000000 --- a/docs/examples/tablesdb/create-polygon-column.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createPolygonColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional -}); -``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md deleted file mode 100644 index 6f2c0fa9..00000000 --- a/docs/examples/tablesdb/create-relationship-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createRelationshipColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - relatedTableId: '<RELATED_TABLE_ID>', - type: sdk.RelationshipType.OneToOne, - twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: sdk.RelationMutate.Cascade // optional -}); -``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md deleted file mode 100644 index 485afcde..00000000 --- a/docs/examples/tablesdb/create-row.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createRow({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 30, - "isAdmin": false - }, - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md deleted file mode 100644 index 05364214..00000000 --- a/docs/examples/tablesdb/create-rows.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rows: [], - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md deleted file mode 100644 index 255701ce..00000000 --- a/docs/examples/tablesdb/create-string-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createStringColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - size: 1, - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md deleted file mode 100644 index b429f797..00000000 --- a/docs/examples/tablesdb/create-table.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - name: '<NAME>', - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - rowSecurity: false, // optional - enabled: false, // optional - columns: [], // optional - indexes: [] // optional -}); -``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md deleted file mode 100644 index e7b9a479..00000000 --- a/docs/examples/tablesdb/create-text-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createTextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md deleted file mode 100644 index c737347f..00000000 --- a/docs/examples/tablesdb/create-transaction.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createTransaction({ - ttl: 60 // optional -}); -``` diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md deleted file mode 100644 index 01e27e7d..00000000 --- a/docs/examples/tablesdb/create-url-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createUrlColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'https://example.com', // optional - array: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md deleted file mode 100644 index 9cfc6fa6..00000000 --- a/docs/examples/tablesdb/create-varchar-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.createVarcharColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - size: 1, - required: false, - xdefault: '<DEFAULT>', // optional - array: false, // optional - encrypt: false // optional -}); -``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md deleted file mode 100644 index 0571906c..00000000 --- a/docs/examples/tablesdb/create.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.create({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', - enabled: false // optional -}); -``` diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md deleted file mode 100644 index 2fafbbbf..00000000 --- a/docs/examples/tablesdb/decrement-row-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.decrementRowColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', - column: '', - value: null, // optional - min: null, // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md deleted file mode 100644 index 51fd96e3..00000000 --- a/docs/examples/tablesdb/delete-column.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.deleteColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); -``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md deleted file mode 100644 index 4c7ad1ee..00000000 --- a/docs/examples/tablesdb/delete-index.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.deleteIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); -``` diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md deleted file mode 100644 index 20d4e95b..00000000 --- a/docs/examples/tablesdb/delete-row.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.deleteRow({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md deleted file mode 100644 index 3dd8f1e0..00000000 --- a/docs/examples/tablesdb/delete-rows.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.deleteRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md deleted file mode 100644 index f3071a45..00000000 --- a/docs/examples/tablesdb/delete-table.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.deleteTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>' -}); -``` diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md deleted file mode 100644 index 3daa0bd6..00000000 --- a/docs/examples/tablesdb/delete-transaction.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.deleteTransaction({ - transactionId: '<TRANSACTION_ID>' -}); -``` diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md deleted file mode 100644 index 018b3a9c..00000000 --- a/docs/examples/tablesdb/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.delete({ - databaseId: '<DATABASE_ID>' -}); -``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md deleted file mode 100644 index 8daf93d4..00000000 --- a/docs/examples/tablesdb/get-column.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.getColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); -``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md deleted file mode 100644 index 164f833e..00000000 --- a/docs/examples/tablesdb/get-index.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.getIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); -``` diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md deleted file mode 100644 index 6cbf26f0..00000000 --- a/docs/examples/tablesdb/get-row.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.getRow({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md deleted file mode 100644 index e8254356..00000000 --- a/docs/examples/tablesdb/get-table.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.getTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>' -}); -``` diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md deleted file mode 100644 index c39cfe11..00000000 --- a/docs/examples/tablesdb/get-transaction.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.getTransaction({ - transactionId: '<TRANSACTION_ID>' -}); -``` diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md deleted file mode 100644 index 38d5ce7a..00000000 --- a/docs/examples/tablesdb/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.get({ - databaseId: '<DATABASE_ID>' -}); -``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md deleted file mode 100644 index 1388043a..00000000 --- a/docs/examples/tablesdb/increment-row-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.incrementRowColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', - column: '', - value: null, // optional - max: null, // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md deleted file mode 100644 index 59b2bfbf..00000000 --- a/docs/examples/tablesdb/list-columns.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.listColumns({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md deleted file mode 100644 index 7ff6df55..00000000 --- a/docs/examples/tablesdb/list-indexes.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.listIndexes({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md deleted file mode 100644 index 2777730b..00000000 --- a/docs/examples/tablesdb/list-rows.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.listRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - transactionId: '<TRANSACTION_ID>', // optional - total: false, // optional - ttl: 0 // optional -}); -``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md deleted file mode 100644 index 82779015..00000000 --- a/docs/examples/tablesdb/list-tables.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.listTables({ - databaseId: '<DATABASE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md deleted file mode 100644 index 892bd288..00000000 --- a/docs/examples/tablesdb/list-transactions.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.listTransactions({ - queries: [] // optional -}); -``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md deleted file mode 100644 index 3514e2dc..00000000 --- a/docs/examples/tablesdb/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md deleted file mode 100644 index 4defcb4c..00000000 --- a/docs/examples/tablesdb/update-big-int-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateBigIntColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md deleted file mode 100644 index 6ad62691..00000000 --- a/docs/examples/tablesdb/update-boolean-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateBooleanColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: false, - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md deleted file mode 100644 index ff93b140..00000000 --- a/docs/examples/tablesdb/update-datetime-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateDatetimeColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '2020-10-15T06:38:00.000+00:00', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md deleted file mode 100644 index fc6c764b..00000000 --- a/docs/examples/tablesdb/update-email-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateEmailColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'email@example.com', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md deleted file mode 100644 index b97a4c58..00000000 --- a/docs/examples/tablesdb/update-enum-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateEnumColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md deleted file mode 100644 index d332d81f..00000000 --- a/docs/examples/tablesdb/update-float-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateFloatColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md deleted file mode 100644 index 4a49705d..00000000 --- a/docs/examples/tablesdb/update-integer-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateIntegerColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: null, - min: null, // optional - max: null, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md deleted file mode 100644 index 00dfce17..00000000 --- a/docs/examples/tablesdb/update-ip-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateIpColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md deleted file mode 100644 index 0a6bd255..00000000 --- a/docs/examples/tablesdb/update-line-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateLineColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]], // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md deleted file mode 100644 index cdb20747..00000000 --- a/docs/examples/tablesdb/update-longtext-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateLongtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md deleted file mode 100644 index 7c84b920..00000000 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateMediumtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md deleted file mode 100644 index c2e10506..00000000 --- a/docs/examples/tablesdb/update-point-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updatePointColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [1, 2], // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md deleted file mode 100644 index 0a38cd0a..00000000 --- a/docs/examples/tablesdb/update-polygon-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updatePolygonColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md deleted file mode 100644 index 86f935a5..00000000 --- a/docs/examples/tablesdb/update-relationship-column.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateRelationshipColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - onDelete: sdk.RelationMutate.Cascade, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md deleted file mode 100644 index bac92af2..00000000 --- a/docs/examples/tablesdb/update-row.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateRow({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false - }, // optional - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md deleted file mode 100644 index 09ab8601..00000000 --- a/docs/examples/tablesdb/update-rows.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false - }, // optional - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md deleted file mode 100644 index 757aa6cf..00000000 --- a/docs/examples/tablesdb/update-string-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateStringColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md deleted file mode 100644 index 6aa65c2e..00000000 --- a/docs/examples/tablesdb/update-table.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - name: '<NAME>', // optional - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - rowSecurity: false, // optional - enabled: false, // optional - purge: false // optional -}); -``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md deleted file mode 100644 index 69970d63..00000000 --- a/docs/examples/tablesdb/update-text-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateTextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md deleted file mode 100644 index d0607478..00000000 --- a/docs/examples/tablesdb/update-transaction.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateTransaction({ - transactionId: '<TRANSACTION_ID>', - commit: false, // optional - rollback: false // optional -}); -``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md deleted file mode 100644 index 08392f5d..00000000 --- a/docs/examples/tablesdb/update-url-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateUrlColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'https://example.com', - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md deleted file mode 100644 index 58f94220..00000000 --- a/docs/examples/tablesdb/update-varchar-column.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.updateVarcharColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); -``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md deleted file mode 100644 index 7cbf6f58..00000000 --- a/docs/examples/tablesdb/update.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.update({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', // optional - enabled: false // optional -}); -``` diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md deleted file mode 100644 index f544bc06..00000000 --- a/docs/examples/tablesdb/upsert-row.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.upsertRow({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', - data: { - "username": "walter.obrien", - "email": "walter.obrien@example.com", - "fullName": "Walter O'Brien", - "age": 33, - "isAdmin": false - }, // optional - permissions: [sdk.Permission.read(sdk.Role.any())], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md deleted file mode 100644 index 7bbf2ed3..00000000 --- a/docs/examples/tablesdb/upsert-rows.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tablesDB = new sdk.TablesDB(client); - -const result = await tablesDB.upsertRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rows: [], - transactionId: '<TRANSACTION_ID>' // optional -}); -``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md deleted file mode 100644 index 910bb757..00000000 --- a/docs/examples/teams/create-membership.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.createMembership({ - teamId: '<TEAM_ID>', - roles: [], - email: 'email@example.com', // optional - userId: '<USER_ID>', // optional - phone: '+12065550100', // optional - url: 'https://example.com', // optional - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md deleted file mode 100644 index 8e5702b2..00000000 --- a/docs/examples/teams/create.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.create({ - teamId: '<TEAM_ID>', - name: '<NAME>', - roles: [] // optional -}); -``` diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md deleted file mode 100644 index 7dd11603..00000000 --- a/docs/examples/teams/delete-membership.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.deleteMembership({ - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>' -}); -``` diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md deleted file mode 100644 index 8593956f..00000000 --- a/docs/examples/teams/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.delete({ - teamId: '<TEAM_ID>' -}); -``` diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md deleted file mode 100644 index 4ecf078d..00000000 --- a/docs/examples/teams/get-membership.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.getMembership({ - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>' -}); -``` diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md deleted file mode 100644 index 0238bdba..00000000 --- a/docs/examples/teams/get-prefs.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.getPrefs({ - teamId: '<TEAM_ID>' -}); -``` diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md deleted file mode 100644 index bd01c5c5..00000000 --- a/docs/examples/teams/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.get({ - teamId: '<TEAM_ID>' -}); -``` diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md deleted file mode 100644 index 1185380b..00000000 --- a/docs/examples/teams/list-memberships.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.listMemberships({ - teamId: '<TEAM_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md deleted file mode 100644 index b4525fba..00000000 --- a/docs/examples/teams/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md deleted file mode 100644 index 614737ec..00000000 --- a/docs/examples/teams/update-membership-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.updateMembershipStatus({ - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', - userId: '<USER_ID>', - secret: '<SECRET>' -}); -``` diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md deleted file mode 100644 index 95a5c375..00000000 --- a/docs/examples/teams/update-membership.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.updateMembership({ - teamId: '<TEAM_ID>', - membershipId: '<MEMBERSHIP_ID>', - roles: [] -}); -``` diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md deleted file mode 100644 index 0c64d2ba..00000000 --- a/docs/examples/teams/update-name.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.updateName({ - teamId: '<TEAM_ID>', - name: '<NAME>' -}); -``` diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md deleted file mode 100644 index 180e3224..00000000 --- a/docs/examples/teams/update-prefs.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setSession(''); // The user session to authenticate with - -const teams = new sdk.Teams(client); - -const result = await teams.updatePrefs({ - teamId: '<TEAM_ID>', - prefs: {} -}); -``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md deleted file mode 100644 index bfb5d8d0..00000000 --- a/docs/examples/tokens/create-file-token.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new sdk.Tokens(client); - -const result = await tokens.createFileToken({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); -``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md deleted file mode 100644 index f3b40894..00000000 --- a/docs/examples/tokens/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new sdk.Tokens(client); - -const result = await tokens.delete({ - tokenId: '<TOKEN_ID>' -}); -``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md deleted file mode 100644 index 383ea5f3..00000000 --- a/docs/examples/tokens/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new sdk.Tokens(client); - -const result = await tokens.get({ - tokenId: '<TOKEN_ID>' -}); -``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md deleted file mode 100644 index 13e48480..00000000 --- a/docs/examples/tokens/list.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new sdk.Tokens(client); - -const result = await tokens.list({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md deleted file mode 100644 index 0ab3b168..00000000 --- a/docs/examples/tokens/update.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const tokens = new sdk.Tokens(client); - -const result = await tokens.update({ - tokenId: '<TOKEN_ID>', - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); -``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md deleted file mode 100644 index 887f98fe..00000000 --- a/docs/examples/usage/list-events.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const usage = new sdk.Usage(client); - -const result = await usage.listEvents({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md deleted file mode 100644 index aa5ba1d8..00000000 --- a/docs/examples/usage/list-gauges.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const usage = new sdk.Usage(client); - -const result = await usage.listGauges({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md deleted file mode 100644 index 4f45f7fd..00000000 --- a/docs/examples/users/create-argon-2-user.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createArgon2User({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md deleted file mode 100644 index 55100412..00000000 --- a/docs/examples/users/create-bcrypt-user.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createBcryptUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md deleted file mode 100644 index c2e6eaa4..00000000 --- a/docs/examples/users/create-jwt.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createJWT({ - userId: '<USER_ID>', - sessionId: '<SESSION_ID>', // optional - duration: 0 // optional -}); -``` diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md deleted file mode 100644 index 004c3b74..00000000 --- a/docs/examples/users/create-md-5-user.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createMD5User({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md deleted file mode 100644 index 2f712022..00000000 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createMFARecoveryCodes({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md deleted file mode 100644 index 945f7476..00000000 --- a/docs/examples/users/create-ph-pass-user.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createPHPassUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md deleted file mode 100644 index fc8a5e00..00000000 --- a/docs/examples/users/create-scrypt-modified-user.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createScryptModifiedUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', - passwordSignerKey: '<PASSWORD_SIGNER_KEY>', - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md deleted file mode 100644 index e9a35358..00000000 --- a/docs/examples/users/create-scrypt-user.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createScryptUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordSalt: '<PASSWORD_SALT>', - passwordCpu: null, - passwordMemory: null, - passwordParallel: null, - passwordLength: null, - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md deleted file mode 100644 index 04e37680..00000000 --- a/docs/examples/users/create-session.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createSession({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md deleted file mode 100644 index 47c0d74b..00000000 --- a/docs/examples/users/create-sha-user.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createSHAUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordVersion: sdk.PasswordHash.Sha1, // optional - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md deleted file mode 100644 index bc19f2bf..00000000 --- a/docs/examples/users/create-target.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - providerType: sdk.MessagingProviderType.Email, - identifier: '<IDENTIFIER>', - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md deleted file mode 100644 index 5978df65..00000000 --- a/docs/examples/users/create-token.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.createToken({ - userId: '<USER_ID>', - length: 4, // optional - expire: 60 // optional -}); -``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md deleted file mode 100644 index 5610f062..00000000 --- a/docs/examples/users/create.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.create({ - userId: '<USER_ID>', - email: 'email@example.com', // optional - phone: '+12065550100', // optional - password: '', // optional - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md deleted file mode 100644 index 1a730d8d..00000000 --- a/docs/examples/users/delete-identity.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.deleteIdentity({ - identityId: '<IDENTITY_ID>' -}); -``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md deleted file mode 100644 index a5d4e3d0..00000000 --- a/docs/examples/users/delete-mfa-authenticator.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.deleteMFAAuthenticator({ - userId: '<USER_ID>', - type: sdk.AuthenticatorType.Totp -}); -``` diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md deleted file mode 100644 index d39eccd0..00000000 --- a/docs/examples/users/delete-session.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.deleteSession({ - userId: '<USER_ID>', - sessionId: '<SESSION_ID>' -}); -``` diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md deleted file mode 100644 index 9331435b..00000000 --- a/docs/examples/users/delete-sessions.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.deleteSessions({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md deleted file mode 100644 index 3f579302..00000000 --- a/docs/examples/users/delete-target.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.deleteTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -}); -``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md deleted file mode 100644 index 8714dc59..00000000 --- a/docs/examples/users/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.delete({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md deleted file mode 100644 index 3e379926..00000000 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.getMFARecoveryCodes({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md deleted file mode 100644 index d81539e9..00000000 --- a/docs/examples/users/get-prefs.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.getPrefs({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md deleted file mode 100644 index 97ee9647..00000000 --- a/docs/examples/users/get-target.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.getTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -}); -``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md deleted file mode 100644 index 3f86f8c9..00000000 --- a/docs/examples/users/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.get({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md deleted file mode 100644 index e25c26f4..00000000 --- a/docs/examples/users/list-identities.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.listIdentities({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md deleted file mode 100644 index 7cb97e27..00000000 --- a/docs/examples/users/list-logs.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.listLogs({ - userId: '<USER_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md deleted file mode 100644 index 0a758c00..00000000 --- a/docs/examples/users/list-memberships.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.listMemberships({ - userId: '<USER_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md deleted file mode 100644 index 9272a20c..00000000 --- a/docs/examples/users/list-mfa-factors.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.listMFAFactors({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md deleted file mode 100644 index d941dcfb..00000000 --- a/docs/examples/users/list-sessions.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.listSessions({ - userId: '<USER_ID>', - total: false // optional -}); -``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md deleted file mode 100644 index aa7be748..00000000 --- a/docs/examples/users/list-targets.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.listTargets({ - userId: '<USER_ID>', - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md deleted file mode 100644 index 916dabc0..00000000 --- a/docs/examples/users/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); -``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md deleted file mode 100644 index 7a43202d..00000000 --- a/docs/examples/users/update-email-verification.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateEmailVerification({ - userId: '<USER_ID>', - emailVerification: false -}); -``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md deleted file mode 100644 index 10cf0027..00000000 --- a/docs/examples/users/update-email.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateEmail({ - userId: '<USER_ID>', - email: 'email@example.com' -}); -``` diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md deleted file mode 100644 index a41d11dc..00000000 --- a/docs/examples/users/update-impersonator.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateImpersonator({ - userId: '<USER_ID>', - impersonator: false -}); -``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md deleted file mode 100644 index 28f28931..00000000 --- a/docs/examples/users/update-labels.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateLabels({ - userId: '<USER_ID>', - labels: [] -}); -``` diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md deleted file mode 100644 index 41fa921e..00000000 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateMFARecoveryCodes({ - userId: '<USER_ID>' -}); -``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md deleted file mode 100644 index c62e10fc..00000000 --- a/docs/examples/users/update-mfa.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateMFA({ - userId: '<USER_ID>', - mfa: false -}); -``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md deleted file mode 100644 index 03369c9c..00000000 --- a/docs/examples/users/update-name.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateName({ - userId: '<USER_ID>', - name: '<NAME>' -}); -``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md deleted file mode 100644 index ab572ca0..00000000 --- a/docs/examples/users/update-password.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updatePassword({ - userId: '<USER_ID>', - password: '' -}); -``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md deleted file mode 100644 index 4489902d..00000000 --- a/docs/examples/users/update-phone-verification.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updatePhoneVerification({ - userId: '<USER_ID>', - phoneVerification: false -}); -``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md deleted file mode 100644 index d45d5ed0..00000000 --- a/docs/examples/users/update-phone.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updatePhone({ - userId: '<USER_ID>', - number: '+12065550100' -}); -``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md deleted file mode 100644 index 3bb011ae..00000000 --- a/docs/examples/users/update-prefs.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updatePrefs({ - userId: '<USER_ID>', - prefs: {} -}); -``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md deleted file mode 100644 index ec7d5bdb..00000000 --- a/docs/examples/users/update-status.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateStatus({ - userId: '<USER_ID>', - status: false -}); -``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md deleted file mode 100644 index d1dcf74a..00000000 --- a/docs/examples/users/update-target.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const users = new sdk.Users(client); - -const result = await users.updateTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - identifier: '<IDENTIFIER>', // optional - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -}); -``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md deleted file mode 100644 index c8603872..00000000 --- a/docs/examples/webhooks/create.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new sdk.Webhooks(client); - -const result = await webhooks.create({ - webhookId: '<WEBHOOK_ID>', - url: '', - name: '<NAME>', - events: [], - enabled: false, // optional - tls: false, // optional - authUsername: '<AUTH_USERNAME>', // optional - authPassword: '<AUTH_PASSWORD>', // optional - secret: '<SECRET>' // optional -}); -``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md deleted file mode 100644 index 51639e22..00000000 --- a/docs/examples/webhooks/delete.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new sdk.Webhooks(client); - -const result = await webhooks.delete({ - webhookId: '<WEBHOOK_ID>' -}); -``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md deleted file mode 100644 index 07d1ecda..00000000 --- a/docs/examples/webhooks/get.md +++ /dev/null @@ -1,14 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new sdk.Webhooks(client); - -const result = await webhooks.get({ - webhookId: '<WEBHOOK_ID>' -}); -``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md deleted file mode 100644 index f509df71..00000000 --- a/docs/examples/webhooks/list.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new sdk.Webhooks(client); - -const result = await webhooks.list({ - queries: [], // optional - total: false // optional -}); -``` diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md deleted file mode 100644 index 7c0e504c..00000000 --- a/docs/examples/webhooks/update-secret.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new sdk.Webhooks(client); - -const result = await webhooks.updateSecret({ - webhookId: '<WEBHOOK_ID>', - secret: '<SECRET>' // optional -}); -``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md deleted file mode 100644 index 6596e900..00000000 --- a/docs/examples/webhooks/update.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -const sdk = require('node-appwrite'); - -const client = new sdk.Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>') // Your project ID - .setKey('<YOUR_API_KEY>'); // Your secret API key - -const webhooks = new sdk.Webhooks(client); - -const result = await webhooks.update({ - webhookId: '<WEBHOOK_ID>', - name: '<NAME>', - url: '', - events: [], - enabled: false, // optional - tls: false, // optional - authUsername: '<AUTH_USERNAME>', // optional - authPassword: '<AUTH_PASSWORD>' // optional -}); -``` diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index fa96a4ec..00000000 --- a/package-lock.json +++ /dev/null @@ -1,5093 +0,0 @@ -{ - "name": "node-appwrite", - "version": "25.1.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "node-appwrite", - "version": "25.1.0", - "dependencies": { - "json-bigint": "1.0.0", - "node-fetch-native-with-agent": "1.7.2" - }, - "devDependencies": { - "@types/json-bigint": "1.0.4", - "@types/node": "20.11.25", - "esbuild-plugin-file-path-extensions": "^2.0.0", - "jest": "^29.7.0", - "tslib": "2.6.2", - "tsup": "^8.5.1", - "typescript": "5.4.2" - }, - "license": "BSD-3-Clause" - }, - "node_modules/@babel/code-frame": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", - "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/compat-data": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", - "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/core": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", - "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-compilation-targets": "^7.28.6", - "@babel/helper-module-transforms": "^7.28.6", - "@babel/helpers": "^7.28.6", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/traverse": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/remapping": "^2.3.5", - "convert-source-map": "^2.0.0", - "debug": "^4.1.0", - "gensync": "^1.0.0-beta.2", - "json5": "^2.2.3", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/babel" - } - }, - "node_modules/@babel/generator": { - "version": "7.29.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", - "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.29.0", - "@babel/types": "^7.29.0", - "@jridgewell/gen-mapping": "^0.3.12", - "@jridgewell/trace-mapping": "^0.3.28", - "jsesc": "^3.0.2" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-compilation-targets": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", - "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/compat-data": "^7.28.6", - "@babel/helper-validator-option": "^7.27.1", - "browserslist": "^4.24.0", - "lru-cache": "^5.1.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-globals": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", - "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-imports": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", - "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/traverse": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-module-transforms": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", - "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-module-imports": "^7.28.6", - "@babel/helper-validator-identifier": "^7.28.5", - "@babel/traverse": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/@babel/helper-plugin-utils": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", - "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", - "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-option": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", - "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helpers": { - "version": "7.29.2", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", - "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.29.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz", - "integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.29.0" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/plugin-syntax-async-generators": { - "version": "7.8.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", - "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-bigint": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", - "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-properties": { - "version": "7.12.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", - "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.12.13" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-class-static-block": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", - "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-attributes": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz", - "integrity": "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-import-meta": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", - "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-json-strings": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", - "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.28.6.tgz", - "integrity": "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-logical-assignment-operators": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", - "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", - "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-numeric-separator": { - "version": "7.10.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", - "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.10.4" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-object-rest-spread": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", - "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-catch-binding": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", - "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-optional-chaining": { - "version": "7.8.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", - "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.8.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-private-property-in-object": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", - "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-top-level-await": { - "version": "7.14.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", - "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.14.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.28.6.tgz", - "integrity": "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-plugin-utils": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/template": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", - "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.28.6", - "@babel/parser": "^7.28.6", - "@babel/types": "^7.28.6" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/traverse": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", - "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.29.0", - "@babel/generator": "^7.29.0", - "@babel/helper-globals": "^7.28.0", - "@babel/parser": "^7.29.0", - "@babel/template": "^7.28.6", - "@babel/types": "^7.29.0", - "debug": "^4.3.1" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/types": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", - "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.27.1", - "@babel/helper-validator-identifier": "^7.28.5" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", - "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", - "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", - "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/android-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", - "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", - "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/darwin-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", - "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", - "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", - "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", - "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", - "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", - "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-loong64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", - "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", - "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", - "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", - "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-s390x": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", - "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/linux-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", - "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", - "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", - "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", - "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", - "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", - "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/sunos-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", - "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-arm64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", - "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-ia32": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", - "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@esbuild/win32-x64": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", - "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@istanbuljs/load-nyc-config": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", - "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "camelcase": "^5.3.1", - "find-up": "^4.1.0", - "get-package-type": "^0.1.0", - "js-yaml": "^3.13.1", - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/@jest/console": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", - "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/core": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", - "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^29.7.0", - "@jest/reporters": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-changed-files": "^29.7.0", - "jest-config": "^29.7.0", - "jest-haste-map": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-resolve-dependencies": "^29.7.0", - "jest-runner": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "jest-watcher": "^29.7.0", - "micromatch": "^4.0.4", - "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/environment": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", - "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/fake-timers": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "jest-mock": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", - "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "expect": "^29.7.0", - "jest-snapshot": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/expect-utils": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", - "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-get-type": "^29.6.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/fake-timers": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", - "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@sinonjs/fake-timers": "^10.0.2", - "@types/node": "*", - "jest-message-util": "^29.7.0", - "jest-mock": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/globals": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", - "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/expect": "^29.7.0", - "@jest/types": "^29.6.3", - "jest-mock": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/reporters": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", - "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@jridgewell/trace-mapping": "^0.3.18", - "@types/node": "*", - "chalk": "^4.0.0", - "collect-v8-coverage": "^1.0.0", - "exit": "^0.1.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "istanbul-lib-coverage": "^3.0.0", - "istanbul-lib-instrument": "^6.0.0", - "istanbul-lib-report": "^3.0.0", - "istanbul-lib-source-maps": "^4.0.0", - "istanbul-reports": "^3.1.3", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "jest-worker": "^29.7.0", - "slash": "^3.0.0", - "string-length": "^4.0.1", - "strip-ansi": "^6.0.0", - "v8-to-istanbul": "^9.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/@jest/schemas": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", - "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@sinclair/typebox": "^0.27.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/source-map": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", - "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.18", - "callsites": "^3.0.0", - "graceful-fs": "^4.2.9" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-result": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", - "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "collect-v8-coverage": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/test-sequencer": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", - "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^29.7.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/transform": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", - "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/types": "^29.6.3", - "@jridgewell/trace-mapping": "^0.3.18", - "babel-plugin-istanbul": "^6.1.1", - "chalk": "^4.0.0", - "convert-source-map": "^2.0.0", - "fast-json-stable-stringify": "^2.1.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-util": "^29.7.0", - "micromatch": "^4.0.4", - "pirates": "^4.0.4", - "slash": "^3.0.0", - "write-file-atomic": "^4.0.2" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jest/types": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", - "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "@types/istanbul-lib-coverage": "^2.0.0", - "@types/istanbul-reports": "^3.0.0", - "@types/node": "*", - "@types/yargs": "^17.0.8", - "chalk": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.1.tgz", - "integrity": "sha512-d6FinEBLdIiK+1uACUttJKfgZREXrF0Qc2SmLII7W2AD8FfiZ9Wjd+rD/iRuf5s5dWrr1GgwXCvPqOuDquOowA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.1.tgz", - "integrity": "sha512-YjG/EwIDvvYI1YvYbHvDz/BYHtkY4ygUIXHnTdLhG+hKIQFBiosfWiACWortsKPKU/+dUwQQCKQM3qrDe8c9BA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.1.tgz", - "integrity": "sha512-mjCpF7GmkRtSJwon+Rq1N8+pI+8l7w5g9Z3vWj4T7abguC4Czwi3Yu/pFaLvA3TTeMVjnu3ctigusqWUfjZzvw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.1.tgz", - "integrity": "sha512-haZ7hJ1JT4e9hqkoT9R/19XW2QKqjfJVv+i5AGg57S+nLk9lQnJ1F/eZloRO3o9Scy9CM3wQ9l+dkXtcBgN5Ew==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.1.tgz", - "integrity": "sha512-czw90wpQq3ZsAVBlinZjAYTKduOjTywlG7fEeWKUA7oCmpA8xdTkxZZlwNJKWqILlq0wehoZcJYfBvOyhPTQ6w==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.1.tgz", - "integrity": "sha512-KVB2rqsxTHuBtfOeySEyzEOB7ltlB/ux38iu2rBQzkjbwRVlkhAGIEDiiYnO2kFOkJp+Z7pUXKyrRRFuFUKt+g==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.1.tgz", - "integrity": "sha512-L+34Qqil+v5uC0zEubW7uByo78WOCIrBvci69E7sFASRl0X7b/MB6Cqd1lky/CtcSVTydWa2WZwFuWexjS5o6g==", - "cpu": [ - "arm" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.1.tgz", - "integrity": "sha512-n83O8rt4v34hgFzlkb1ycniJh7IR5RCIqt6mz1VRJD6pmhRi0CXdmfnLu9dIUS6buzh60IvACM842Ffb3xd6Gg==", - "cpu": [ - "arm" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.1.tgz", - "integrity": "sha512-Nql7sTeAzhTAja3QXeAI48+/+GjBJ+QmAH13snn0AJSNL50JsDqotyudHyMbO2RbJkskbMbFJfIJKWA6R1LCJQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.1.tgz", - "integrity": "sha512-+pUymDhd0ys9GcKZPPWlFiZ67sTWV5UU6zOJat02M1+PiuSGDziyRuI/pPue3hoUwm2uGfxdL+trT6Z9rxnlMA==", - "cpu": [ - "arm64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.1.tgz", - "integrity": "sha512-VSvgvQeIcsEvY4bKDHEDWcpW4Yw7BtlKG1GUT4FzBUlEKQK0rWHYBqQt6Fm2taXS+1bXvJT6kICu5ZwqKCnvlQ==", - "cpu": [ - "loong64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.1.tgz", - "integrity": "sha512-4LqhUomJqwe641gsPp6xLfhqWMbQV04KtPp7/dIp0nzPxAkNY1AbwL5W0MQpcalLYk07vaW9Kp1PBhdpZYYcEw==", - "cpu": [ - "loong64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.1.tgz", - "integrity": "sha512-tLQQ9aPvkBxOc/EUT6j3pyeMD6Hb8QF2BTBnCQWP/uu1lhc9AIrIjKnLYMEroIz/JvtGYgI9dF3AxHZNaEH0rw==", - "cpu": [ - "ppc64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.1.tgz", - "integrity": "sha512-RMxFhJwc9fSXP6PqmAz4cbv3kAyvD1etJFjTx4ONqFP9DkTkXsAMU4v3Vyc5BgzC+anz7nS/9tp4obsKfqkDHg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.1.tgz", - "integrity": "sha512-QKgFl+Yc1eEk6MmOBfRHYF6lTxiiiV3/z/BRrbSiW2I7AFTXoBFvdMEyglohPj//2mZS4hDOqeB0H1ACh3sBbg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.1.tgz", - "integrity": "sha512-RAjXjP/8c6ZtzatZcA1RaQr6O1TRhzC+adn8YZDnChliZHviqIjmvFwHcxi4JKPSDAt6Uhf/7vqcBzQJy0PDJg==", - "cpu": [ - "riscv64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.1.tgz", - "integrity": "sha512-wcuocpaOlaL1COBYiA89O6yfjlp3RwKDeTIA0hM7OpmhR1Bjo9j31G1uQVpDlTvwxGn2nQs65fBFL5UFd76FcQ==", - "cpu": [ - "s390x" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.1.tgz", - "integrity": "sha512-77PpsFQUCOiZR9+LQEFg9GClyfkNXj1MP6wRnzYs0EeWbPcHs02AXu4xuUbM1zhwn3wqaizle3AEYg5aeoohhg==", - "cpu": [ - "x64" - ], - "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.1.tgz", - "integrity": "sha512-5cIATbk5vynAjqqmyBjlciMJl1+R/CwX9oLk/EyiFXDWd95KpHdrOJT//rnUl4cUcskrd0jCCw3wpZnhIHdD9w==", - "cpu": [ - "x64" - ], - "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.1.tgz", - "integrity": "sha512-cl0w09WsCi17mcmWqqglez9Gk8isgeWvoUZ3WiJFYSR3zjBQc2J5/ihSjpl+VLjPqjQ/1hJRcqBfLjssREQILw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ] - }, - "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.1.tgz", - "integrity": "sha512-4Cv23ZrONRbNtbZa37mLSueXUCtN7MXccChtKpUnQNgF010rjrjfHx3QxkS2PI7LqGT5xXyYs1a7LbzAwT0iCA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openharmony" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.1.tgz", - "integrity": "sha512-i1okWYkA4FJICtr7KpYzFpRTHgy5jdDbZiWfvny21iIKky5YExiDXP+zbXzm3dUcFpkEeYNHgQ5fuG236JPq0g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.1.tgz", - "integrity": "sha512-u09m3CuwLzShA0EYKMNiFgcjjzwqtUMLmuCJLeZWjjOYA3IT2Di09KaxGBTP9xVztWyIWjVdsB2E9goMjZvTQg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.1.tgz", - "integrity": "sha512-k+600V9Zl1CM7eZxJgMyTUzmrmhB/0XZnF4pRypKAlAgxmedUA+1v9R+XOFv56W4SlHEzfeMtzujLJD22Uz5zg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.1.tgz", - "integrity": "sha512-lWMnixq/QzxyhTV6NjQJ4SFo1J6PvOX8vUx5Wb4bBPsEb+8xZ89Bz6kOXpfXj9ak9AHTQVQzlgzBEc1SyM27xQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@sinclair/typebox": { - "version": "0.27.10", - "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz", - "integrity": "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@sinonjs/commons": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", - "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "type-detect": "4.0.8" - } - }, - "node_modules/@sinonjs/fake-timers": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", - "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^3.0.0" - } - }, - "node_modules/@types/babel__core": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", - "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.20.7", - "@babel/types": "^7.20.7", - "@types/babel__generator": "*", - "@types/babel__template": "*", - "@types/babel__traverse": "*" - } - }, - "node_modules/@types/babel__generator": { - "version": "7.27.0", - "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", - "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", - "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.1.0", - "@babel/types": "^7.0.0" - } - }, - "node_modules/@types/babel__traverse": { - "version": "7.28.0", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", - "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.28.2" - } - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/graceful-fs": { - "version": "4.1.9", - "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", - "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/@types/istanbul-lib-coverage": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", - "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/istanbul-lib-report": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", - "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-coverage": "*" - } - }, - "node_modules/@types/istanbul-reports": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", - "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/istanbul-lib-report": "*" - } - }, - "node_modules/@types/json-bigint": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@types/json-bigint/-/json-bigint-1.0.4.tgz", - "integrity": "sha512-ydHooXLbOmxBbubnA7Eh+RpBzuaIiQjh8WGJYQB50JFGFrdxW7JzVlyEV7fAXw0T2sqJ1ysTneJbiyNLqZRAag==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "20.11.25", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", - "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@types/stack-utils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", - "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/yargs": { - "version": "17.0.35", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz", - "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/yargs-parser": "*" - } - }, - "node_modules/@types/yargs-parser": { - "version": "21.0.3", - "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", - "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", - "dev": true, - "license": "MIT" - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "license": "ISC", - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "license": "MIT", - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/babel-jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", - "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/transform": "^29.7.0", - "@types/babel__core": "^7.1.14", - "babel-plugin-istanbul": "^6.1.1", - "babel-preset-jest": "^29.6.3", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.8.0" - } - }, - "node_modules/babel-plugin-istanbul": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", - "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/helper-plugin-utils": "^7.0.0", - "@istanbuljs/load-nyc-config": "^1.0.0", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-instrument": "^5.0.4", - "test-exclude": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", - "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/core": "^7.12.3", - "@babel/parser": "^7.14.7", - "@istanbuljs/schema": "^0.1.2", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^6.3.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/babel-plugin-jest-hoist": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", - "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/template": "^7.3.3", - "@babel/types": "^7.3.3", - "@types/babel__core": "^7.1.14", - "@types/babel__traverse": "^7.0.6" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/babel-preset-current-node-syntax": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz", - "integrity": "sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/plugin-syntax-async-generators": "^7.8.4", - "@babel/plugin-syntax-bigint": "^7.8.3", - "@babel/plugin-syntax-class-properties": "^7.12.13", - "@babel/plugin-syntax-class-static-block": "^7.14.5", - "@babel/plugin-syntax-import-attributes": "^7.24.7", - "@babel/plugin-syntax-import-meta": "^7.10.4", - "@babel/plugin-syntax-json-strings": "^7.8.3", - "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", - "@babel/plugin-syntax-numeric-separator": "^7.10.4", - "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", - "@babel/plugin-syntax-optional-chaining": "^7.8.3", - "@babel/plugin-syntax-private-property-in-object": "^7.14.5", - "@babel/plugin-syntax-top-level-await": "^7.14.5" - }, - "peerDependencies": { - "@babel/core": "^7.0.0 || ^8.0.0-0" - } - }, - "node_modules/babel-preset-jest": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", - "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", - "dev": true, - "license": "MIT", - "dependencies": { - "babel-plugin-jest-hoist": "^29.6.3", - "babel-preset-current-node-syntax": "^1.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/baseline-browser-mapping": { - "version": "2.10.12", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.12.tgz", - "integrity": "sha512-qyq26DxfY4awP2gIRXhhLWfwzwI+N5Nxk6iQi8EFizIaWIjqicQTE4sLnZZVdeKPRcVNoJOkkpfzoIYuvCKaIQ==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "baseline-browser-mapping": "dist/cli.cjs" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/bignumber.js": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", - "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", - "license": "MIT", - "engines": { - "node": "*" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", - "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", - "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", - "dev": true, - "license": "MIT", - "dependencies": { - "fill-range": "^7.1.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/browserslist": { - "version": "4.28.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", - "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "baseline-browser-mapping": "^2.10.12", - "caniuse-lite": "^1.0.30001782", - "electron-to-chromium": "^1.5.328", - "node-releases": "^2.0.36", - "update-browserslist-db": "^1.2.3" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, - "node_modules/bser": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", - "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "node-int64": "^0.4.0" - } - }, - "node_modules/buffer-from": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", - "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/bundle-require": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", - "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", - "dev": true, - "license": "MIT", - "dependencies": { - "load-tsconfig": "^0.2.3" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "peerDependencies": { - "esbuild": ">=0.18" - } - }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/caniuse-lite": { - "version": "1.0.30001782", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001782.tgz", - "integrity": "sha512-dZcaJLJeDMh4rELYFw1tvSn1bhZWYFOt468FcbHHxx/Z/dFidd1I6ciyFdi3iwfQCyOjqo9upF6lGQYtMiJWxw==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "CC-BY-4.0" - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/char-regex": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", - "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "dev": true, - "license": "MIT", - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/ci-info": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", - "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/sibiraj-s" - } - ], - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/cjs-module-lexer": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz", - "integrity": "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/co": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", - "dev": true, - "license": "MIT", - "engines": { - "iojs": ">= 1.0.0", - "node": ">= 0.12.0" - } - }, - "node_modules/collect-v8-coverage": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz", - "integrity": "sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw==", - "dev": true, - "license": "MIT" - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/commander": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", - "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true, - "license": "MIT" - }, - "node_modules/confbox": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", - "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", - "dev": true, - "license": "MIT" - }, - "node_modules/consola": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", - "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.18.0 || >=16.10.0" - } - }, - "node_modules/convert-source-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", - "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true, - "license": "MIT" - }, - "node_modules/create-jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", - "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "exit": "^0.1.2", - "graceful-fs": "^4.2.9", - "jest-config": "^29.7.0", - "jest-util": "^29.7.0", - "prompts": "^2.0.1" - }, - "bin": { - "create-jest": "bin/create-jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/dedent": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.2.tgz", - "integrity": "sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "babel-plugin-macros": "^3.1.0" - }, - "peerDependenciesMeta": { - "babel-plugin-macros": { - "optional": true - } - } - }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/detect-newline": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", - "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/diff-sequences": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", - "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/electron-to-chromium": { - "version": "1.5.329", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.329.tgz", - "integrity": "sha512-/4t+AS1l4S3ZC0Ja7PHFIWeBIxGA3QGqV8/yKsP36v7NcyUCl+bIcmw6s5zVuMIECWwBrAK/6QLzTmbJChBboQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/emittery": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", - "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sindresorhus/emittery?sponsor=1" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/error-ex": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", - "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, - "node_modules/esbuild": { - "version": "0.27.7", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", - "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.7", - "@esbuild/android-arm": "0.27.7", - "@esbuild/android-arm64": "0.27.7", - "@esbuild/android-x64": "0.27.7", - "@esbuild/darwin-arm64": "0.27.7", - "@esbuild/darwin-x64": "0.27.7", - "@esbuild/freebsd-arm64": "0.27.7", - "@esbuild/freebsd-x64": "0.27.7", - "@esbuild/linux-arm": "0.27.7", - "@esbuild/linux-arm64": "0.27.7", - "@esbuild/linux-ia32": "0.27.7", - "@esbuild/linux-loong64": "0.27.7", - "@esbuild/linux-mips64el": "0.27.7", - "@esbuild/linux-ppc64": "0.27.7", - "@esbuild/linux-riscv64": "0.27.7", - "@esbuild/linux-s390x": "0.27.7", - "@esbuild/linux-x64": "0.27.7", - "@esbuild/netbsd-arm64": "0.27.7", - "@esbuild/netbsd-x64": "0.27.7", - "@esbuild/openbsd-arm64": "0.27.7", - "@esbuild/openbsd-x64": "0.27.7", - "@esbuild/openharmony-arm64": "0.27.7", - "@esbuild/sunos-x64": "0.27.7", - "@esbuild/win32-arm64": "0.27.7", - "@esbuild/win32-ia32": "0.27.7", - "@esbuild/win32-x64": "0.27.7" - } - }, - "node_modules/esbuild-plugin-file-path-extensions": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/esbuild-plugin-file-path-extensions/-/esbuild-plugin-file-path-extensions-2.1.4.tgz", - "integrity": "sha512-lNjylaAsJMprYg28zjUyBivP3y0ms9b7RJZ5tdhDUFLa3sCbqZw4wDnbFUSmnyZYWhCYDPxxp7KkXM2TXGw3PQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=v14.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", - "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/execa": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", - "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cross-spawn": "^7.0.3", - "get-stream": "^6.0.0", - "human-signals": "^2.1.0", - "is-stream": "^2.0.0", - "merge-stream": "^2.0.0", - "npm-run-path": "^4.0.1", - "onetime": "^5.1.2", - "signal-exit": "^3.0.3", - "strip-final-newline": "^2.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sindresorhus/execa?sponsor=1" - } - }, - "node_modules/exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/expect": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", - "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/expect-utils": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/fb-watchman": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", - "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "bser": "2.1.1" - } - }, - "node_modules/fill-range": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", - "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", - "dev": true, - "license": "MIT", - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/fix-dts-default-cjs-exports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", - "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "magic-string": "^0.30.17", - "mlly": "^1.7.4", - "rollup": "^4.34.8" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, - "license": "ISC" - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/gensync": { - "version": "1.0.0-beta.2", - "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", - "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-package-type": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", - "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/get-stream": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", - "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", - "dev": true, - "license": "ISC", - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true, - "license": "MIT" - }, - "node_modules/human-signals": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", - "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=10.17.0" - } - }, - "node_modules/import-local": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", - "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", - "dev": true, - "license": "MIT", - "dependencies": { - "pkg-dir": "^4.2.0", - "resolve-cwd": "^3.0.0" - }, - "bin": { - "import-local-fixture": "fixtures/cli.js" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.19" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "dev": true, - "license": "ISC", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true, - "license": "MIT" - }, - "node_modules/is-core-module": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", - "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", - "dev": true, - "license": "MIT", - "dependencies": { - "hasown": "^2.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-generator-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", - "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-stream": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", - "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", - "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-instrument": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", - "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@babel/core": "^7.23.9", - "@babel/parser": "^7.23.9", - "@istanbuljs/schema": "^0.1.3", - "istanbul-lib-coverage": "^3.2.0", - "semver": "^7.5.4" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-instrument/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", - "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^4.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", - "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0", - "source-map": "^0.6.1" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", - "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jest": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", - "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/core": "^29.7.0", - "@jest/types": "^29.6.3", - "import-local": "^3.0.2", - "jest-cli": "^29.7.0" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-changed-files": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", - "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", - "dev": true, - "license": "MIT", - "dependencies": { - "execa": "^5.0.0", - "jest-util": "^29.7.0", - "p-limit": "^3.1.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-circus": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", - "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/expect": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "co": "^4.6.0", - "dedent": "^1.0.0", - "is-generator-fn": "^2.0.0", - "jest-each": "^29.7.0", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", - "p-limit": "^3.1.0", - "pretty-format": "^29.7.0", - "pure-rand": "^6.0.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-cli": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", - "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/core": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "create-jest": "^29.7.0", - "exit": "^0.1.2", - "import-local": "^3.0.2", - "jest-config": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "yargs": "^17.3.1" - }, - "bin": { - "jest": "bin/jest.js" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" - }, - "peerDependenciesMeta": { - "node-notifier": { - "optional": true - } - } - }, - "node_modules/jest-config": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", - "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@jest/test-sequencer": "^29.7.0", - "@jest/types": "^29.6.3", - "babel-jest": "^29.7.0", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "deepmerge": "^4.2.2", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-circus": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-runner": "^29.7.0", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "micromatch": "^4.0.4", - "parse-json": "^5.2.0", - "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "strip-json-comments": "^3.1.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "peerDependencies": { - "@types/node": "*", - "ts-node": ">=9.0.0" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "ts-node": { - "optional": true - } - } - }, - "node_modules/jest-diff": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", - "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.6.3", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-docblock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", - "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "detect-newline": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-each": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", - "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "chalk": "^4.0.0", - "jest-get-type": "^29.6.3", - "jest-util": "^29.7.0", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-environment-node": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", - "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/fake-timers": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "jest-mock": "^29.7.0", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-get-type": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", - "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-haste-map": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", - "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/graceful-fs": "^4.1.3", - "@types/node": "*", - "anymatch": "^3.0.3", - "fb-watchman": "^2.0.0", - "graceful-fs": "^4.2.9", - "jest-regex-util": "^29.6.3", - "jest-util": "^29.7.0", - "jest-worker": "^29.7.0", - "micromatch": "^4.0.4", - "walker": "^1.0.8" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - }, - "optionalDependencies": { - "fsevents": "^2.3.2" - } - }, - "node_modules/jest-leak-detector": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", - "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-matcher-utils": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", - "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "jest-diff": "^29.7.0", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-message-util": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", - "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.12.13", - "@jest/types": "^29.6.3", - "@types/stack-utils": "^2.0.0", - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "micromatch": "^4.0.4", - "pretty-format": "^29.7.0", - "slash": "^3.0.0", - "stack-utils": "^2.0.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-mock": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", - "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "jest-util": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-pnp-resolver": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", - "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jest-resolve": "*" - }, - "peerDependenciesMeta": { - "jest-resolve": { - "optional": true - } - } - }, - "node_modules/jest-regex-util": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", - "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", - "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.0.0", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-pnp-resolver": "^1.2.2", - "jest-util": "^29.7.0", - "jest-validate": "^29.7.0", - "resolve": "^1.20.0", - "resolve.exports": "^2.0.0", - "slash": "^3.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-resolve-dependencies": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", - "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", - "dev": true, - "license": "MIT", - "dependencies": { - "jest-regex-util": "^29.6.3", - "jest-snapshot": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runner": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", - "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/console": "^29.7.0", - "@jest/environment": "^29.7.0", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "graceful-fs": "^4.2.9", - "jest-docblock": "^29.7.0", - "jest-environment-node": "^29.7.0", - "jest-haste-map": "^29.7.0", - "jest-leak-detector": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-resolve": "^29.7.0", - "jest-runtime": "^29.7.0", - "jest-util": "^29.7.0", - "jest-watcher": "^29.7.0", - "jest-worker": "^29.7.0", - "p-limit": "^3.1.0", - "source-map-support": "0.5.13" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-runtime": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", - "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/environment": "^29.7.0", - "@jest/fake-timers": "^29.7.0", - "@jest/globals": "^29.7.0", - "@jest/source-map": "^29.6.3", - "@jest/test-result": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "cjs-module-lexer": "^1.0.0", - "collect-v8-coverage": "^1.0.0", - "glob": "^7.1.3", - "graceful-fs": "^4.2.9", - "jest-haste-map": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-mock": "^29.7.0", - "jest-regex-util": "^29.6.3", - "jest-resolve": "^29.7.0", - "jest-snapshot": "^29.7.0", - "jest-util": "^29.7.0", - "slash": "^3.0.0", - "strip-bom": "^4.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-snapshot": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", - "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/core": "^7.11.6", - "@babel/generator": "^7.7.2", - "@babel/plugin-syntax-jsx": "^7.7.2", - "@babel/plugin-syntax-typescript": "^7.7.2", - "@babel/types": "^7.3.3", - "@jest/expect-utils": "^29.7.0", - "@jest/transform": "^29.7.0", - "@jest/types": "^29.6.3", - "babel-preset-current-node-syntax": "^1.0.0", - "chalk": "^4.0.0", - "expect": "^29.7.0", - "graceful-fs": "^4.2.9", - "jest-diff": "^29.7.0", - "jest-get-type": "^29.6.3", - "jest-matcher-utils": "^29.7.0", - "jest-message-util": "^29.7.0", - "jest-util": "^29.7.0", - "natural-compare": "^1.4.0", - "pretty-format": "^29.7.0", - "semver": "^7.5.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-snapshot/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/jest-util": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", - "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "@types/node": "*", - "chalk": "^4.0.0", - "ci-info": "^3.2.0", - "graceful-fs": "^4.2.9", - "picomatch": "^2.2.3" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-validate": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", - "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/types": "^29.6.3", - "camelcase": "^6.2.0", - "chalk": "^4.0.0", - "jest-get-type": "^29.6.3", - "leven": "^3.1.0", - "pretty-format": "^29.7.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-validate/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/jest-watcher": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", - "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/test-result": "^29.7.0", - "@jest/types": "^29.6.3", - "@types/node": "*", - "ansi-escapes": "^4.2.1", - "chalk": "^4.0.0", - "emittery": "^0.13.1", - "jest-util": "^29.7.0", - "string-length": "^4.0.1" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-worker": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", - "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*", - "jest-util": "^29.7.0", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/joycon": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", - "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "3.14.2", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", - "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/jsesc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", - "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", - "dev": true, - "license": "MIT", - "bin": { - "jsesc": "bin/jsesc" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/json-bigint": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", - "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", - "license": "MIT", - "dependencies": { - "bignumber.js": "^9.0.0" - } - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true, - "license": "MIT" - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "license": "MIT", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/lilconfig": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", - "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/antonk52" - } - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true, - "license": "MIT" - }, - "node_modules/load-tsconfig": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", - "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "license": "ISC", - "dependencies": { - "yallist": "^3.0.2" - } - }, - "node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/make-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", - "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", - "dev": true, - "license": "MIT", - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/make-dir/node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/makeerror": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", - "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "tmpl": "1.0.5" - } - }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true, - "license": "MIT" - }, - "node_modules/micromatch": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", - "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", - "dev": true, - "license": "MIT", - "dependencies": { - "braces": "^3.0.3", - "picomatch": "^2.3.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/minimatch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", - "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mlly": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz", - "integrity": "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==", - "dev": true, - "license": "MIT", - "dependencies": { - "acorn": "^8.16.0", - "pathe": "^2.0.3", - "pkg-types": "^1.3.1", - "ufo": "^1.6.3" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/mz": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", - "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "any-promise": "^1.0.0", - "object-assign": "^4.0.1", - "thenify-all": "^1.0.0" - } - }, - "node_modules/natural-compare": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-fetch-native-with-agent": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/node-fetch-native-with-agent/-/node-fetch-native-with-agent-1.7.2.tgz", - "integrity": "sha512-5MaOOCuJEvcckoz7/tjdx1M6OusOY6Xc5f459IaruGStWnKzlI1qpNgaAwmn4LmFYcsSlj+jBMk84wmmRxfk5g==", - "license": "MIT" - }, - "node_modules/node-int64": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", - "dev": true, - "license": "MIT" - }, - "node_modules/node-releases": { - "version": "2.0.36", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.36.tgz", - "integrity": "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==", - "dev": true, - "license": "MIT" - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/npm-run-path": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", - "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "license": "MIT", - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-locate/node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true, - "license": "MIT" - }, - "node_modules/pathe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", - "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", - "dev": true, - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", - "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/pirates": { - "version": "4.0.7", - "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", - "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 6" - } - }, - "node_modules/pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "find-up": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/pkg-types": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", - "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "confbox": "^0.1.8", - "mlly": "^1.7.4", - "pathe": "^2.0.1" - } - }, - "node_modules/postcss-load-config": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", - "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "lilconfig": "^3.1.1" - }, - "engines": { - "node": ">= 18" - }, - "peerDependencies": { - "jiti": ">=1.21.0", - "postcss": ">=8.0.9", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "jiti": { - "optional": true - }, - "postcss": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/pretty-format": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", - "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jest/schemas": "^29.6.3", - "ansi-styles": "^5.0.0", - "react-is": "^18.0.0" - }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, - "node_modules/pretty-format/node_modules/ansi-styles": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", - "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/pure-rand": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", - "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ], - "license": "MIT" - }, - "node_modules/react-is": { - "version": "18.3.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", - "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", - "dev": true, - "license": "MIT" - }, - "node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.11", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", - "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-core-module": "^2.16.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/resolve-cwd": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", - "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "resolve-from": "^5.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/resolve.exports": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", - "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - } - }, - "node_modules/rollup": { - "version": "4.60.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz", - "integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.60.1", - "@rollup/rollup-android-arm64": "4.60.1", - "@rollup/rollup-darwin-arm64": "4.60.1", - "@rollup/rollup-darwin-x64": "4.60.1", - "@rollup/rollup-freebsd-arm64": "4.60.1", - "@rollup/rollup-freebsd-x64": "4.60.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.60.1", - "@rollup/rollup-linux-arm-musleabihf": "4.60.1", - "@rollup/rollup-linux-arm64-gnu": "4.60.1", - "@rollup/rollup-linux-arm64-musl": "4.60.1", - "@rollup/rollup-linux-loong64-gnu": "4.60.1", - "@rollup/rollup-linux-loong64-musl": "4.60.1", - "@rollup/rollup-linux-ppc64-gnu": "4.60.1", - "@rollup/rollup-linux-ppc64-musl": "4.60.1", - "@rollup/rollup-linux-riscv64-gnu": "4.60.1", - "@rollup/rollup-linux-riscv64-musl": "4.60.1", - "@rollup/rollup-linux-s390x-gnu": "4.60.1", - "@rollup/rollup-linux-x64-gnu": "4.60.1", - "@rollup/rollup-linux-x64-musl": "4.60.1", - "@rollup/rollup-openbsd-x64": "4.60.1", - "@rollup/rollup-openharmony-arm64": "4.60.1", - "@rollup/rollup-win32-arm64-msvc": "4.60.1", - "@rollup/rollup-win32-ia32-msvc": "4.60.1", - "@rollup/rollup-win32-x64-gnu": "4.60.1", - "@rollup/rollup-win32-x64-msvc": "4.60.1", - "fsevents": "~2.3.2" - } - }, - "node_modules/semver": { - "version": "6.3.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", - "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true, - "license": "MIT" - }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-support": { - "version": "0.5.13", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", - "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", - "dev": true, - "license": "MIT", - "dependencies": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/stack-utils": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", - "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "escape-string-regexp": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/string-length": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", - "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "char-regex": "^1.0.2", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-final-newline": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", - "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/sucrase": { - "version": "3.35.1", - "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", - "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.2", - "commander": "^4.0.0", - "lines-and-columns": "^1.1.6", - "mz": "^2.7.0", - "pirates": "^4.0.1", - "tinyglobby": "^0.2.11", - "ts-interface-checker": "^0.1.9" - }, - "bin": { - "sucrase": "bin/sucrase", - "sucrase-node": "bin/sucrase-node" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/test-exclude": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", - "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", - "dev": true, - "license": "ISC", - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^7.1.4", - "minimatch": "^3.0.4" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/thenify": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", - "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", - "dev": true, - "license": "MIT", - "dependencies": { - "any-promise": "^1.0.0" - } - }, - "node_modules/thenify-all": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", - "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", - "dev": true, - "license": "MIT", - "dependencies": { - "thenify": ">= 3.1.0 < 4" - }, - "engines": { - "node": ">=0.8" - } - }, - "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.3" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/tmpl": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", - "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", - "dev": true, - "license": "BSD-3-Clause" - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tree-kill": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", - "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", - "dev": true, - "license": "MIT", - "bin": { - "tree-kill": "cli.js" - } - }, - "node_modules/ts-interface-checker": { - "version": "0.1.13", - "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", - "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true, - "license": "0BSD" - }, - "node_modules/tsup": { - "version": "8.5.1", - "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.1.tgz", - "integrity": "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==", - "dev": true, - "license": "MIT", - "dependencies": { - "bundle-require": "^5.1.0", - "cac": "^6.7.14", - "chokidar": "^4.0.3", - "consola": "^3.4.0", - "debug": "^4.4.0", - "esbuild": "^0.27.0", - "fix-dts-default-cjs-exports": "^1.0.0", - "joycon": "^3.1.1", - "picocolors": "^1.1.1", - "postcss-load-config": "^6.0.1", - "resolve-from": "^5.0.0", - "rollup": "^4.34.8", - "source-map": "^0.7.6", - "sucrase": "^3.35.0", - "tinyexec": "^0.3.2", - "tinyglobby": "^0.2.11", - "tree-kill": "^1.2.2" - }, - "bin": { - "tsup": "dist/cli-default.js", - "tsup-node": "dist/cli-node.js" - }, - "engines": { - "node": ">=18" - }, - "peerDependencies": { - "@microsoft/api-extractor": "^7.36.0", - "@swc/core": "^1", - "postcss": "^8.4.12", - "typescript": ">=4.5.0" - }, - "peerDependenciesMeta": { - "@microsoft/api-extractor": { - "optional": true - }, - "@swc/core": { - "optional": true - }, - "postcss": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/tsup/node_modules/source-map": { - "version": "0.7.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", - "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 12" - } - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "license": "(MIT OR CC0-1.0)", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/typescript": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", - "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/ufo": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", - "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true, - "license": "MIT" - }, - "node_modules/update-browserslist-db": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", - "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "escalade": "^3.2.0", - "picocolors": "^1.1.1" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, - "node_modules/v8-to-istanbul": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", - "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", - "dev": true, - "license": "ISC", - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.12", - "@types/istanbul-lib-coverage": "^2.0.1", - "convert-source-map": "^2.0.0" - }, - "engines": { - "node": ">=10.12.0" - } - }, - "node_modules/walker": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", - "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "makeerror": "1.0.12" - } - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/write-file-atomic": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", - "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", - "dev": true, - "license": "ISC", - "dependencies": { - "imurmurhash": "^0.1.4", - "signal-exit": "^3.0.7" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true, - "license": "ISC" - }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 6b06e984..00000000 --- a/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "node-appwrite", - "homepage": "https://appwrite.io/support", - "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "25.1.0", - "license": "BSD-3-Clause", - "main": "dist/index.js", - "type": "commonjs", - "scripts": { - "build": "tsup", - "test": "jest" - }, - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - } - }, - "./file": { - "import": { - "types": "./dist/inputFile.d.mts", - "default": "./dist/inputFile.mjs" - }, - "require": { - "types": "./dist/inputFile.d.ts", - "default": "./dist/inputFile.js" - } - } - }, - "files": [ - "dist" - ], - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/appwrite/sdk-for-node" - }, - "devDependencies": { - "@types/json-bigint": "1.0.4", - "@types/node": "20.11.25", - "tsup": "^8.5.1", - "esbuild-plugin-file-path-extensions": "^2.0.0", - "tslib": "2.6.2", - "typescript": "5.4.2", - "jest": "^29.7.0" - }, - "dependencies": { - "json-bigint": "1.0.0", - "node-fetch-native-with-agent": "1.7.2" - } -} diff --git a/src/client.ts b/src/client.ts deleted file mode 100644 index 37bb016a..00000000 --- a/src/client.ts +++ /dev/null @@ -1,573 +0,0 @@ -import { fetch, FormData, File } from 'node-fetch-native-with-agent'; -import { createAgent } from 'node-fetch-native-with-agent/agent'; -import { Models } from './models'; -import { InputFile } from './inputFile'; -import JSONbigModule from 'json-bigint'; -const JSONbigParser = JSONbigModule({ storeAsString: false }); -const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true }); - -const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER); -const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER); -const MAX_INT64 = BigInt('9223372036854775807'); -const MIN_INT64 = BigInt('-9223372036854775808'); - -function isBigNumber(value: any): boolean { - return value !== null - && typeof value === 'object' - && value._isBigNumber === true - && typeof value.isInteger === 'function' - && typeof value.toFixed === 'function' - && typeof value.toNumber === 'function'; -} - -function reviver(_key: string, value: any): any { - if (isBigNumber(value)) { - if (value.isInteger()) { - const str = value.toFixed(); - const bi = BigInt(str); - if (bi >= MIN_SAFE && bi <= MAX_SAFE) { - return Number(str); - } - if (bi >= MIN_INT64 && bi <= MAX_INT64) { - return bi; - } - return value.toNumber(); - } - return value.toNumber(); - } - return value; -} - -const JSONbig = { - parse: (text: string) => JSONbigParser.parse(text, reviver), - stringify: JSONbigSerializer.stringify -}; - -type Payload = { - [key: string]: any; -} - -type UploadProgress = { - $id: string; - progress: number; - sizeUploaded: number; - chunksTotal: number; - chunksUploaded: number; -} - -type Headers = { - [key: string]: string; -} - -class AppwriteException extends Error { - code: number; - response: string; - type: string; - constructor(message: string, code: number = 0, type: string = '', response: string = '') { - super(message); - this.name = 'AppwriteException'; - this.message = message; - this.code = code; - this.type = type; - this.response = response; - } -} - -function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/25.1.0'; - - // `process` is a global in Node.js, but not fully available in all runtimes. - const platform: string[] = []; - if (typeof process !== 'undefined') { - if (typeof process.platform === 'string') platform.push(process.platform); - if (typeof process.arch === 'string') platform.push(process.arch); - } - if (platform.length > 0) { - ua += ` (${platform.join('; ')})`; - } - - // `navigator.userAgent` is available in Node.js 21 and later. - // It's also part of the WinterCG spec, so many edge runtimes provide it. - // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent - // @ts-ignore - if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') { - // @ts-ignore - ua += ` ${navigator.userAgent}`; - - // @ts-ignore - } else if (typeof globalThis.EdgeRuntime === 'string') { - ua += ` EdgeRuntime`; - - // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`. - } else if (typeof process !== 'undefined' && typeof process.version === 'string') { - ua += ` Node.js/${process.version}`; - } - - return ua; -} - -class Client { - static CHUNK_SIZE = 1024 * 1024 * 5; - - config = { - endpoint: 'https://cloud.appwrite.io/v1', - selfSigned: false, - project: '', - key: '', - jwt: '', - locale: '', - session: '', - forwardeduseragent: '', - devkey: '', - cookie: '', - impersonateuserid: '', - impersonateuseremail: '', - impersonateuserphone: '', - }; - headers: Headers = { - 'x-sdk-name': 'Node.js', - 'x-sdk-platform': 'server', - 'x-sdk-language': 'nodejs', - 'x-sdk-version': '25.1.0', - 'user-agent' : getUserAgent(), - 'X-Appwrite-Response-Format': '1.9.5', - }; - - /** - * Set Endpoint - * - * Your project endpoint - * - * @param {string} endpoint - * - * @returns {this} - */ - setEndpoint(endpoint: string): this { - if (!endpoint || typeof endpoint !== 'string') { - throw new AppwriteException('Endpoint must be a valid string'); - } - - if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) { - throw new AppwriteException('Invalid endpoint URL: ' + endpoint); - } - - this.config.endpoint = endpoint; - return this; - } - - /** - * Set self-signed - * - * @param {boolean} selfSigned - * - * @returns {this} - */ - setSelfSigned(selfSigned: boolean): this { - // @ts-ignore - if (typeof globalThis.EdgeRuntime !== 'undefined') { - console.warn('setSelfSigned is not supported in edge runtimes.'); - } - - this.config.selfSigned = selfSigned; - - return this; - } - - /** - * Add header - * - * @param {string} header - * @param {string} value - * - * @returns {this} - */ - addHeader(header: string, value: string): this { - this.headers[header.toLowerCase()] = value; - - return this; - } - - /** - * Get Headers - * - * Returns a copy of the current request headers, including any - * authentication headers. Handle with care. - * - * @returns {Headers} - */ - getHeaders(): Headers { - return { ...this.headers }; - } - - /** - * Set Project - * - * Your project ID - * - * @param value string - * - * @return {this} - */ - setProject(value: string): this { - this.headers['X-Appwrite-Project'] = value; - this.config.project = value; - return this; - } - /** - * Set Key - * - * Your secret API key - * - * @param value string - * - * @return {this} - */ - setKey(value: string): this { - this.headers['X-Appwrite-Key'] = value; - this.config.key = value; - return this; - } - /** - * Set JWT - * - * Your secret JSON Web Token - * - * @param value string - * - * @return {this} - */ - setJWT(value: string): this { - this.headers['X-Appwrite-JWT'] = value; - this.config.jwt = value; - return this; - } - /** - * Set Locale - * - * @param value string - * - * @return {this} - */ - setLocale(value: string): this { - this.headers['X-Appwrite-Locale'] = value; - this.config.locale = value; - return this; - } - /** - * Set Session - * - * The user session to authenticate with - * - * @param value string - * - * @return {this} - */ - setSession(value: string): this { - this.headers['X-Appwrite-Session'] = value; - this.config.session = value; - return this; - } - /** - * Set ForwardedUserAgent - * - * The user agent string of the client that made the request - * - * @param value string - * - * @return {this} - */ - setForwardedUserAgent(value: string): this { - this.headers['X-Forwarded-User-Agent'] = value; - this.config.forwardeduseragent = value; - return this; - } - /** - * Set DevKey - * - * Your secret dev API key - * - * @param value string - * - * @return {this} - */ - setDevKey(value: string): this { - this.headers['X-Appwrite-Dev-Key'] = value; - this.config.devkey = value; - return this; - } - /** - * Set Cookie - * - * The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. - * - * @param value string - * - * @return {this} - */ - setCookie(value: string): this { - this.headers['Cookie'] = value; - this.config.cookie = value; - return this; - } - /** - * Set ImpersonateUserId - * - * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - * - * @param value string - * - * @return {this} - */ - setImpersonateUserId(value: string): this { - this.headers['X-Appwrite-Impersonate-User-Id'] = value; - this.config.impersonateuserid = value; - return this; - } - /** - * Set ImpersonateUserEmail - * - * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - * - * @param value string - * - * @return {this} - */ - setImpersonateUserEmail(value: string): this { - this.headers['X-Appwrite-Impersonate-User-Email'] = value; - this.config.impersonateuseremail = value; - return this; - } - /** - * Set ImpersonateUserPhone - * - * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. - * - * @param value string - * - * @return {this} - */ - setImpersonateUserPhone(value: string): this { - this.headers['X-Appwrite-Impersonate-User-Phone'] = value; - this.config.impersonateuserphone = value; - return this; - } - - prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } { - method = method.toUpperCase(); - - headers = Object.assign({}, this.headers, headers); - - let options: RequestInit = { - method, - headers, - ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }), - }; - - if (method === 'GET') { - for (const [key, value] of Object.entries(Client.flatten(params))) { - url.searchParams.append(key, value); - } - } else { - switch (headers['content-type']) { - case 'application/json': - options.body = JSONbig.stringify(params); - break; - - case 'multipart/form-data': - const formData = new FormData(); - - for (const [key, value] of Object.entries(params)) { - if (value instanceof File) { - formData.append(key, value, value.name); - } else if (Array.isArray(value)) { - for (const nestedValue of value) { - formData.append(`${key}[]`, nestedValue); - } - } else { - formData.append(key, value); - } - } - - options.body = formData; - delete headers['content-type']; - break; - } - } - - return { uri: url.toString(), options }; - } - - async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) { - const [fileParam, file] = Object.entries(originalPayload).find( - ([_, value]) => value instanceof File || value instanceof InputFile - ) ?? []; - - if (!file || !fileParam) { - throw new Error('File not found in payload'); - } - - if (file instanceof InputFile) { - const size = await file.size(); - - if (size <= Client.CHUNK_SIZE) { - const payload = { ...originalPayload }; - payload[fileParam] = await file.toFile(); - return await this.call(method, url, headers, payload); - } - - let start = 0; - let response = null; - - while (start < size) { - let end = start + Client.CHUNK_SIZE; - if (end >= size) { - end = size; - } - - headers['content-range'] = `bytes ${start}-${end - 1}/${size}`; - const chunk = await file.slice(start, end); - - const payload = { ...originalPayload }; - payload[fileParam] = new File([chunk], file.filename); - - response = await this.call(method, url, headers, payload); - - if (onProgress && typeof onProgress === 'function') { - onProgress({ - $id: response.$id, - progress: Math.round((end / size) * 100), - sizeUploaded: end, - chunksTotal: Math.ceil(size / Client.CHUNK_SIZE), - chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) - }); - } - - if (response && response.$id) { - headers['x-appwrite-id'] = response.$id; - } - - start = end; - } - - return response; - } - - if (file.size <= Client.CHUNK_SIZE) { - return await this.call(method, url, headers, originalPayload); - } - - let start = 0; - let response = null; - - while (start < file.size) { - let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk - if (end >= file.size) { - end = file.size; // Adjust for the last chunk to include the last byte - } - - headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`; - const chunk = file.slice(start, end); - - let payload = { ...originalPayload }; - payload[fileParam] = new File([chunk], file.name); - - response = await this.call(method, url, headers, payload); - - if (onProgress && typeof onProgress === 'function') { - onProgress({ - $id: response.$id, - progress: Math.round((end / file.size) * 100), - sizeUploaded: end, - chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE), - chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) - }); - } - - if (response && response.$id) { - headers['x-appwrite-id'] = response.$id; - } - - start = end; - } - - return response; - } - - async ping(): Promise<string> { - return this.call('GET', new URL(this.config.endpoint + '/ping')); - } - - async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> { - const { uri, options } = this.prepareRequest(method, url, headers, params); - - const response = await fetch(uri, { - ...options, - redirect: 'manual' - }); - - if (response.status !== 301 && response.status !== 302) { - throw new AppwriteException('Invalid redirect', response.status); - } - - return response.headers.get('location') || ''; - } - - async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> { - const { uri, options } = this.prepareRequest(method, url, headers, params); - - let data: any = null; - - const response = await fetch(uri, options); - - const warnings = response.headers.get('x-appwrite-warning'); - if (warnings) { - warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning)); - } - - if (response.headers.get('content-type')?.includes('application/json')) { - data = JSONbig.parse(await response.text()); - } else if (responseType === 'arrayBuffer') { - data = await response.arrayBuffer(); - } else { - data = { - message: await response.text() - }; - } - - if (400 <= response.status) { - let responseText = ''; - if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') { - responseText = JSONbig.stringify(data); - } else { - responseText = data?.message; - } - throw new AppwriteException(data?.message, response.status, data?.type, responseText); - } - - if (data && typeof data === 'object') { - data.toString = () => JSONbig.stringify(data); - } - - return data; - } - - static flatten(data: Payload, prefix = ''): Payload { - let output: Payload = {}; - - for (const [key, value] of Object.entries(data)) { - let finalKey = prefix ? prefix + '[' + key +']' : key; - if (Array.isArray(value)) { - output = { ...output, ...Client.flatten(value, finalKey) }; - } else { - output[finalKey] = value; - } - } - - return output; - } -} - -export { Client, AppwriteException }; -export { Query } from './query'; -export type { Models, Payload, UploadProgress }; -export type { QueryTypes, QueryTypesList } from './query'; diff --git a/src/enums/adapter.ts b/src/enums/adapter.ts deleted file mode 100644 index a3b1ae0c..00000000 --- a/src/enums/adapter.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum Adapter { - Static = 'static', - Ssr = 'ssr', -} \ No newline at end of file diff --git a/src/enums/attribute-status.ts b/src/enums/attribute-status.ts deleted file mode 100644 index ade1d36a..00000000 --- a/src/enums/attribute-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum AttributeStatus { - Available = 'available', - Processing = 'processing', - Deleting = 'deleting', - Stuck = 'stuck', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/authentication-factor.ts b/src/enums/authentication-factor.ts deleted file mode 100644 index 928c4074..00000000 --- a/src/enums/authentication-factor.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum AuthenticationFactor { - Email = 'email', - Phone = 'phone', - Totp = 'totp', - Recoverycode = 'recoverycode', -} \ No newline at end of file diff --git a/src/enums/authenticator-type.ts b/src/enums/authenticator-type.ts deleted file mode 100644 index 34db0cca..00000000 --- a/src/enums/authenticator-type.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum AuthenticatorType { - Totp = 'totp', -} \ No newline at end of file diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts deleted file mode 100644 index bd0582ce..00000000 --- a/src/enums/backup-services.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum BackupServices { - Databases = 'databases', - Tablesdb = 'tablesdb', - Documentsdb = 'documentsdb', - Vectorsdb = 'vectorsdb', - Functions = 'functions', - Storage = 'storage', -} \ No newline at end of file diff --git a/src/enums/browser-permission.ts b/src/enums/browser-permission.ts deleted file mode 100644 index 6e2c4cda..00000000 --- a/src/enums/browser-permission.ts +++ /dev/null @@ -1,22 +0,0 @@ -export enum BrowserPermission { - Geolocation = 'geolocation', - Camera = 'camera', - Microphone = 'microphone', - Notifications = 'notifications', - Midi = 'midi', - Push = 'push', - Clipboardread = 'clipboard-read', - Clipboardwrite = 'clipboard-write', - Paymenthandler = 'payment-handler', - Usb = 'usb', - Bluetooth = 'bluetooth', - Accelerometer = 'accelerometer', - Gyroscope = 'gyroscope', - Magnetometer = 'magnetometer', - Ambientlightsensor = 'ambient-light-sensor', - Backgroundsync = 'background-sync', - Persistentstorage = 'persistent-storage', - Screenwakelock = 'screen-wake-lock', - Webshare = 'web-share', - Xrspatialtracking = 'xr-spatial-tracking', -} \ No newline at end of file diff --git a/src/enums/browser.ts b/src/enums/browser.ts deleted file mode 100644 index cec52fb6..00000000 --- a/src/enums/browser.ts +++ /dev/null @@ -1,16 +0,0 @@ -export enum Browser { - AvantBrowser = 'aa', - AndroidWebViewBeta = 'an', - GoogleChrome = 'ch', - GoogleChromeIOS = 'ci', - GoogleChromeMobile = 'cm', - Chromium = 'cr', - MozillaFirefox = 'ff', - Safari = 'sf', - MobileSafari = 'mf', - MicrosoftEdge = 'ps', - MicrosoftEdgeIOS = 'oi', - OperaMini = 'om', - Opera = 'op', - OperaNext = 'on', -} \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts deleted file mode 100644 index dddeeb2b..00000000 --- a/src/enums/build-runtime.ts +++ /dev/null @@ -1,94 +0,0 @@ -export enum BuildRuntime { - Node145 = 'node-14.5', - Node160 = 'node-16.0', - Node180 = 'node-18.0', - Node190 = 'node-19.0', - Node200 = 'node-20.0', - Node210 = 'node-21.0', - Node22 = 'node-22', - Node23 = 'node-23', - Node24 = 'node-24', - Node25 = 'node-25', - Php80 = 'php-8.0', - Php81 = 'php-8.1', - Php82 = 'php-8.2', - Php83 = 'php-8.3', - Php84 = 'php-8.4', - Ruby30 = 'ruby-3.0', - Ruby31 = 'ruby-3.1', - Ruby32 = 'ruby-3.2', - Ruby33 = 'ruby-3.3', - Ruby34 = 'ruby-3.4', - Ruby40 = 'ruby-4.0', - Python38 = 'python-3.8', - Python39 = 'python-3.9', - Python310 = 'python-3.10', - Python311 = 'python-3.11', - Python312 = 'python-3.12', - Python313 = 'python-3.13', - Python314 = 'python-3.14', - Pythonml311 = 'python-ml-3.11', - Pythonml312 = 'python-ml-3.12', - Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', - Deno140 = 'deno-1.40', - Deno146 = 'deno-1.46', - Deno20 = 'deno-2.0', - Deno25 = 'deno-2.5', - Deno26 = 'deno-2.6', - Dart215 = 'dart-2.15', - Dart216 = 'dart-2.16', - Dart217 = 'dart-2.17', - Dart218 = 'dart-2.18', - Dart219 = 'dart-2.19', - Dart30 = 'dart-3.0', - Dart31 = 'dart-3.1', - Dart33 = 'dart-3.3', - Dart35 = 'dart-3.5', - Dart38 = 'dart-3.8', - Dart39 = 'dart-3.9', - Dart310 = 'dart-3.10', - Dart311 = 'dart-3.11', - Dotnet60 = 'dotnet-6.0', - Dotnet70 = 'dotnet-7.0', - Dotnet80 = 'dotnet-8.0', - Dotnet10 = 'dotnet-10', - Java80 = 'java-8.0', - Java110 = 'java-11.0', - Java170 = 'java-17.0', - Java180 = 'java-18.0', - Java210 = 'java-21.0', - Java22 = 'java-22', - Java25 = 'java-25', - Swift55 = 'swift-5.5', - Swift58 = 'swift-5.8', - Swift59 = 'swift-5.9', - Swift510 = 'swift-5.10', - Swift62 = 'swift-6.2', - Kotlin16 = 'kotlin-1.6', - Kotlin18 = 'kotlin-1.8', - Kotlin19 = 'kotlin-1.9', - Kotlin20 = 'kotlin-2.0', - Kotlin23 = 'kotlin-2.3', - Cpp17 = 'cpp-17', - Cpp20 = 'cpp-20', - Bun10 = 'bun-1.0', - Bun11 = 'bun-1.1', - Bun12 = 'bun-1.2', - Bun13 = 'bun-1.3', - Go123 = 'go-1.23', - Go124 = 'go-1.24', - Go125 = 'go-1.25', - Go126 = 'go-1.26', - Rust183 = 'rust-1.83', - Static1 = 'static-1', - Flutter324 = 'flutter-3.24', - Flutter327 = 'flutter-3.27', - Flutter329 = 'flutter-3.29', - Flutter332 = 'flutter-3.32', - Flutter335 = 'flutter-3.35', - Flutter338 = 'flutter-3.38', - Flutter341 = 'flutter-3.41', -} \ No newline at end of file diff --git a/src/enums/column-status.ts b/src/enums/column-status.ts deleted file mode 100644 index f53e8a66..00000000 --- a/src/enums/column-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum ColumnStatus { - Available = 'available', - Processing = 'processing', - Deleting = 'deleting', - Stuck = 'stuck', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/compression.ts b/src/enums/compression.ts deleted file mode 100644 index 1bec0e78..00000000 --- a/src/enums/compression.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum Compression { - None = 'none', - Gzip = 'gzip', - Zstd = 'zstd', -} \ No newline at end of file diff --git a/src/enums/credit-card.ts b/src/enums/credit-card.ts deleted file mode 100644 index e6ce2429..00000000 --- a/src/enums/credit-card.ts +++ /dev/null @@ -1,19 +0,0 @@ -export enum CreditCard { - AmericanExpress = 'amex', - Argencard = 'argencard', - Cabal = 'cabal', - Cencosud = 'cencosud', - DinersClub = 'diners', - Discover = 'discover', - Elo = 'elo', - Hipercard = 'hipercard', - JCB = 'jcb', - Mastercard = 'mastercard', - Naranja = 'naranja', - TarjetaShopping = 'targeta-shopping', - UnionPay = 'unionpay', - Visa = 'visa', - MIR = 'mir', - Maestro = 'maestro', - Rupay = 'rupay', -} \ No newline at end of file diff --git a/src/enums/database-type.ts b/src/enums/database-type.ts deleted file mode 100644 index 8ccd9699..00000000 --- a/src/enums/database-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum DatabaseType { - Legacy = 'legacy', - Tablesdb = 'tablesdb', - Documentsdb = 'documentsdb', - Vectorsdb = 'vectorsdb', -} \ No newline at end of file diff --git a/src/enums/databases-index-type.ts b/src/enums/databases-index-type.ts deleted file mode 100644 index 85ccf867..00000000 --- a/src/enums/databases-index-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum DatabasesIndexType { - Key = 'key', - Fulltext = 'fulltext', - Unique = 'unique', - Spatial = 'spatial', -} \ No newline at end of file diff --git a/src/enums/deployment-download-type.ts b/src/enums/deployment-download-type.ts deleted file mode 100644 index 538709bc..00000000 --- a/src/enums/deployment-download-type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum DeploymentDownloadType { - Source = 'source', - Output = 'output', -} \ No newline at end of file diff --git a/src/enums/deployment-status.ts b/src/enums/deployment-status.ts deleted file mode 100644 index 7e8f4a1b..00000000 --- a/src/enums/deployment-status.ts +++ /dev/null @@ -1,8 +0,0 @@ -export enum DeploymentStatus { - Waiting = 'waiting', - Processing = 'processing', - Building = 'building', - Ready = 'ready', - Canceled = 'canceled', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/execution-method.ts b/src/enums/execution-method.ts deleted file mode 100644 index 39d4c1e8..00000000 --- a/src/enums/execution-method.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum ExecutionMethod { - GET = 'GET', - POST = 'POST', - PUT = 'PUT', - PATCH = 'PATCH', - DELETE = 'DELETE', - OPTIONS = 'OPTIONS', - HEAD = 'HEAD', -} \ No newline at end of file diff --git a/src/enums/execution-status.ts b/src/enums/execution-status.ts deleted file mode 100644 index 992d987d..00000000 --- a/src/enums/execution-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum ExecutionStatus { - Waiting = 'waiting', - Processing = 'processing', - Completed = 'completed', - Failed = 'failed', - Scheduled = 'scheduled', -} \ No newline at end of file diff --git a/src/enums/execution-trigger.ts b/src/enums/execution-trigger.ts deleted file mode 100644 index 1829d514..00000000 --- a/src/enums/execution-trigger.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum ExecutionTrigger { - Http = 'http', - Schedule = 'schedule', - Event = 'event', -} \ No newline at end of file diff --git a/src/enums/flag.ts b/src/enums/flag.ts deleted file mode 100644 index 7e1d8781..00000000 --- a/src/enums/flag.ts +++ /dev/null @@ -1,197 +0,0 @@ -export enum Flag { - Afghanistan = 'af', - Angola = 'ao', - Albania = 'al', - Andorra = 'ad', - UnitedArabEmirates = 'ae', - Argentina = 'ar', - Armenia = 'am', - AntiguaAndBarbuda = 'ag', - Australia = 'au', - Austria = 'at', - Azerbaijan = 'az', - Burundi = 'bi', - Belgium = 'be', - Benin = 'bj', - BurkinaFaso = 'bf', - Bangladesh = 'bd', - Bulgaria = 'bg', - Bahrain = 'bh', - Bahamas = 'bs', - BosniaAndHerzegovina = 'ba', - Belarus = 'by', - Belize = 'bz', - Bolivia = 'bo', - Brazil = 'br', - Barbados = 'bb', - BruneiDarussalam = 'bn', - Bhutan = 'bt', - Botswana = 'bw', - CentralAfricanRepublic = 'cf', - Canada = 'ca', - Switzerland = 'ch', - Chile = 'cl', - China = 'cn', - CoteDIvoire = 'ci', - Cameroon = 'cm', - DemocraticRepublicOfTheCongo = 'cd', - RepublicOfTheCongo = 'cg', - Colombia = 'co', - Comoros = 'km', - CapeVerde = 'cv', - CostaRica = 'cr', - Cuba = 'cu', - Cyprus = 'cy', - CzechRepublic = 'cz', - Germany = 'de', - Djibouti = 'dj', - Dominica = 'dm', - Denmark = 'dk', - DominicanRepublic = 'do', - Algeria = 'dz', - Ecuador = 'ec', - Egypt = 'eg', - Eritrea = 'er', - Spain = 'es', - Estonia = 'ee', - Ethiopia = 'et', - Finland = 'fi', - Fiji = 'fj', - France = 'fr', - MicronesiaFederatedStatesOf = 'fm', - Gabon = 'ga', - UnitedKingdom = 'gb', - Georgia = 'ge', - Ghana = 'gh', - Guinea = 'gn', - Gambia = 'gm', - GuineaBissau = 'gw', - EquatorialGuinea = 'gq', - Greece = 'gr', - Grenada = 'gd', - Guatemala = 'gt', - Guyana = 'gy', - Honduras = 'hn', - Croatia = 'hr', - Haiti = 'ht', - Hungary = 'hu', - Indonesia = 'id', - India = 'in', - Ireland = 'ie', - IranIslamicRepublicOf = 'ir', - Iraq = 'iq', - Iceland = 'is', - Israel = 'il', - Italy = 'it', - Jamaica = 'jm', - Jordan = 'jo', - Japan = 'jp', - Kazakhstan = 'kz', - Kenya = 'ke', - Kyrgyzstan = 'kg', - Cambodia = 'kh', - Kiribati = 'ki', - SaintKittsAndNevis = 'kn', - SouthKorea = 'kr', - Kuwait = 'kw', - LaoPeopleSDemocraticRepublic = 'la', - Lebanon = 'lb', - Liberia = 'lr', - Libya = 'ly', - SaintLucia = 'lc', - Liechtenstein = 'li', - SriLanka = 'lk', - Lesotho = 'ls', - Lithuania = 'lt', - Luxembourg = 'lu', - Latvia = 'lv', - Morocco = 'ma', - Monaco = 'mc', - Moldova = 'md', - Madagascar = 'mg', - Maldives = 'mv', - Mexico = 'mx', - MarshallIslands = 'mh', - NorthMacedonia = 'mk', - Mali = 'ml', - Malta = 'mt', - Myanmar = 'mm', - Montenegro = 'me', - Mongolia = 'mn', - Mozambique = 'mz', - Mauritania = 'mr', - Mauritius = 'mu', - Malawi = 'mw', - Malaysia = 'my', - Namibia = 'na', - Niger = 'ne', - Nigeria = 'ng', - Nicaragua = 'ni', - Netherlands = 'nl', - Norway = 'no', - Nepal = 'np', - Nauru = 'nr', - NewZealand = 'nz', - Oman = 'om', - Pakistan = 'pk', - Panama = 'pa', - Peru = 'pe', - Philippines = 'ph', - Palau = 'pw', - PapuaNewGuinea = 'pg', - Poland = 'pl', - FrenchPolynesia = 'pf', - NorthKorea = 'kp', - Portugal = 'pt', - Paraguay = 'py', - Qatar = 'qa', - Romania = 'ro', - Russia = 'ru', - Rwanda = 'rw', - SaudiArabia = 'sa', - Sudan = 'sd', - Senegal = 'sn', - Singapore = 'sg', - SolomonIslands = 'sb', - SierraLeone = 'sl', - ElSalvador = 'sv', - SanMarino = 'sm', - Somalia = 'so', - Serbia = 'rs', - SouthSudan = 'ss', - SaoTomeAndPrincipe = 'st', - Suriname = 'sr', - Slovakia = 'sk', - Slovenia = 'si', - Sweden = 'se', - Eswatini = 'sz', - Seychelles = 'sc', - Syria = 'sy', - Chad = 'td', - Togo = 'tg', - Thailand = 'th', - Tajikistan = 'tj', - Turkmenistan = 'tm', - TimorLeste = 'tl', - Tonga = 'to', - TrinidadAndTobago = 'tt', - Tunisia = 'tn', - Turkey = 'tr', - Tuvalu = 'tv', - Tanzania = 'tz', - Uganda = 'ug', - Ukraine = 'ua', - Uruguay = 'uy', - UnitedStates = 'us', - Uzbekistan = 'uz', - VaticanCity = 'va', - SaintVincentAndTheGrenadines = 'vc', - Venezuela = 've', - Vietnam = 'vn', - Vanuatu = 'vu', - Samoa = 'ws', - Yemen = 'ye', - SouthAfrica = 'za', - Zambia = 'zm', - Zimbabwe = 'zw', -} \ No newline at end of file diff --git a/src/enums/framework.ts b/src/enums/framework.ts deleted file mode 100644 index 7093da33..00000000 --- a/src/enums/framework.ts +++ /dev/null @@ -1,17 +0,0 @@ -export enum Framework { - Analog = 'analog', - Angular = 'angular', - Nextjs = 'nextjs', - React = 'react', - Nuxt = 'nuxt', - Vue = 'vue', - Sveltekit = 'sveltekit', - Astro = 'astro', - Tanstackstart = 'tanstack-start', - Remix = 'remix', - Lynx = 'lynx', - Flutter = 'flutter', - Reactnative = 'react-native', - Vite = 'vite', - Other = 'other', -} \ No newline at end of file diff --git a/src/enums/health-antivirus-status.ts b/src/enums/health-antivirus-status.ts deleted file mode 100644 index d4da4c4f..00000000 --- a/src/enums/health-antivirus-status.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum HealthAntivirusStatus { - Disabled = 'disabled', - Offline = 'offline', - Online = 'online', -} \ No newline at end of file diff --git a/src/enums/health-check-status.ts b/src/enums/health-check-status.ts deleted file mode 100644 index 9dbc6810..00000000 --- a/src/enums/health-check-status.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum HealthCheckStatus { - Pass = 'pass', - Fail = 'fail', -} \ No newline at end of file diff --git a/src/enums/image-format.ts b/src/enums/image-format.ts deleted file mode 100644 index 758fad74..00000000 --- a/src/enums/image-format.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum ImageFormat { - Jpg = 'jpg', - Jpeg = 'jpeg', - Png = 'png', - Webp = 'webp', - Heic = 'heic', - Avif = 'avif', - Gif = 'gif', -} \ No newline at end of file diff --git a/src/enums/image-gravity.ts b/src/enums/image-gravity.ts deleted file mode 100644 index 815095dd..00000000 --- a/src/enums/image-gravity.ts +++ /dev/null @@ -1,11 +0,0 @@ -export enum ImageGravity { - Center = 'center', - Topleft = 'top-left', - Top = 'top', - Topright = 'top-right', - Left = 'left', - Right = 'right', - Bottomleft = 'bottom-left', - Bottom = 'bottom', - Bottomright = 'bottom-right', -} \ No newline at end of file diff --git a/src/enums/index-status.ts b/src/enums/index-status.ts deleted file mode 100644 index 6ce90ac8..00000000 --- a/src/enums/index-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum IndexStatus { - Available = 'available', - Processing = 'processing', - Deleting = 'deleting', - Stuck = 'stuck', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/message-priority.ts b/src/enums/message-priority.ts deleted file mode 100644 index f3113a85..00000000 --- a/src/enums/message-priority.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum MessagePriority { - Normal = 'normal', - High = 'high', -} \ No newline at end of file diff --git a/src/enums/message-status.ts b/src/enums/message-status.ts deleted file mode 100644 index 08bd483b..00000000 --- a/src/enums/message-status.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum MessageStatus { - Draft = 'draft', - Processing = 'processing', - Scheduled = 'scheduled', - Sent = 'sent', - Failed = 'failed', -} \ No newline at end of file diff --git a/src/enums/messaging-provider-type.ts b/src/enums/messaging-provider-type.ts deleted file mode 100644 index 18c9929b..00000000 --- a/src/enums/messaging-provider-type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum MessagingProviderType { - Email = 'email', - Sms = 'sms', - Push = 'push', -} \ No newline at end of file diff --git a/src/enums/name.ts b/src/enums/name.ts deleted file mode 100644 index 8cd297bc..00000000 --- a/src/enums/name.ts +++ /dev/null @@ -1,15 +0,0 @@ -export enum Name { - V1database = 'v1-database', - V1deletes = 'v1-deletes', - V1audits = 'v1-audits', - V1mails = 'v1-mails', - V1functions = 'v1-functions', - V1statsresources = 'v1-stats-resources', - V1statsusage = 'v1-stats-usage', - V1webhooks = 'v1-webhooks', - V1certificates = 'v1-certificates', - V1builds = 'v1-builds', - V1screenshots = 'v1-screenshots', - V1messaging = 'v1-messaging', - V1migrations = 'v1-migrations', -} \ No newline at end of file diff --git a/src/enums/o-auth-2-google-prompt.ts b/src/enums/o-auth-2-google-prompt.ts deleted file mode 100644 index f8e98e12..00000000 --- a/src/enums/o-auth-2-google-prompt.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum OAuth2GooglePrompt { - None = 'none', - Consent = 'consent', - SelectAccount = 'select_account', -} \ No newline at end of file diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts deleted file mode 100644 index cc9e340b..00000000 --- a/src/enums/o-auth-provider.ts +++ /dev/null @@ -1,45 +0,0 @@ -export enum OAuthProvider { - Amazon = 'amazon', - Apple = 'apple', - Auth0 = 'auth0', - Authentik = 'authentik', - Autodesk = 'autodesk', - Bitbucket = 'bitbucket', - Bitly = 'bitly', - Box = 'box', - Dailymotion = 'dailymotion', - Discord = 'discord', - Disqus = 'disqus', - Dropbox = 'dropbox', - Etsy = 'etsy', - Facebook = 'facebook', - Figma = 'figma', - Fusionauth = 'fusionauth', - Github = 'github', - Gitlab = 'gitlab', - Google = 'google', - Keycloak = 'keycloak', - Kick = 'kick', - Linkedin = 'linkedin', - Microsoft = 'microsoft', - Notion = 'notion', - Oidc = 'oidc', - Okta = 'okta', - Paypal = 'paypal', - PaypalSandbox = 'paypalSandbox', - Podio = 'podio', - Salesforce = 'salesforce', - Slack = 'slack', - Spotify = 'spotify', - Stripe = 'stripe', - Tradeshift = 'tradeshift', - TradeshiftBox = 'tradeshiftBox', - Twitch = 'twitch', - Wordpress = 'wordpress', - X = 'x', - Yahoo = 'yahoo', - Yammer = 'yammer', - Yandex = 'yandex', - Zoho = 'zoho', - Zoom = 'zoom', -} \ No newline at end of file diff --git a/src/enums/order-by.ts b/src/enums/order-by.ts deleted file mode 100644 index 62dffb98..00000000 --- a/src/enums/order-by.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum OrderBy { - Asc = 'asc', - Desc = 'desc', -} \ No newline at end of file diff --git a/src/enums/password-hash.ts b/src/enums/password-hash.ts deleted file mode 100644 index 76834af4..00000000 --- a/src/enums/password-hash.ts +++ /dev/null @@ -1,13 +0,0 @@ -export enum PasswordHash { - Sha1 = 'sha1', - Sha224 = 'sha224', - Sha256 = 'sha256', - Sha384 = 'sha384', - Sha512224 = 'sha512/224', - Sha512256 = 'sha512/256', - Sha512 = 'sha512', - Sha3224 = 'sha3-224', - Sha3256 = 'sha3-256', - Sha3384 = 'sha3-384', - Sha3512 = 'sha3-512', -} \ No newline at end of file diff --git a/src/enums/platform-type.ts b/src/enums/platform-type.ts deleted file mode 100644 index bde1d30f..00000000 --- a/src/enums/platform-type.ts +++ /dev/null @@ -1,7 +0,0 @@ -export enum PlatformType { - Windows = 'windows', - Apple = 'apple', - Android = 'android', - Linux = 'linux', - Web = 'web', -} \ No newline at end of file diff --git a/src/enums/project-auth-method-id.ts b/src/enums/project-auth-method-id.ts deleted file mode 100644 index a05c217e..00000000 --- a/src/enums/project-auth-method-id.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum ProjectAuthMethodId { - Emailpassword = 'email-password', - Magicurl = 'magic-url', - Emailotp = 'email-otp', - Anonymous = 'anonymous', - Invites = 'invites', - Jwt = 'jwt', - Phone = 'phone', -} \ No newline at end of file diff --git a/src/enums/project-email-template-id.ts b/src/enums/project-email-template-id.ts deleted file mode 100644 index b5aba1a6..00000000 --- a/src/enums/project-email-template-id.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum ProjectEmailTemplateId { - Verification = 'verification', - MagicSession = 'magicSession', - Recovery = 'recovery', - Invitation = 'invitation', - MfaChallenge = 'mfaChallenge', - SessionAlert = 'sessionAlert', - OtpSession = 'otpSession', -} \ No newline at end of file diff --git a/src/enums/project-email-template-locale.ts b/src/enums/project-email-template-locale.ts deleted file mode 100644 index b5bb7cf8..00000000 --- a/src/enums/project-email-template-locale.ts +++ /dev/null @@ -1,133 +0,0 @@ -export enum ProjectEmailTemplateLocale { - Af = 'af', - Arae = 'ar-ae', - Arbh = 'ar-bh', - Ardz = 'ar-dz', - Areg = 'ar-eg', - Ariq = 'ar-iq', - Arjo = 'ar-jo', - Arkw = 'ar-kw', - Arlb = 'ar-lb', - Arly = 'ar-ly', - Arma = 'ar-ma', - Arom = 'ar-om', - Arqa = 'ar-qa', - Arsa = 'ar-sa', - Arsy = 'ar-sy', - Artn = 'ar-tn', - Arye = 'ar-ye', - As = 'as', - Az = 'az', - Be = 'be', - Bg = 'bg', - Bh = 'bh', - Bn = 'bn', - Bs = 'bs', - Ca = 'ca', - Cs = 'cs', - Cy = 'cy', - Da = 'da', - De = 'de', - Deat = 'de-at', - Dech = 'de-ch', - Deli = 'de-li', - Delu = 'de-lu', - El = 'el', - En = 'en', - Enau = 'en-au', - Enbz = 'en-bz', - Enca = 'en-ca', - Engb = 'en-gb', - Enie = 'en-ie', - Enjm = 'en-jm', - Ennz = 'en-nz', - Entt = 'en-tt', - Enus = 'en-us', - Enza = 'en-za', - Eo = 'eo', - Es = 'es', - Esar = 'es-ar', - Esbo = 'es-bo', - Escl = 'es-cl', - Esco = 'es-co', - Escr = 'es-cr', - Esdo = 'es-do', - Esec = 'es-ec', - Esgt = 'es-gt', - Eshn = 'es-hn', - Esmx = 'es-mx', - Esni = 'es-ni', - Espa = 'es-pa', - Espe = 'es-pe', - Espr = 'es-pr', - Espy = 'es-py', - Essv = 'es-sv', - Esuy = 'es-uy', - Esve = 'es-ve', - Et = 'et', - Eu = 'eu', - Fa = 'fa', - Fi = 'fi', - Fo = 'fo', - Fr = 'fr', - Frbe = 'fr-be', - Frca = 'fr-ca', - Frch = 'fr-ch', - Frlu = 'fr-lu', - Ga = 'ga', - Gd = 'gd', - He = 'he', - Hi = 'hi', - Hr = 'hr', - Hu = 'hu', - Id = 'id', - Is = 'is', - It = 'it', - Itch = 'it-ch', - Ja = 'ja', - Ji = 'ji', - Ko = 'ko', - Ku = 'ku', - Lt = 'lt', - Lv = 'lv', - Mk = 'mk', - Ml = 'ml', - Ms = 'ms', - Mt = 'mt', - Nb = 'nb', - Ne = 'ne', - Nl = 'nl', - Nlbe = 'nl-be', - Nn = 'nn', - No = 'no', - Pa = 'pa', - Pl = 'pl', - Pt = 'pt', - Ptbr = 'pt-br', - Rm = 'rm', - Ro = 'ro', - Romd = 'ro-md', - Ru = 'ru', - Rumd = 'ru-md', - Sb = 'sb', - Sk = 'sk', - Sl = 'sl', - Sq = 'sq', - Sr = 'sr', - Sv = 'sv', - Svfi = 'sv-fi', - Th = 'th', - Tn = 'tn', - Tr = 'tr', - Ts = 'ts', - Ua = 'ua', - Ur = 'ur', - Ve = 've', - Vi = 'vi', - Xh = 'xh', - Zhcn = 'zh-cn', - Zhhk = 'zh-hk', - Zhsg = 'zh-sg', - Zhtw = 'zh-tw', - Zu = 'zu', -} \ No newline at end of file diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts deleted file mode 100644 index fe019965..00000000 --- a/src/enums/project-key-scopes.ts +++ /dev/null @@ -1,96 +0,0 @@ -export enum ProjectKeyScopes { - ProjectRead = 'project.read', - ProjectWrite = 'project.write', - KeysRead = 'keys.read', - KeysWrite = 'keys.write', - PlatformsRead = 'platforms.read', - PlatformsWrite = 'platforms.write', - MocksRead = 'mocks.read', - MocksWrite = 'mocks.write', - PoliciesRead = 'policies.read', - PoliciesWrite = 'policies.write', - ProjectPoliciesRead = 'project.policies.read', - ProjectPoliciesWrite = 'project.policies.write', - TemplatesRead = 'templates.read', - TemplatesWrite = 'templates.write', - Oauth2Read = 'oauth2.read', - Oauth2Write = 'oauth2.write', - UsersRead = 'users.read', - UsersWrite = 'users.write', - SessionsRead = 'sessions.read', - SessionsWrite = 'sessions.write', - TeamsRead = 'teams.read', - TeamsWrite = 'teams.write', - DatabasesRead = 'databases.read', - DatabasesWrite = 'databases.write', - TablesRead = 'tables.read', - TablesWrite = 'tables.write', - ColumnsRead = 'columns.read', - ColumnsWrite = 'columns.write', - IndexesRead = 'indexes.read', - IndexesWrite = 'indexes.write', - RowsRead = 'rows.read', - RowsWrite = 'rows.write', - CollectionsRead = 'collections.read', - CollectionsWrite = 'collections.write', - AttributesRead = 'attributes.read', - AttributesWrite = 'attributes.write', - DocumentsRead = 'documents.read', - DocumentsWrite = 'documents.write', - BucketsRead = 'buckets.read', - BucketsWrite = 'buckets.write', - FilesRead = 'files.read', - FilesWrite = 'files.write', - TokensRead = 'tokens.read', - TokensWrite = 'tokens.write', - FunctionsRead = 'functions.read', - FunctionsWrite = 'functions.write', - ExecutionsRead = 'executions.read', - ExecutionsWrite = 'executions.write', - ExecutionRead = 'execution.read', - ExecutionWrite = 'execution.write', - SitesRead = 'sites.read', - SitesWrite = 'sites.write', - LogRead = 'log.read', - LogWrite = 'log.write', - ProvidersRead = 'providers.read', - ProvidersWrite = 'providers.write', - TopicsRead = 'topics.read', - TopicsWrite = 'topics.write', - SubscribersRead = 'subscribers.read', - SubscribersWrite = 'subscribers.write', - TargetsRead = 'targets.read', - TargetsWrite = 'targets.write', - MessagesRead = 'messages.read', - MessagesWrite = 'messages.write', - RulesRead = 'rules.read', - RulesWrite = 'rules.write', - WebhooksRead = 'webhooks.read', - WebhooksWrite = 'webhooks.write', - LocaleRead = 'locale.read', - AvatarsRead = 'avatars.read', - HealthRead = 'health.read', - AssistantRead = 'assistant.read', - MigrationsRead = 'migrations.read', - MigrationsWrite = 'migrations.write', - SchedulesRead = 'schedules.read', - SchedulesWrite = 'schedules.write', - VcsRead = 'vcs.read', - VcsWrite = 'vcs.write', - InsightsRead = 'insights.read', - InsightsWrite = 'insights.write', - ReportsRead = 'reports.read', - ReportsWrite = 'reports.write', - PresencesRead = 'presences.read', - PresencesWrite = 'presences.write', - BackupsPoliciesRead = 'backups.policies.read', - BackupsPoliciesWrite = 'backups.policies.write', - ArchivesRead = 'archives.read', - ArchivesWrite = 'archives.write', - RestorationsRead = 'restorations.read', - RestorationsWrite = 'restorations.write', - DomainsRead = 'domains.read', - DomainsWrite = 'domains.write', - EventsRead = 'events.read', - UsageRead = 'usage.read', -} \ No newline at end of file diff --git a/src/enums/project-o-auth-2-google-prompt.ts b/src/enums/project-o-auth-2-google-prompt.ts deleted file mode 100644 index 75db98ec..00000000 --- a/src/enums/project-o-auth-2-google-prompt.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum ProjectOAuth2GooglePrompt { - None = 'none', - Consent = 'consent', - SelectAccount = 'select_account', -} \ No newline at end of file diff --git a/src/enums/project-o-auth-provider-id.ts b/src/enums/project-o-auth-provider-id.ts deleted file mode 100644 index e35d6ef0..00000000 --- a/src/enums/project-o-auth-provider-id.ts +++ /dev/null @@ -1,47 +0,0 @@ -export enum ProjectOAuthProviderId { - Amazon = 'amazon', - Apple = 'apple', - Auth0 = 'auth0', - Authentik = 'authentik', - Autodesk = 'autodesk', - Bitbucket = 'bitbucket', - Bitly = 'bitly', - Box = 'box', - Dailymotion = 'dailymotion', - Discord = 'discord', - Disqus = 'disqus', - Dropbox = 'dropbox', - Etsy = 'etsy', - Facebook = 'facebook', - Figma = 'figma', - Fusionauth = 'fusionauth', - Github = 'github', - Gitlab = 'gitlab', - Google = 'google', - Keycloak = 'keycloak', - Kick = 'kick', - Linkedin = 'linkedin', - Microsoft = 'microsoft', - Notion = 'notion', - Oidc = 'oidc', - Okta = 'okta', - Paypal = 'paypal', - PaypalSandbox = 'paypalSandbox', - Podio = 'podio', - Salesforce = 'salesforce', - Slack = 'slack', - Spotify = 'spotify', - Stripe = 'stripe', - Tradeshift = 'tradeshift', - TradeshiftBox = 'tradeshiftBox', - Twitch = 'twitch', - Wordpress = 'wordpress', - X = 'x', - Yahoo = 'yahoo', - Yammer = 'yammer', - Yandex = 'yandex', - Zoho = 'zoho', - Zoom = 'zoom', - GithubImagine = 'githubImagine', - GoogleImagine = 'googleImagine', -} \ No newline at end of file diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts deleted file mode 100644 index 2031ce9b..00000000 --- a/src/enums/project-policy-id.ts +++ /dev/null @@ -1,11 +0,0 @@ -export enum ProjectPolicyId { - Passworddictionary = 'password-dictionary', - Passwordhistory = 'password-history', - Passwordpersonaldata = 'password-personal-data', - Sessionalert = 'session-alert', - Sessionduration = 'session-duration', - Sessioninvalidation = 'session-invalidation', - Sessionlimit = 'session-limit', - Userlimit = 'user-limit', - Membershipprivacy = 'membership-privacy', -} \ No newline at end of file diff --git a/src/enums/project-protocol-id.ts b/src/enums/project-protocol-id.ts deleted file mode 100644 index 10a89c21..00000000 --- a/src/enums/project-protocol-id.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum ProjectProtocolId { - Rest = 'rest', - Graphql = 'graphql', - Websocket = 'websocket', -} \ No newline at end of file diff --git a/src/enums/project-service-id.ts b/src/enums/project-service-id.ts deleted file mode 100644 index 01f844a8..00000000 --- a/src/enums/project-service-id.ts +++ /dev/null @@ -1,20 +0,0 @@ -export enum ProjectServiceId { - Account = 'account', - Avatars = 'avatars', - Databases = 'databases', - Tablesdb = 'tablesdb', - Locale = 'locale', - Health = 'health', - Project = 'project', - Storage = 'storage', - Teams = 'teams', - Users = 'users', - Vcs = 'vcs', - Sites = 'sites', - Functions = 'functions', - Proxy = 'proxy', - Graphql = 'graphql', - Migrations = 'migrations', - Messaging = 'messaging', - Advisor = 'advisor', -} \ No newline at end of file diff --git a/src/enums/project-smtp-secure.ts b/src/enums/project-smtp-secure.ts deleted file mode 100644 index d3d37687..00000000 --- a/src/enums/project-smtp-secure.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ProjectSMTPSecure { - Tls = 'tls', - Ssl = 'ssl', -} \ No newline at end of file diff --git a/src/enums/proxy-resource-type.ts b/src/enums/proxy-resource-type.ts deleted file mode 100644 index e04c8046..00000000 --- a/src/enums/proxy-resource-type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ProxyResourceType { - Site = 'site', - Function = 'function', -} \ No newline at end of file diff --git a/src/enums/proxy-rule-deployment-resource-type.ts b/src/enums/proxy-rule-deployment-resource-type.ts deleted file mode 100644 index 89236c74..00000000 --- a/src/enums/proxy-rule-deployment-resource-type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ProxyRuleDeploymentResourceType { - Function = 'function', - Site = 'site', -} \ No newline at end of file diff --git a/src/enums/proxy-rule-status.ts b/src/enums/proxy-rule-status.ts deleted file mode 100644 index 67b8e4cb..00000000 --- a/src/enums/proxy-rule-status.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum ProxyRuleStatus { - Unverified = 'unverified', - Verifying = 'verifying', - Verified = 'verified', -} \ No newline at end of file diff --git a/src/enums/relation-mutate.ts b/src/enums/relation-mutate.ts deleted file mode 100644 index 722a7572..00000000 --- a/src/enums/relation-mutate.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum RelationMutate { - Cascade = 'cascade', - Restrict = 'restrict', - SetNull = 'setNull', -} \ No newline at end of file diff --git a/src/enums/relationship-type.ts b/src/enums/relationship-type.ts deleted file mode 100644 index 532015af..00000000 --- a/src/enums/relationship-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum RelationshipType { - OneToOne = 'oneToOne', - ManyToOne = 'manyToOne', - ManyToMany = 'manyToMany', - OneToMany = 'oneToMany', -} \ No newline at end of file diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts deleted file mode 100644 index a2b22ef0..00000000 --- a/src/enums/runtime.ts +++ /dev/null @@ -1,94 +0,0 @@ -export enum Runtime { - Node145 = 'node-14.5', - Node160 = 'node-16.0', - Node180 = 'node-18.0', - Node190 = 'node-19.0', - Node200 = 'node-20.0', - Node210 = 'node-21.0', - Node22 = 'node-22', - Node23 = 'node-23', - Node24 = 'node-24', - Node25 = 'node-25', - Php80 = 'php-8.0', - Php81 = 'php-8.1', - Php82 = 'php-8.2', - Php83 = 'php-8.3', - Php84 = 'php-8.4', - Ruby30 = 'ruby-3.0', - Ruby31 = 'ruby-3.1', - Ruby32 = 'ruby-3.2', - Ruby33 = 'ruby-3.3', - Ruby34 = 'ruby-3.4', - Ruby40 = 'ruby-4.0', - Python38 = 'python-3.8', - Python39 = 'python-3.9', - Python310 = 'python-3.10', - Python311 = 'python-3.11', - Python312 = 'python-3.12', - Python313 = 'python-3.13', - Python314 = 'python-3.14', - Pythonml311 = 'python-ml-3.11', - Pythonml312 = 'python-ml-3.12', - Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', - Deno140 = 'deno-1.40', - Deno146 = 'deno-1.46', - Deno20 = 'deno-2.0', - Deno25 = 'deno-2.5', - Deno26 = 'deno-2.6', - Dart215 = 'dart-2.15', - Dart216 = 'dart-2.16', - Dart217 = 'dart-2.17', - Dart218 = 'dart-2.18', - Dart219 = 'dart-2.19', - Dart30 = 'dart-3.0', - Dart31 = 'dart-3.1', - Dart33 = 'dart-3.3', - Dart35 = 'dart-3.5', - Dart38 = 'dart-3.8', - Dart39 = 'dart-3.9', - Dart310 = 'dart-3.10', - Dart311 = 'dart-3.11', - Dotnet60 = 'dotnet-6.0', - Dotnet70 = 'dotnet-7.0', - Dotnet80 = 'dotnet-8.0', - Dotnet10 = 'dotnet-10', - Java80 = 'java-8.0', - Java110 = 'java-11.0', - Java170 = 'java-17.0', - Java180 = 'java-18.0', - Java210 = 'java-21.0', - Java22 = 'java-22', - Java25 = 'java-25', - Swift55 = 'swift-5.5', - Swift58 = 'swift-5.8', - Swift59 = 'swift-5.9', - Swift510 = 'swift-5.10', - Swift62 = 'swift-6.2', - Kotlin16 = 'kotlin-1.6', - Kotlin18 = 'kotlin-1.8', - Kotlin19 = 'kotlin-1.9', - Kotlin20 = 'kotlin-2.0', - Kotlin23 = 'kotlin-2.3', - Cpp17 = 'cpp-17', - Cpp20 = 'cpp-20', - Bun10 = 'bun-1.0', - Bun11 = 'bun-1.1', - Bun12 = 'bun-1.2', - Bun13 = 'bun-1.3', - Go123 = 'go-1.23', - Go124 = 'go-1.24', - Go125 = 'go-1.25', - Go126 = 'go-1.26', - Rust183 = 'rust-1.83', - Static1 = 'static-1', - Flutter324 = 'flutter-3.24', - Flutter327 = 'flutter-3.27', - Flutter329 = 'flutter-3.29', - Flutter332 = 'flutter-3.32', - Flutter335 = 'flutter-3.35', - Flutter338 = 'flutter-3.38', - Flutter341 = 'flutter-3.41', -} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts deleted file mode 100644 index 54e9cb31..00000000 --- a/src/enums/scopes.ts +++ /dev/null @@ -1,96 +0,0 @@ -export enum Scopes { - ProjectRead = 'project.read', - ProjectWrite = 'project.write', - KeysRead = 'keys.read', - KeysWrite = 'keys.write', - PlatformsRead = 'platforms.read', - PlatformsWrite = 'platforms.write', - MocksRead = 'mocks.read', - MocksWrite = 'mocks.write', - PoliciesRead = 'policies.read', - PoliciesWrite = 'policies.write', - ProjectPoliciesRead = 'project.policies.read', - ProjectPoliciesWrite = 'project.policies.write', - TemplatesRead = 'templates.read', - TemplatesWrite = 'templates.write', - Oauth2Read = 'oauth2.read', - Oauth2Write = 'oauth2.write', - UsersRead = 'users.read', - UsersWrite = 'users.write', - SessionsRead = 'sessions.read', - SessionsWrite = 'sessions.write', - TeamsRead = 'teams.read', - TeamsWrite = 'teams.write', - DatabasesRead = 'databases.read', - DatabasesWrite = 'databases.write', - TablesRead = 'tables.read', - TablesWrite = 'tables.write', - ColumnsRead = 'columns.read', - ColumnsWrite = 'columns.write', - IndexesRead = 'indexes.read', - IndexesWrite = 'indexes.write', - RowsRead = 'rows.read', - RowsWrite = 'rows.write', - CollectionsRead = 'collections.read', - CollectionsWrite = 'collections.write', - AttributesRead = 'attributes.read', - AttributesWrite = 'attributes.write', - DocumentsRead = 'documents.read', - DocumentsWrite = 'documents.write', - BucketsRead = 'buckets.read', - BucketsWrite = 'buckets.write', - FilesRead = 'files.read', - FilesWrite = 'files.write', - TokensRead = 'tokens.read', - TokensWrite = 'tokens.write', - FunctionsRead = 'functions.read', - FunctionsWrite = 'functions.write', - ExecutionsRead = 'executions.read', - ExecutionsWrite = 'executions.write', - ExecutionRead = 'execution.read', - ExecutionWrite = 'execution.write', - SitesRead = 'sites.read', - SitesWrite = 'sites.write', - LogRead = 'log.read', - LogWrite = 'log.write', - ProvidersRead = 'providers.read', - ProvidersWrite = 'providers.write', - TopicsRead = 'topics.read', - TopicsWrite = 'topics.write', - SubscribersRead = 'subscribers.read', - SubscribersWrite = 'subscribers.write', - TargetsRead = 'targets.read', - TargetsWrite = 'targets.write', - MessagesRead = 'messages.read', - MessagesWrite = 'messages.write', - RulesRead = 'rules.read', - RulesWrite = 'rules.write', - WebhooksRead = 'webhooks.read', - WebhooksWrite = 'webhooks.write', - LocaleRead = 'locale.read', - AvatarsRead = 'avatars.read', - HealthRead = 'health.read', - AssistantRead = 'assistant.read', - MigrationsRead = 'migrations.read', - MigrationsWrite = 'migrations.write', - SchedulesRead = 'schedules.read', - SchedulesWrite = 'schedules.write', - VcsRead = 'vcs.read', - VcsWrite = 'vcs.write', - InsightsRead = 'insights.read', - InsightsWrite = 'insights.write', - ReportsRead = 'reports.read', - ReportsWrite = 'reports.write', - PresencesRead = 'presences.read', - PresencesWrite = 'presences.write', - BackupsPoliciesRead = 'backups.policies.read', - BackupsPoliciesWrite = 'backups.policies.write', - ArchivesRead = 'archives.read', - ArchivesWrite = 'archives.write', - RestorationsRead = 'restorations.read', - RestorationsWrite = 'restorations.write', - DomainsRead = 'domains.read', - DomainsWrite = 'domains.write', - EventsRead = 'events.read', - UsageRead = 'usage.read', -} \ No newline at end of file diff --git a/src/enums/smtp-encryption.ts b/src/enums/smtp-encryption.ts deleted file mode 100644 index 876177b6..00000000 --- a/src/enums/smtp-encryption.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum SmtpEncryption { - None = 'none', - Ssl = 'ssl', - Tls = 'tls', -} \ No newline at end of file diff --git a/src/enums/status-code.ts b/src/enums/status-code.ts deleted file mode 100644 index 1f3adf8b..00000000 --- a/src/enums/status-code.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum StatusCode { - MovedPermanently301 = '301', - Found302 = '302', - TemporaryRedirect307 = '307', - PermanentRedirect308 = '308', -} \ No newline at end of file diff --git a/src/enums/tables-db-index-type.ts b/src/enums/tables-db-index-type.ts deleted file mode 100644 index a199cd9c..00000000 --- a/src/enums/tables-db-index-type.ts +++ /dev/null @@ -1,6 +0,0 @@ -export enum TablesDBIndexType { - Key = 'key', - Fulltext = 'fulltext', - Unique = 'unique', - Spatial = 'spatial', -} \ No newline at end of file diff --git a/src/enums/template-reference-type.ts b/src/enums/template-reference-type.ts deleted file mode 100644 index bd72cfb5..00000000 --- a/src/enums/template-reference-type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum TemplateReferenceType { - Commit = 'commit', - Branch = 'branch', - Tag = 'tag', -} \ No newline at end of file diff --git a/src/enums/theme.ts b/src/enums/theme.ts deleted file mode 100644 index 5e823a9b..00000000 --- a/src/enums/theme.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum Theme { - Light = 'light', - Dark = 'dark', -} \ No newline at end of file diff --git a/src/enums/timezone.ts b/src/enums/timezone.ts deleted file mode 100644 index 207298a8..00000000 --- a/src/enums/timezone.ts +++ /dev/null @@ -1,421 +0,0 @@ -export enum Timezone { - AfricaAbidjan = 'africa/abidjan', - AfricaAccra = 'africa/accra', - AfricaAddisAbaba = 'africa/addis_ababa', - AfricaAlgiers = 'africa/algiers', - AfricaAsmara = 'africa/asmara', - AfricaBamako = 'africa/bamako', - AfricaBangui = 'africa/bangui', - AfricaBanjul = 'africa/banjul', - AfricaBissau = 'africa/bissau', - AfricaBlantyre = 'africa/blantyre', - AfricaBrazzaville = 'africa/brazzaville', - AfricaBujumbura = 'africa/bujumbura', - AfricaCairo = 'africa/cairo', - AfricaCasablanca = 'africa/casablanca', - AfricaCeuta = 'africa/ceuta', - AfricaConakry = 'africa/conakry', - AfricaDakar = 'africa/dakar', - AfricaDarEsSalaam = 'africa/dar_es_salaam', - AfricaDjibouti = 'africa/djibouti', - AfricaDouala = 'africa/douala', - AfricaElAaiun = 'africa/el_aaiun', - AfricaFreetown = 'africa/freetown', - AfricaGaborone = 'africa/gaborone', - AfricaHarare = 'africa/harare', - AfricaJohannesburg = 'africa/johannesburg', - AfricaJuba = 'africa/juba', - AfricaKampala = 'africa/kampala', - AfricaKhartoum = 'africa/khartoum', - AfricaKigali = 'africa/kigali', - AfricaKinshasa = 'africa/kinshasa', - AfricaLagos = 'africa/lagos', - AfricaLibreville = 'africa/libreville', - AfricaLome = 'africa/lome', - AfricaLuanda = 'africa/luanda', - AfricaLubumbashi = 'africa/lubumbashi', - AfricaLusaka = 'africa/lusaka', - AfricaMalabo = 'africa/malabo', - AfricaMaputo = 'africa/maputo', - AfricaMaseru = 'africa/maseru', - AfricaMbabane = 'africa/mbabane', - AfricaMogadishu = 'africa/mogadishu', - AfricaMonrovia = 'africa/monrovia', - AfricaNairobi = 'africa/nairobi', - AfricaNdjamena = 'africa/ndjamena', - AfricaNiamey = 'africa/niamey', - AfricaNouakchott = 'africa/nouakchott', - AfricaOuagadougou = 'africa/ouagadougou', - AfricaPortonovo = 'africa/porto-novo', - AfricaSaoTome = 'africa/sao_tome', - AfricaTripoli = 'africa/tripoli', - AfricaTunis = 'africa/tunis', - AfricaWindhoek = 'africa/windhoek', - AmericaAdak = 'america/adak', - AmericaAnchorage = 'america/anchorage', - AmericaAnguilla = 'america/anguilla', - AmericaAntigua = 'america/antigua', - AmericaAraguaina = 'america/araguaina', - AmericaArgentinaBuenosAires = 'america/argentina/buenos_aires', - AmericaArgentinaCatamarca = 'america/argentina/catamarca', - AmericaArgentinaCordoba = 'america/argentina/cordoba', - AmericaArgentinaJujuy = 'america/argentina/jujuy', - AmericaArgentinaLaRioja = 'america/argentina/la_rioja', - AmericaArgentinaMendoza = 'america/argentina/mendoza', - AmericaArgentinaRioGallegos = 'america/argentina/rio_gallegos', - AmericaArgentinaSalta = 'america/argentina/salta', - AmericaArgentinaSanJuan = 'america/argentina/san_juan', - AmericaArgentinaSanLuis = 'america/argentina/san_luis', - AmericaArgentinaTucuman = 'america/argentina/tucuman', - AmericaArgentinaUshuaia = 'america/argentina/ushuaia', - AmericaAruba = 'america/aruba', - AmericaAsuncion = 'america/asuncion', - AmericaAtikokan = 'america/atikokan', - AmericaBahia = 'america/bahia', - AmericaBahiaBanderas = 'america/bahia_banderas', - AmericaBarbados = 'america/barbados', - AmericaBelem = 'america/belem', - AmericaBelize = 'america/belize', - AmericaBlancsablon = 'america/blanc-sablon', - AmericaBoaVista = 'america/boa_vista', - AmericaBogota = 'america/bogota', - AmericaBoise = 'america/boise', - AmericaCambridgeBay = 'america/cambridge_bay', - AmericaCampoGrande = 'america/campo_grande', - AmericaCancun = 'america/cancun', - AmericaCaracas = 'america/caracas', - AmericaCayenne = 'america/cayenne', - AmericaCayman = 'america/cayman', - AmericaChicago = 'america/chicago', - AmericaChihuahua = 'america/chihuahua', - AmericaCiudadJuarez = 'america/ciudad_juarez', - AmericaCostaRica = 'america/costa_rica', - AmericaCoyhaique = 'america/coyhaique', - AmericaCreston = 'america/creston', - AmericaCuiaba = 'america/cuiaba', - AmericaCuracao = 'america/curacao', - AmericaDanmarkshavn = 'america/danmarkshavn', - AmericaDawson = 'america/dawson', - AmericaDawsonCreek = 'america/dawson_creek', - AmericaDenver = 'america/denver', - AmericaDetroit = 'america/detroit', - AmericaDominica = 'america/dominica', - AmericaEdmonton = 'america/edmonton', - AmericaEirunepe = 'america/eirunepe', - AmericaElSalvador = 'america/el_salvador', - AmericaFortNelson = 'america/fort_nelson', - AmericaFortaleza = 'america/fortaleza', - AmericaGlaceBay = 'america/glace_bay', - AmericaGooseBay = 'america/goose_bay', - AmericaGrandTurk = 'america/grand_turk', - AmericaGrenada = 'america/grenada', - AmericaGuadeloupe = 'america/guadeloupe', - AmericaGuatemala = 'america/guatemala', - AmericaGuayaquil = 'america/guayaquil', - AmericaGuyana = 'america/guyana', - AmericaHalifax = 'america/halifax', - AmericaHavana = 'america/havana', - AmericaHermosillo = 'america/hermosillo', - AmericaIndianaIndianapolis = 'america/indiana/indianapolis', - AmericaIndianaKnox = 'america/indiana/knox', - AmericaIndianaMarengo = 'america/indiana/marengo', - AmericaIndianaPetersburg = 'america/indiana/petersburg', - AmericaIndianaTellCity = 'america/indiana/tell_city', - AmericaIndianaVevay = 'america/indiana/vevay', - AmericaIndianaVincennes = 'america/indiana/vincennes', - AmericaIndianaWinamac = 'america/indiana/winamac', - AmericaInuvik = 'america/inuvik', - AmericaIqaluit = 'america/iqaluit', - AmericaJamaica = 'america/jamaica', - AmericaJuneau = 'america/juneau', - AmericaKentuckyLouisville = 'america/kentucky/louisville', - AmericaKentuckyMonticello = 'america/kentucky/monticello', - AmericaKralendijk = 'america/kralendijk', - AmericaLaPaz = 'america/la_paz', - AmericaLima = 'america/lima', - AmericaLosAngeles = 'america/los_angeles', - AmericaLowerPrinces = 'america/lower_princes', - AmericaMaceio = 'america/maceio', - AmericaManagua = 'america/managua', - AmericaManaus = 'america/manaus', - AmericaMarigot = 'america/marigot', - AmericaMartinique = 'america/martinique', - AmericaMatamoros = 'america/matamoros', - AmericaMazatlan = 'america/mazatlan', - AmericaMenominee = 'america/menominee', - AmericaMerida = 'america/merida', - AmericaMetlakatla = 'america/metlakatla', - AmericaMexicoCity = 'america/mexico_city', - AmericaMiquelon = 'america/miquelon', - AmericaMoncton = 'america/moncton', - AmericaMonterrey = 'america/monterrey', - AmericaMontevideo = 'america/montevideo', - AmericaMontserrat = 'america/montserrat', - AmericaNassau = 'america/nassau', - AmericaNewYork = 'america/new_york', - AmericaNome = 'america/nome', - AmericaNoronha = 'america/noronha', - AmericaNorthDakotaBeulah = 'america/north_dakota/beulah', - AmericaNorthDakotaCenter = 'america/north_dakota/center', - AmericaNorthDakotaNewSalem = 'america/north_dakota/new_salem', - AmericaNuuk = 'america/nuuk', - AmericaOjinaga = 'america/ojinaga', - AmericaPanama = 'america/panama', - AmericaParamaribo = 'america/paramaribo', - AmericaPhoenix = 'america/phoenix', - AmericaPortauprince = 'america/port-au-prince', - AmericaPortOfSpain = 'america/port_of_spain', - AmericaPortoVelho = 'america/porto_velho', - AmericaPuertoRico = 'america/puerto_rico', - AmericaPuntaArenas = 'america/punta_arenas', - AmericaRankinInlet = 'america/rankin_inlet', - AmericaRecife = 'america/recife', - AmericaRegina = 'america/regina', - AmericaResolute = 'america/resolute', - AmericaRioBranco = 'america/rio_branco', - AmericaSantarem = 'america/santarem', - AmericaSantiago = 'america/santiago', - AmericaSantoDomingo = 'america/santo_domingo', - AmericaSaoPaulo = 'america/sao_paulo', - AmericaScoresbysund = 'america/scoresbysund', - AmericaSitka = 'america/sitka', - AmericaStBarthelemy = 'america/st_barthelemy', - AmericaStJohns = 'america/st_johns', - AmericaStKitts = 'america/st_kitts', - AmericaStLucia = 'america/st_lucia', - AmericaStThomas = 'america/st_thomas', - AmericaStVincent = 'america/st_vincent', - AmericaSwiftCurrent = 'america/swift_current', - AmericaTegucigalpa = 'america/tegucigalpa', - AmericaThule = 'america/thule', - AmericaTijuana = 'america/tijuana', - AmericaToronto = 'america/toronto', - AmericaTortola = 'america/tortola', - AmericaVancouver = 'america/vancouver', - AmericaWhitehorse = 'america/whitehorse', - AmericaWinnipeg = 'america/winnipeg', - AmericaYakutat = 'america/yakutat', - AntarcticaCasey = 'antarctica/casey', - AntarcticaDavis = 'antarctica/davis', - AntarcticaDumontdurville = 'antarctica/dumontdurville', - AntarcticaMacquarie = 'antarctica/macquarie', - AntarcticaMawson = 'antarctica/mawson', - AntarcticaMcmurdo = 'antarctica/mcmurdo', - AntarcticaPalmer = 'antarctica/palmer', - AntarcticaRothera = 'antarctica/rothera', - AntarcticaSyowa = 'antarctica/syowa', - AntarcticaTroll = 'antarctica/troll', - AntarcticaVostok = 'antarctica/vostok', - ArcticLongyearbyen = 'arctic/longyearbyen', - AsiaAden = 'asia/aden', - AsiaAlmaty = 'asia/almaty', - AsiaAmman = 'asia/amman', - AsiaAnadyr = 'asia/anadyr', - AsiaAqtau = 'asia/aqtau', - AsiaAqtobe = 'asia/aqtobe', - AsiaAshgabat = 'asia/ashgabat', - AsiaAtyrau = 'asia/atyrau', - AsiaBaghdad = 'asia/baghdad', - AsiaBahrain = 'asia/bahrain', - AsiaBaku = 'asia/baku', - AsiaBangkok = 'asia/bangkok', - AsiaBarnaul = 'asia/barnaul', - AsiaBeirut = 'asia/beirut', - AsiaBishkek = 'asia/bishkek', - AsiaBrunei = 'asia/brunei', - AsiaChita = 'asia/chita', - AsiaColombo = 'asia/colombo', - AsiaDamascus = 'asia/damascus', - AsiaDhaka = 'asia/dhaka', - AsiaDili = 'asia/dili', - AsiaDubai = 'asia/dubai', - AsiaDushanbe = 'asia/dushanbe', - AsiaFamagusta = 'asia/famagusta', - AsiaGaza = 'asia/gaza', - AsiaHebron = 'asia/hebron', - AsiaHoChiMinh = 'asia/ho_chi_minh', - AsiaHongKong = 'asia/hong_kong', - AsiaHovd = 'asia/hovd', - AsiaIrkutsk = 'asia/irkutsk', - AsiaJakarta = 'asia/jakarta', - AsiaJayapura = 'asia/jayapura', - AsiaJerusalem = 'asia/jerusalem', - AsiaKabul = 'asia/kabul', - AsiaKamchatka = 'asia/kamchatka', - AsiaKarachi = 'asia/karachi', - AsiaKathmandu = 'asia/kathmandu', - AsiaKhandyga = 'asia/khandyga', - AsiaKolkata = 'asia/kolkata', - AsiaKrasnoyarsk = 'asia/krasnoyarsk', - AsiaKualaLumpur = 'asia/kuala_lumpur', - AsiaKuching = 'asia/kuching', - AsiaKuwait = 'asia/kuwait', - AsiaMacau = 'asia/macau', - AsiaMagadan = 'asia/magadan', - AsiaMakassar = 'asia/makassar', - AsiaManila = 'asia/manila', - AsiaMuscat = 'asia/muscat', - AsiaNicosia = 'asia/nicosia', - AsiaNovokuznetsk = 'asia/novokuznetsk', - AsiaNovosibirsk = 'asia/novosibirsk', - AsiaOmsk = 'asia/omsk', - AsiaOral = 'asia/oral', - AsiaPhnomPenh = 'asia/phnom_penh', - AsiaPontianak = 'asia/pontianak', - AsiaPyongyang = 'asia/pyongyang', - AsiaQatar = 'asia/qatar', - AsiaQostanay = 'asia/qostanay', - AsiaQyzylorda = 'asia/qyzylorda', - AsiaRiyadh = 'asia/riyadh', - AsiaSakhalin = 'asia/sakhalin', - AsiaSamarkand = 'asia/samarkand', - AsiaSeoul = 'asia/seoul', - AsiaShanghai = 'asia/shanghai', - AsiaSingapore = 'asia/singapore', - AsiaSrednekolymsk = 'asia/srednekolymsk', - AsiaTaipei = 'asia/taipei', - AsiaTashkent = 'asia/tashkent', - AsiaTbilisi = 'asia/tbilisi', - AsiaTehran = 'asia/tehran', - AsiaThimphu = 'asia/thimphu', - AsiaTokyo = 'asia/tokyo', - AsiaTomsk = 'asia/tomsk', - AsiaUlaanbaatar = 'asia/ulaanbaatar', - AsiaUrumqi = 'asia/urumqi', - AsiaUstnera = 'asia/ust-nera', - AsiaVientiane = 'asia/vientiane', - AsiaVladivostok = 'asia/vladivostok', - AsiaYakutsk = 'asia/yakutsk', - AsiaYangon = 'asia/yangon', - AsiaYekaterinburg = 'asia/yekaterinburg', - AsiaYerevan = 'asia/yerevan', - AtlanticAzores = 'atlantic/azores', - AtlanticBermuda = 'atlantic/bermuda', - AtlanticCanary = 'atlantic/canary', - AtlanticCapeVerde = 'atlantic/cape_verde', - AtlanticFaroe = 'atlantic/faroe', - AtlanticMadeira = 'atlantic/madeira', - AtlanticReykjavik = 'atlantic/reykjavik', - AtlanticSouthGeorgia = 'atlantic/south_georgia', - AtlanticStHelena = 'atlantic/st_helena', - AtlanticStanley = 'atlantic/stanley', - AustraliaAdelaide = 'australia/adelaide', - AustraliaBrisbane = 'australia/brisbane', - AustraliaBrokenHill = 'australia/broken_hill', - AustraliaDarwin = 'australia/darwin', - AustraliaEucla = 'australia/eucla', - AustraliaHobart = 'australia/hobart', - AustraliaLindeman = 'australia/lindeman', - AustraliaLordHowe = 'australia/lord_howe', - AustraliaMelbourne = 'australia/melbourne', - AustraliaPerth = 'australia/perth', - AustraliaSydney = 'australia/sydney', - EuropeAmsterdam = 'europe/amsterdam', - EuropeAndorra = 'europe/andorra', - EuropeAstrakhan = 'europe/astrakhan', - EuropeAthens = 'europe/athens', - EuropeBelgrade = 'europe/belgrade', - EuropeBerlin = 'europe/berlin', - EuropeBratislava = 'europe/bratislava', - EuropeBrussels = 'europe/brussels', - EuropeBucharest = 'europe/bucharest', - EuropeBudapest = 'europe/budapest', - EuropeBusingen = 'europe/busingen', - EuropeChisinau = 'europe/chisinau', - EuropeCopenhagen = 'europe/copenhagen', - EuropeDublin = 'europe/dublin', - EuropeGibraltar = 'europe/gibraltar', - EuropeGuernsey = 'europe/guernsey', - EuropeHelsinki = 'europe/helsinki', - EuropeIsleOfMan = 'europe/isle_of_man', - EuropeIstanbul = 'europe/istanbul', - EuropeJersey = 'europe/jersey', - EuropeKaliningrad = 'europe/kaliningrad', - EuropeKirov = 'europe/kirov', - EuropeKyiv = 'europe/kyiv', - EuropeLisbon = 'europe/lisbon', - EuropeLjubljana = 'europe/ljubljana', - EuropeLondon = 'europe/london', - EuropeLuxembourg = 'europe/luxembourg', - EuropeMadrid = 'europe/madrid', - EuropeMalta = 'europe/malta', - EuropeMariehamn = 'europe/mariehamn', - EuropeMinsk = 'europe/minsk', - EuropeMonaco = 'europe/monaco', - EuropeMoscow = 'europe/moscow', - EuropeOslo = 'europe/oslo', - EuropeParis = 'europe/paris', - EuropePodgorica = 'europe/podgorica', - EuropePrague = 'europe/prague', - EuropeRiga = 'europe/riga', - EuropeRome = 'europe/rome', - EuropeSamara = 'europe/samara', - EuropeSanMarino = 'europe/san_marino', - EuropeSarajevo = 'europe/sarajevo', - EuropeSaratov = 'europe/saratov', - EuropeSimferopol = 'europe/simferopol', - EuropeSkopje = 'europe/skopje', - EuropeSofia = 'europe/sofia', - EuropeStockholm = 'europe/stockholm', - EuropeTallinn = 'europe/tallinn', - EuropeTirane = 'europe/tirane', - EuropeUlyanovsk = 'europe/ulyanovsk', - EuropeVaduz = 'europe/vaduz', - EuropeVatican = 'europe/vatican', - EuropeVienna = 'europe/vienna', - EuropeVilnius = 'europe/vilnius', - EuropeVolgograd = 'europe/volgograd', - EuropeWarsaw = 'europe/warsaw', - EuropeZagreb = 'europe/zagreb', - EuropeZurich = 'europe/zurich', - IndianAntananarivo = 'indian/antananarivo', - IndianChagos = 'indian/chagos', - IndianChristmas = 'indian/christmas', - IndianCocos = 'indian/cocos', - IndianComoro = 'indian/comoro', - IndianKerguelen = 'indian/kerguelen', - IndianMahe = 'indian/mahe', - IndianMaldives = 'indian/maldives', - IndianMauritius = 'indian/mauritius', - IndianMayotte = 'indian/mayotte', - IndianReunion = 'indian/reunion', - PacificApia = 'pacific/apia', - PacificAuckland = 'pacific/auckland', - PacificBougainville = 'pacific/bougainville', - PacificChatham = 'pacific/chatham', - PacificChuuk = 'pacific/chuuk', - PacificEaster = 'pacific/easter', - PacificEfate = 'pacific/efate', - PacificFakaofo = 'pacific/fakaofo', - PacificFiji = 'pacific/fiji', - PacificFunafuti = 'pacific/funafuti', - PacificGalapagos = 'pacific/galapagos', - PacificGambier = 'pacific/gambier', - PacificGuadalcanal = 'pacific/guadalcanal', - PacificGuam = 'pacific/guam', - PacificHonolulu = 'pacific/honolulu', - PacificKanton = 'pacific/kanton', - PacificKiritimati = 'pacific/kiritimati', - PacificKosrae = 'pacific/kosrae', - PacificKwajalein = 'pacific/kwajalein', - PacificMajuro = 'pacific/majuro', - PacificMarquesas = 'pacific/marquesas', - PacificMidway = 'pacific/midway', - PacificNauru = 'pacific/nauru', - PacificNiue = 'pacific/niue', - PacificNorfolk = 'pacific/norfolk', - PacificNoumea = 'pacific/noumea', - PacificPagoPago = 'pacific/pago_pago', - PacificPalau = 'pacific/palau', - PacificPitcairn = 'pacific/pitcairn', - PacificPohnpei = 'pacific/pohnpei', - PacificPortMoresby = 'pacific/port_moresby', - PacificRarotonga = 'pacific/rarotonga', - PacificSaipan = 'pacific/saipan', - PacificTahiti = 'pacific/tahiti', - PacificTarawa = 'pacific/tarawa', - PacificTongatapu = 'pacific/tongatapu', - PacificWake = 'pacific/wake', - PacificWallis = 'pacific/wallis', - Utc = 'utc', -} \ No newline at end of file diff --git a/src/enums/vcs-reference-type.ts b/src/enums/vcs-reference-type.ts deleted file mode 100644 index cb5270f5..00000000 --- a/src/enums/vcs-reference-type.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum VCSReferenceType { - Branch = 'branch', - Commit = 'commit', - Tag = 'tag', -} \ No newline at end of file diff --git a/src/id.ts b/src/id.ts deleted file mode 100644 index 33495cc8..00000000 --- a/src/id.ts +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Helper class to generate ID strings for resources. - */ -export class ID { - /** - * Generate an hex ID based on timestamp. - * Recreated from https://www.php.net/manual/en/function.uniqid.php - * - * @returns {string} - */ - static #hexTimestamp(): string { - const now = new Date(); - const sec = Math.floor(now.getTime() / 1000); - const msec = now.getMilliseconds(); - - // Convert to hexadecimal - const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0'); - return hexTimestamp; - } - - /** - * Uses the provided ID as the ID for the resource. - * - * @param {string} id - * @returns {string} - */ - public static custom(id: string): string { - return id - } - - /** - * Have Appwrite generate a unique ID for you. - * - * @param {number} padding. Default is 7. - * @returns {string} - */ - public static unique(padding: number = 7): string { - // Generate a unique ID with padding to have a longer ID - const baseId = ID.#hexTimestamp(); - let randomPadding = ''; - for (let i = 0; i < padding; i++) { - const randomHexDigit = Math.floor(Math.random() * 16).toString(16); - randomPadding += randomHexDigit; - } - return baseId + randomPadding; - } -} diff --git a/src/index.ts b/src/index.ts deleted file mode 100644 index 1932e75b..00000000 --- a/src/index.ts +++ /dev/null @@ -1,87 +0,0 @@ -export { Client, Query, AppwriteException } from './client'; -export { Account } from './services/account'; -export { Activities } from './services/activities'; -export { Avatars } from './services/avatars'; -export { Backups } from './services/backups'; -export { Databases } from './services/databases'; -export { Functions } from './services/functions'; -export { Graphql } from './services/graphql'; -export { Health } from './services/health'; -export { Locale } from './services/locale'; -export { Messaging } from './services/messaging'; -export { Presences } from './services/presences'; -export { Project } from './services/project'; -export { Proxy } from './services/proxy'; -export { Advisor } from './services/advisor'; -export { Sites } from './services/sites'; -export { Storage } from './services/storage'; -export { TablesDB } from './services/tables-db'; -export { Teams } from './services/teams'; -export { Tokens } from './services/tokens'; -export { Usage } from './services/usage'; -export { Users } from './services/users'; -export { Webhooks } from './services/webhooks'; -export type { Models, Payload, UploadProgress } from './client'; -export type { QueryTypes, QueryTypesList } from './query'; -export { Permission } from './permission'; -export { Role } from './role'; -export { ID } from './id'; -export { Operator, Condition } from './operator'; -export { AuthenticatorType } from './enums/authenticator-type'; -export { AuthenticationFactor } from './enums/authentication-factor'; -export { OAuthProvider } from './enums/o-auth-provider'; -export { Browser } from './enums/browser'; -export { CreditCard } from './enums/credit-card'; -export { Flag } from './enums/flag'; -export { Theme } from './enums/theme'; -export { Timezone } from './enums/timezone'; -export { BrowserPermission } from './enums/browser-permission'; -export { ImageFormat } from './enums/image-format'; -export { BackupServices } from './enums/backup-services'; -export { RelationshipType } from './enums/relationship-type'; -export { RelationMutate } from './enums/relation-mutate'; -export { DatabasesIndexType } from './enums/databases-index-type'; -export { OrderBy } from './enums/order-by'; -export { Runtime } from './enums/runtime'; -export { Scopes } from './enums/scopes'; -export { TemplateReferenceType } from './enums/template-reference-type'; -export { VCSReferenceType } from './enums/vcs-reference-type'; -export { DeploymentDownloadType } from './enums/deployment-download-type'; -export { ExecutionMethod } from './enums/execution-method'; -export { Name } from './enums/name'; -export { MessagePriority } from './enums/message-priority'; -export { SmtpEncryption } from './enums/smtp-encryption'; -export { ProjectAuthMethodId } from './enums/project-auth-method-id'; -export { ProjectKeyScopes } from './enums/project-key-scopes'; -export { ProjectOAuth2GooglePrompt } from './enums/project-o-auth-2-google-prompt'; -export { ProjectOAuthProviderId } from './enums/project-o-auth-provider-id'; -export { ProjectPolicyId } from './enums/project-policy-id'; -export { ProjectProtocolId } from './enums/project-protocol-id'; -export { ProjectServiceId } from './enums/project-service-id'; -export { ProjectSMTPSecure } from './enums/project-smtp-secure'; -export { ProjectEmailTemplateId } from './enums/project-email-template-id'; -export { ProjectEmailTemplateLocale } from './enums/project-email-template-locale'; -export { StatusCode } from './enums/status-code'; -export { ProxyResourceType } from './enums/proxy-resource-type'; -export { Framework } from './enums/framework'; -export { BuildRuntime } from './enums/build-runtime'; -export { Adapter } from './enums/adapter'; -export { Compression } from './enums/compression'; -export { ImageGravity } from './enums/image-gravity'; -export { TablesDBIndexType } from './enums/tables-db-index-type'; -export { PasswordHash } from './enums/password-hash'; -export { MessagingProviderType } from './enums/messaging-provider-type'; -export { DatabaseType } from './enums/database-type'; -export { AttributeStatus } from './enums/attribute-status'; -export { ColumnStatus } from './enums/column-status'; -export { IndexStatus } from './enums/index-status'; -export { DeploymentStatus } from './enums/deployment-status'; -export { ExecutionTrigger } from './enums/execution-trigger'; -export { ExecutionStatus } from './enums/execution-status'; -export { OAuth2GooglePrompt } from './enums/o-auth-2-google-prompt'; -export { PlatformType } from './enums/platform-type'; -export { HealthAntivirusStatus } from './enums/health-antivirus-status'; -export { HealthCheckStatus } from './enums/health-check-status'; -export { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; -export { ProxyRuleStatus } from './enums/proxy-rule-status'; -export { MessageStatus } from './enums/message-status'; diff --git a/src/inputFile.ts b/src/inputFile.ts deleted file mode 100644 index 94afbe23..00000000 --- a/src/inputFile.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { File } from "node-fetch-native-with-agent"; - -type FsPromises = { - stat: (path: string) => Promise<{ size: number }>; - open: (path: string, flags: string) => Promise<{ - read: (buffer: Uint8Array, offset: number, length: number, position: number) => Promise<{ bytesRead: number }>; - close: () => Promise<void>; - }>; - readFile: (path: string) => Promise<Uint8Array>; -}; - -function isEdgeRuntime(): boolean { - return typeof globalThis !== 'undefined' && typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime !== 'undefined'; -} - -function assertFileSystemAvailable(): void { - if (isEdgeRuntime()) { - throw new Error('File system operations are not supported in edge runtimes. Please use InputFile.fromBuffer instead.'); - } -} - -async function getFs(): Promise<FsPromises> { - assertFileSystemAvailable(); - - try { - const fs = await import('fs'); - return fs.promises; - } catch { - throw new Error('File system operations are not available in this runtime. Please use InputFile.fromBuffer instead.'); - } -} - -function getFilename(path: string): string { - const segments = path.replace(/\\/g, '/').split('/').filter(Boolean); - return segments.pop() ?? 'file'; -} - -type BlobLike = { - size: number; - slice: (start: number, end: number) => BlobLike; - arrayBuffer: () => Promise<ArrayBuffer>; -}; - -type InputFileSource = - | { type: 'path'; path: string } - | { type: 'buffer'; data: Uint8Array } - | { type: 'blob'; data: BlobLike }; - -export class InputFile { - private source: InputFileSource; - filename: string; - - private constructor(source: InputFileSource, filename: string) { - this.source = source; - this.filename = filename; - } - - static fromBuffer(parts: BlobLike | Uint8Array | ArrayBuffer | string, name: string): InputFile { - if (parts && !ArrayBuffer.isView(parts) && typeof (parts as BlobLike).arrayBuffer === 'function') { - return new InputFile({ type: 'blob', data: parts as BlobLike }, name); - } - - if (typeof parts === 'string') { - return new InputFile({ type: 'buffer', data: new TextEncoder().encode(parts) }, name); - } - - if (parts instanceof ArrayBuffer) { - return new InputFile({ type: 'buffer', data: new Uint8Array(parts) }, name); - } - - if (ArrayBuffer.isView(parts)) { - return new InputFile({ - type: 'buffer', - data: new Uint8Array(parts.buffer, parts.byteOffset, parts.byteLength), - }, name); - } - - throw new Error('Unsupported input type for InputFile.fromBuffer'); - } - - static fromPath(path: string, name?: string): InputFile { - assertFileSystemAvailable(); - return new InputFile({ type: 'path', path }, name ?? getFilename(path)); - } - - static fromPlainText(content: string, name: string): InputFile { - return new InputFile({ type: 'buffer', data: new TextEncoder().encode(content) }, name); - } - - async size(): Promise<number> { - switch (this.source.type) { - case 'path': { - const fs = await getFs(); - return (await fs.stat(this.source.path)).size; - } - case 'buffer': - return this.source.data.length; - case 'blob': - return this.source.data.size; - } - } - - async slice(start: number, end: number): Promise<Uint8Array> { - const length = end - start; - - switch (this.source.type) { - case 'path': { - const fs = await getFs(); - const handle = await fs.open(this.source.path, 'r'); - try { - const buffer = new Uint8Array(length); - const result = await handle.read(buffer, 0, length, start); - return result.bytesRead === buffer.length ? buffer : buffer.subarray(0, result.bytesRead); - } finally { - await handle.close(); - } - } - case 'buffer': - return this.source.data.subarray(start, end); - case 'blob': { - const arrayBuffer = await this.source.data.slice(start, end).arrayBuffer(); - return new Uint8Array(arrayBuffer); - } - } - } - - async toFile(): Promise<File> { - const data = await this.toUint8Array(); - return new File([data], this.filename); - } - - private async toUint8Array(): Promise<Uint8Array> { - switch (this.source.type) { - case 'path': { - const fs = await getFs(); - return await fs.readFile(this.source.path); - } - case 'buffer': - return this.source.data; - case 'blob': - return new Uint8Array(await this.source.data.arrayBuffer()); - } - } -} diff --git a/src/models.ts b/src/models.ts deleted file mode 100644 index de934950..00000000 --- a/src/models.ts +++ /dev/null @@ -1,7091 +0,0 @@ -import { DatabaseType } from "./enums/database-type" -import { AttributeStatus } from "./enums/attribute-status" -import { ColumnStatus } from "./enums/column-status" -import { IndexStatus } from "./enums/index-status" -import { DeploymentStatus } from "./enums/deployment-status" -import { ExecutionTrigger } from "./enums/execution-trigger" -import { ExecutionStatus } from "./enums/execution-status" -import { ProjectAuthMethodId } from "./enums/project-auth-method-id" -import { ProjectServiceId } from "./enums/project-service-id" -import { ProjectProtocolId } from "./enums/project-protocol-id" -import { OAuth2GooglePrompt } from "./enums/o-auth-2-google-prompt" -import { PlatformType } from "./enums/platform-type" -import { HealthAntivirusStatus } from "./enums/health-antivirus-status" -import { HealthCheckStatus } from "./enums/health-check-status" -import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-resource-type" -import { ProxyRuleStatus } from "./enums/proxy-rule-status" -import { MessageStatus } from "./enums/message-status" - -/** - * Appwrite Models - */ -export namespace Models { - - declare const __default: unique symbol; - - /** - * Rows List - */ - export type RowList<Row extends Models.Row = Models.DefaultRow> = { - /** - * Total number of rows that matched your query. - */ - total: number; - /** - * List of rows. - */ - rows: Row[]; - } - - /** - * Documents List - */ - export type DocumentList<Document extends Models.Document = Models.DefaultDocument> = { - /** - * Total number of documents that matched your query. - */ - total: number; - /** - * List of documents. - */ - documents: Document[]; - } - - /** - * Presences List - */ - export type PresenceList<Presence extends Models.Presence = Models.DefaultPresence> = { - /** - * Total number of presences that matched your query. - */ - total: number; - /** - * List of presences. - */ - presences: Presence[]; - } - - /** - * Tables List - */ - export type TableList = { - /** - * Total number of tables that matched your query. - */ - total: number; - /** - * List of tables. - */ - tables: Table[]; - } - - /** - * Collections List - */ - export type CollectionList = { - /** - * Total number of collections that matched your query. - */ - total: number; - /** - * List of collections. - */ - collections: Collection[]; - } - - /** - * Databases List - */ - export type DatabaseList = { - /** - * Total number of databases that matched your query. - */ - total: number; - /** - * List of databases. - */ - databases: Database[]; - } - - /** - * Indexes List - */ - export type IndexList = { - /** - * Total number of indexes that matched your query. - */ - total: number; - /** - * List of indexes. - */ - indexes: Index[]; - } - - /** - * Column Indexes List - */ - export type ColumnIndexList = { - /** - * Total number of indexes that matched your query. - */ - total: number; - /** - * List of indexes. - */ - indexes: ColumnIndex[]; - } - - /** - * Users List - */ - export type UserList<Preferences extends Models.Preferences = Models.DefaultPreferences> = { - /** - * Total number of users that matched your query. - */ - total: number; - /** - * List of users. - */ - users: User<Preferences>[]; - } - - /** - * Sessions List - */ - export type SessionList = { - /** - * Total number of sessions that matched your query. - */ - total: number; - /** - * List of sessions. - */ - sessions: Session[]; - } - - /** - * Identities List - */ - export type IdentityList = { - /** - * Total number of identities that matched your query. - */ - total: number; - /** - * List of identities. - */ - identities: Identity[]; - } - - /** - * Logs List - */ - export type LogList = { - /** - * Total number of logs that matched your query. - */ - total: number; - /** - * List of logs. - */ - logs: Log[]; - } - - /** - * Files List - */ - export type FileList = { - /** - * Total number of files that matched your query. - */ - total: number; - /** - * List of files. - */ - files: File[]; - } - - /** - * Buckets List - */ - export type BucketList = { - /** - * Total number of buckets that matched your query. - */ - total: number; - /** - * List of buckets. - */ - buckets: Bucket[]; - } - - /** - * Resource Tokens List - */ - export type ResourceTokenList = { - /** - * Total number of tokens that matched your query. - */ - total: number; - /** - * List of tokens. - */ - tokens: ResourceToken[]; - } - - /** - * Teams List - */ - export type TeamList<Preferences extends Models.Preferences = Models.DefaultPreferences> = { - /** - * Total number of teams that matched your query. - */ - total: number; - /** - * List of teams. - */ - teams: Team<Preferences>[]; - } - - /** - * Memberships List - */ - export type MembershipList = { - /** - * Total number of memberships that matched your query. - */ - total: number; - /** - * List of memberships. - */ - memberships: Membership[]; - } - - /** - * Sites List - */ - export type SiteList = { - /** - * Total number of sites that matched your query. - */ - total: number; - /** - * List of sites. - */ - sites: Site[]; - } - - /** - * Functions List - */ - export type FunctionList = { - /** - * Total number of functions that matched your query. - */ - total: number; - /** - * List of functions. - */ - functions: Function[]; - } - - /** - * Frameworks List - */ - export type FrameworkList = { - /** - * Total number of frameworks that matched your query. - */ - total: number; - /** - * List of frameworks. - */ - frameworks: Framework[]; - } - - /** - * Runtimes List - */ - export type RuntimeList = { - /** - * Total number of runtimes that matched your query. - */ - total: number; - /** - * List of runtimes. - */ - runtimes: Runtime[]; - } - - /** - * Deployments List - */ - export type DeploymentList = { - /** - * Total number of deployments that matched your query. - */ - total: number; - /** - * List of deployments. - */ - deployments: Deployment[]; - } - - /** - * Executions List - */ - export type ExecutionList = { - /** - * Total number of executions that matched your query. - */ - total: number; - /** - * List of executions. - */ - executions: Execution[]; - } - - /** - * Webhooks List - */ - export type WebhookList = { - /** - * Total number of webhooks that matched your query. - */ - total: number; - /** - * List of webhooks. - */ - webhooks: Webhook[]; - } - - /** - * API Keys List - */ - export type KeyList = { - /** - * Total number of keys that matched your query. - */ - total: number; - /** - * List of keys. - */ - keys: Key[]; - } - - /** - * Countries List - */ - export type CountryList = { - /** - * Total number of countries that matched your query. - */ - total: number; - /** - * List of countries. - */ - countries: Country[]; - } - - /** - * Continents List - */ - export type ContinentList = { - /** - * Total number of continents that matched your query. - */ - total: number; - /** - * List of continents. - */ - continents: Continent[]; - } - - /** - * Languages List - */ - export type LanguageList = { - /** - * Total number of languages that matched your query. - */ - total: number; - /** - * List of languages. - */ - languages: Language[]; - } - - /** - * Currencies List - */ - export type CurrencyList = { - /** - * Total number of currencies that matched your query. - */ - total: number; - /** - * List of currencies. - */ - currencies: Currency[]; - } - - /** - * Phones List - */ - export type PhoneList = { - /** - * Total number of phones that matched your query. - */ - total: number; - /** - * List of phones. - */ - phones: Phone[]; - } - - /** - * Variables List - */ - export type VariableList = { - /** - * Total number of variables that matched your query. - */ - total: number; - /** - * List of variables. - */ - variables: Variable[]; - } - - /** - * Mock Numbers List - */ - export type MockNumberList = { - /** - * Total number of mockNumbers that matched your query. - */ - total: number; - /** - * List of mockNumbers. - */ - mockNumbers: MockNumber[]; - } - - /** - * Policies List - */ - export type PolicyList = { - /** - * Total number of policies in the given project. - */ - total: number; - /** - * List of policies. - */ - policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy)[]; - } - - /** - * Email Templates List - */ - export type EmailTemplateList = { - /** - * Total number of templates that matched your query. - */ - total: number; - /** - * List of templates. - */ - templates: EmailTemplate[]; - } - - /** - * Status List - */ - export type HealthStatusList = { - /** - * Total number of statuses that matched your query. - */ - total: number; - /** - * List of statuses. - */ - statuses: HealthStatus[]; - } - - /** - * Rule List - */ - export type ProxyRuleList = { - /** - * Total number of rules that matched your query. - */ - total: number; - /** - * List of rules. - */ - rules: ProxyRule[]; - } - - /** - * Locale codes list - */ - export type LocaleCodeList = { - /** - * Total number of localeCodes that matched your query. - */ - total: number; - /** - * List of localeCodes. - */ - localeCodes: LocaleCode[]; - } - - /** - * Provider list - */ - export type ProviderList = { - /** - * Total number of providers that matched your query. - */ - total: number; - /** - * List of providers. - */ - providers: Provider[]; - } - - /** - * Message list - */ - export type MessageList = { - /** - * Total number of messages that matched your query. - */ - total: number; - /** - * List of messages. - */ - messages: Message[]; - } - - /** - * Topic list - */ - export type TopicList = { - /** - * Total number of topics that matched your query. - */ - total: number; - /** - * List of topics. - */ - topics: Topic[]; - } - - /** - * Subscriber list - */ - export type SubscriberList = { - /** - * Total number of subscribers that matched your query. - */ - total: number; - /** - * List of subscribers. - */ - subscribers: Subscriber[]; - } - - /** - * Target list - */ - export type TargetList = { - /** - * Total number of targets that matched your query. - */ - total: number; - /** - * List of targets. - */ - targets: Target[]; - } - - /** - * Transaction List - */ - export type TransactionList = { - /** - * Total number of transactions that matched your query. - */ - total: number; - /** - * List of transactions. - */ - transactions: Transaction[]; - } - - /** - * Specifications List - */ - export type SpecificationList = { - /** - * Total number of specifications that matched your query. - */ - total: number; - /** - * List of specifications. - */ - specifications: Specification[]; - } - - /** - * Insights List - */ - export type InsightList = { - /** - * Total number of insights that matched your query. - */ - total: number; - /** - * List of insights. - */ - insights: Insight[]; - } - - /** - * Reports List - */ - export type ReportList = { - /** - * Total number of reports that matched your query. - */ - total: number; - /** - * List of reports. - */ - reports: Report[]; - } - - /** - * Database - */ - export type Database = { - /** - * Database ID. - */ - $id: string; - /** - * Database name. - */ - name: string; - /** - * Database creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Database update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. - */ - enabled: boolean; - /** - * Database type. - */ - type: DatabaseType; - /** - * Database backup policies. - */ - policies: BackupPolicy[]; - /** - * Database backup archives. - */ - archives: BackupArchive[]; - } - - /** - * Collection - */ - export type Collection = { - /** - * Collection ID. - */ - $id: string; - /** - * Collection creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Collection update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * Database ID. - */ - databaseId: string; - /** - * Collection name. - */ - name: string; - /** - * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. - */ - enabled: boolean; - /** - * Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - documentSecurity: boolean; - /** - * Collection attributes. - */ - attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; - /** - * Collection indexes. - */ - indexes: Index[]; - /** - * Maximum document size in bytes. Returns 0 when no limit applies. - */ - bytesMax: number; - /** - * Currently used document size in bytes based on defined attributes. - */ - bytesUsed: number; - } - - /** - * Attributes List - */ - export type AttributeList = { - /** - * Total number of attributes in the given collection. - */ - total: number; - /** - * List of attributes. - */ - attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; - } - - /** - * AttributeString - */ - export type AttributeString = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Attribute size. - */ - size: number; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * AttributeInteger - */ - export type AttributeInteger = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number | bigint; - /** - * Maximum value to enforce for new documents. - */ - max?: number | bigint; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: number; - } - - /** - * AttributeBigInt - */ - export type AttributeBigint = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number | bigint; - /** - * Maximum value to enforce for new documents. - */ - max?: number | bigint; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: number | bigint; - } - - /** - * AttributeFloat - */ - export type AttributeFloat = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number; - /** - * Maximum value to enforce for new documents. - */ - max?: number; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: number; - } - - /** - * AttributeBoolean - */ - export type AttributeBoolean = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: boolean; - } - - /** - * AttributeEmail - */ - export type AttributeEmail = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - } - - /** - * AttributeEnum - */ - export type AttributeEnum = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Array of elements in enumerated type. - */ - elements: string[]; - /** - * String format. - */ - format: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - } - - /** - * AttributeIP - */ - export type AttributeIp = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - } - - /** - * AttributeURL - */ - export type AttributeUrl = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - } - - /** - * AttributeDatetime - */ - export type AttributeDatetime = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * ISO 8601 format. - */ - format: string; - /** - * Default value for attribute when not provided. Only null is optional - */ - default?: string; - } - - /** - * AttributeRelationship - */ - export type AttributeRelationship = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The ID of the related collection. - */ - relatedCollection: string; - /** - * The type of the relationship. - */ - relationType: string; - /** - * Is the relationship two-way? - */ - twoWay: boolean; - /** - * The key of the two-way relationship. - */ - twoWayKey: string; - /** - * How deleting the parent document will propagate to child documents. - */ - onDelete: string; - /** - * Whether this is the parent or child side of the relationship - */ - side: string; - } - - /** - * AttributePoint - */ - export type AttributePoint = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: any[]; - } - - /** - * AttributeLine - */ - export type AttributeLine = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: any[]; - } - - /** - * AttributePolygon - */ - export type AttributePolygon = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: any[]; - } - - /** - * AttributeVarchar - */ - export type AttributeVarchar = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Attribute size. - */ - size: number; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * AttributeText - */ - export type AttributeText = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * AttributeMediumtext - */ - export type AttributeMediumtext = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * AttributeLongtext - */ - export type AttributeLongtext = { - /** - * Attribute Key. - */ - key: string; - /** - * Attribute type. - */ - type: string; - /** - * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: AttributeStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an attribute. - */ - error: string; - /** - * Is attribute required? - */ - required: boolean; - /** - * Is attribute an array? - */ - array?: boolean; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for attribute when not provided. Cannot be set when attribute is required. - */ - default?: string; - /** - * Defines whether this attribute is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * Table - */ - export type Table = { - /** - * Table ID. - */ - $id: string; - /** - * Table creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Table update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * Database ID. - */ - databaseId: string; - /** - * Table name. - */ - name: string; - /** - * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. - */ - enabled: boolean; - /** - * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - rowSecurity: boolean; - /** - * Table columns. - */ - columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; - /** - * Table indexes. - */ - indexes: ColumnIndex[]; - /** - * Maximum row size in bytes. Returns 0 when no limit applies. - */ - bytesMax: number; - /** - * Currently used row size in bytes based on defined columns. - */ - bytesUsed: number; - } - - /** - * Columns List - */ - export type ColumnList = { - /** - * Total number of columns in the given table. - */ - total: number; - /** - * List of columns. - */ - columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; - } - - /** - * ColumnString - */ - export type ColumnString = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Column size. - */ - size: number; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnInteger - */ - export type ColumnInteger = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number | bigint; - /** - * Maximum value to enforce for new documents. - */ - max?: number | bigint; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: number; - } - - /** - * ColumnBigInt - */ - export type ColumnBigint = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number | bigint; - /** - * Maximum value to enforce for new documents. - */ - max?: number | bigint; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: number | bigint; - } - - /** - * ColumnFloat - */ - export type ColumnFloat = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Minimum value to enforce for new documents. - */ - min?: number; - /** - * Maximum value to enforce for new documents. - */ - max?: number; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: number; - } - - /** - * ColumnBoolean - */ - export type ColumnBoolean = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: boolean; - } - - /** - * ColumnEmail - */ - export type ColumnEmail = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnEnum - */ - export type ColumnEnum = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Array of elements in enumerated type. - */ - elements: string[]; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnIP - */ - export type ColumnIp = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnURL - */ - export type ColumnUrl = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * String format. - */ - format: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - } - - /** - * ColumnDatetime - */ - export type ColumnDatetime = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * ISO 8601 format. - */ - format: string; - /** - * Default value for column when not provided. Only null is optional - */ - default?: string; - } - - /** - * ColumnRelationship - */ - export type ColumnRelationship = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The ID of the related table. - */ - relatedTable: string; - /** - * The type of the relationship. - */ - relationType: string; - /** - * Is the relationship two-way? - */ - twoWay: boolean; - /** - * The key of the two-way relationship. - */ - twoWayKey: string; - /** - * How deleting the parent document will propagate to child documents. - */ - onDelete: string; - /** - * Whether this is the parent or child side of the relationship - */ - side: string; - } - - /** - * ColumnPoint - */ - export type ColumnPoint = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: any[]; - } - - /** - * ColumnLine - */ - export type ColumnLine = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: any[]; - } - - /** - * ColumnPolygon - */ - export type ColumnPolygon = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: any[]; - } - - /** - * ColumnVarchar - */ - export type ColumnVarchar = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Column size. - */ - size: number; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnText - */ - export type ColumnText = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnMediumtext - */ - export type ColumnMediumtext = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * ColumnLongtext - */ - export type ColumnLongtext = { - /** - * Column Key. - */ - key: string; - /** - * Column type. - */ - type: string; - /** - * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: ColumnStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an column. - */ - error: string; - /** - * Is column required? - */ - required: boolean; - /** - * Is column an array? - */ - array?: boolean; - /** - * Column creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Column update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Default value for column when not provided. Cannot be set when column is required. - */ - default?: string; - /** - * Defines whether this column is encrypted or not. - */ - encrypt?: boolean; - } - - /** - * Index - */ - export type Index = { - /** - * Index ID. - */ - $id: string; - /** - * Index creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Index update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Index key. - */ - key: string; - /** - * Index type. - */ - type: string; - /** - * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: IndexStatus; - /** - * Error message. Displays error generated on failure of creating or deleting an index. - */ - error: string; - /** - * Index attributes. - */ - attributes: string[]; - /** - * Index attributes length. - */ - lengths: number[]; - /** - * Index orders. - */ - orders?: string[]; - } - - /** - * Index - */ - export type ColumnIndex = { - /** - * Index ID. - */ - $id: string; - /** - * Index creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Index update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Index Key. - */ - key: string; - /** - * Index type. - */ - type: string; - /** - * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` - */ - status: string; - /** - * Error message. Displays error generated on failure of creating or deleting an index. - */ - error: string; - /** - * Index columns. - */ - columns: string[]; - /** - * Index columns length. - */ - lengths: number[]; - /** - * Index orders. - */ - orders?: string[]; - } - - /** - * Row - */ - export type Row = { - /** - * Row ID. - */ - $id: string; - /** - * Row sequence ID. - */ - $sequence: string; - /** - * Table ID. - */ - $tableId: string; - /** - * Database ID. - */ - $databaseId: string; - /** - * Row creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Row update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - } - - export type DefaultRow = Row & { - [key: string]: any; - [__default]: true; - }; - - /** - * Document - */ - export type Document = { - /** - * Document ID. - */ - $id: string; - /** - * Document sequence ID. - */ - $sequence: string; - /** - * Collection ID. - */ - $collectionId: string; - /** - * Database ID. - */ - $databaseId: string; - /** - * Document creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Document update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - } - - export type DefaultDocument = Document & { - [key: string]: any; - [__default]: true; - }; - - /** - * Presence - */ - export type Presence = { - /** - * Presence ID. - */ - $id: string; - /** - * Presence creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Presence update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * User ID. - */ - userId: string; - /** - * Presence status. - */ - status?: string; - /** - * Presence source. - */ - source: string; - /** - * Presence expiry date in ISO 8601 format. - */ - expiresAt?: string; - } - - export type DefaultPresence = Presence & { - [key: string]: any; - [__default]: true; - }; - - /** - * Log - */ - export type Log = { - /** - * Event name. - */ - event: string; - /** - * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. - */ - userId: string; - /** - * User email of the actor recorded for this log. During impersonation, this is the original impersonator. - */ - userEmail: string; - /** - * User name of the actor recorded for this log. During impersonation, this is the original impersonator. - */ - userName: string; - /** - * API mode when event triggered. - */ - mode: string; - /** - * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. - */ - userType: string; - /** - * IP session in use when the session was created. - */ - ip: string; - /** - * Log creation date in ISO 8601 format. - */ - time: string; - /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - */ - osCode: string; - /** - * Operating system name. - */ - osName: string; - /** - * Operating system version. - */ - osVersion: string; - /** - * Client type. - */ - clientType: string; - /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - */ - clientCode: string; - /** - * Client name. - */ - clientName: string; - /** - * Client version. - */ - clientVersion: string; - /** - * Client engine name. - */ - clientEngine: string; - /** - * Client engine name. - */ - clientEngineVersion: string; - /** - * Device name. - */ - deviceName: string; - /** - * Device brand name. - */ - deviceBrand: string; - /** - * Device model name. - */ - deviceModel: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - } - - /** - * User - */ - export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { - /** - * User ID. - */ - $id: string; - /** - * User creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * User update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User name. - */ - name: string; - /** - * Hashed user password. - */ - password?: string; - /** - * Password hashing algorithm. - */ - hash?: string; - /** - * Password hashing algorithm configuration. - */ - hashOptions?: object; - /** - * User registration date in ISO 8601 format. - */ - registration: string; - /** - * User status. Pass `true` for enabled and `false` for disabled. - */ - status: boolean; - /** - * Labels for the user. - */ - labels: string[]; - /** - * Password update time in ISO 8601 format. - */ - passwordUpdate: string; - /** - * User email address. - */ - email: string; - /** - * User phone number in E.164 format. - */ - phone: string; - /** - * Email verification status. - */ - emailVerification: boolean; - /** - * Phone verification status. - */ - phoneVerification: boolean; - /** - * Multi factor authentication status. - */ - mfa: boolean; - /** - * User preferences as a key-value object - */ - prefs: Preferences; - /** - * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. - */ - targets: Target[]; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * Whether the user can impersonate other users. - */ - impersonator?: boolean; - /** - * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. - */ - impersonatorUserId?: string; - } - - /** - * AlgoMD5 - */ - export type AlgoMd5 = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoSHA - */ - export type AlgoSha = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoPHPass - */ - export type AlgoPhpass = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoBcrypt - */ - export type AlgoBcrypt = { - /** - * Algo type. - */ - type: string; - } - - /** - * AlgoScrypt - */ - export type AlgoScrypt = { - /** - * Algo type. - */ - type: string; - /** - * CPU complexity of computed hash. - */ - costCpu: number; - /** - * Memory complexity of computed hash. - */ - costMemory: number; - /** - * Parallelization of computed hash. - */ - costParallel: number; - /** - * Length used to compute hash. - */ - length: number; - } - - /** - * AlgoScryptModified - */ - export type AlgoScryptModified = { - /** - * Algo type. - */ - type: string; - /** - * Salt used to compute hash. - */ - salt: string; - /** - * Separator used to compute hash. - */ - saltSeparator: string; - /** - * Key used to compute hash. - */ - signerKey: string; - } - - /** - * AlgoArgon2 - */ - export type AlgoArgon2 = { - /** - * Algo type. - */ - type: string; - /** - * Memory used to compute hash. - */ - memoryCost: number; - /** - * Amount of time consumed to compute hash - */ - timeCost: number; - /** - * Number of threads used to compute hash. - */ - threads: number; - } - - /** - * Preferences - */ - export type Preferences = { - } - - export type DefaultPreferences = Preferences & { - [key: string]: any; - [__default]: true; - }; - - /** - * Session - */ - export type Session = { - /** - * Session ID. - */ - $id: string; - /** - * Session creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Session update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User ID. - */ - userId: string; - /** - * Session expiration date in ISO 8601 format. - */ - expire: string; - /** - * Session Provider. - */ - provider: string; - /** - * Session Provider User ID. - */ - providerUid: string; - /** - * Session Provider Access Token. - */ - providerAccessToken: string; - /** - * The date of when the access token expires in ISO 8601 format. - */ - providerAccessTokenExpiry: string; - /** - * Session Provider Refresh Token. - */ - providerRefreshToken: string; - /** - * IP in use when the session was created. - */ - ip: string; - /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - */ - osCode: string; - /** - * Operating system name. - */ - osName: string; - /** - * Operating system version. - */ - osVersion: string; - /** - * Client type. - */ - clientType: string; - /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - */ - clientCode: string; - /** - * Client name. - */ - clientName: string; - /** - * Client version. - */ - clientVersion: string; - /** - * Client engine name. - */ - clientEngine: string; - /** - * Client engine name. - */ - clientEngineVersion: string; - /** - * Device name. - */ - deviceName: string; - /** - * Device brand name. - */ - deviceBrand: string; - /** - * Device model name. - */ - deviceModel: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - /** - * Returns true if this the current user session. - */ - current: boolean; - /** - * Returns a list of active session factors. - */ - factors: string[]; - /** - * Secret used to authenticate the user. Only included if the request was made with an API key - */ - secret: string; - /** - * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. - */ - mfaUpdatedAt: string; - } - - /** - * Identity - */ - export type Identity = { - /** - * Identity ID. - */ - $id: string; - /** - * Identity creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Identity update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User ID. - */ - userId: string; - /** - * Identity Provider. - */ - provider: string; - /** - * ID of the User in the Identity Provider. - */ - providerUid: string; - /** - * Email of the User in the Identity Provider. - */ - providerEmail: string; - /** - * Identity Provider Access Token. - */ - providerAccessToken: string; - /** - * The date of when the access token expires in ISO 8601 format. - */ - providerAccessTokenExpiry: string; - /** - * Identity Provider Refresh Token. - */ - providerRefreshToken: string; - } - - /** - * Token - */ - export type Token = { - /** - * Token ID. - */ - $id: string; - /** - * Token creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * User ID. - */ - userId: string; - /** - * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - */ - secret: string; - /** - * Token expiration date in ISO 8601 format. - */ - expire: string; - /** - * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. - */ - phrase: string; - } - - /** - * JWT - */ - export type Jwt = { - /** - * JWT encoded string. - */ - jwt: string; - } - - /** - * Locale - */ - export type Locale = { - /** - * User IP address. - */ - ip: string; - /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format - */ - countryCode: string; - /** - * Country name. This field support localization. - */ - country: string; - /** - * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. - */ - continentCode: string; - /** - * Continent name. This field support localization. - */ - continent: string; - /** - * True if country is part of the European Union. - */ - eu: boolean; - /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format - */ - currency: string; - } - - /** - * LocaleCode - */ - export type LocaleCode = { - /** - * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) - */ - code: string; - /** - * Locale name - */ - name: string; - } - - /** - * File - */ - export type File = { - /** - * File ID. - */ - $id: string; - /** - * Bucket ID. - */ - bucketId: string; - /** - * File creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * File update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * File name. - */ - name: string; - /** - * File MD5 signature. - */ - signature: string; - /** - * File mime type. - */ - mimeType: string; - /** - * File original size in bytes. - */ - sizeOriginal: number; - /** - * File actual stored size in bytes after compression and/or encryption. - */ - sizeActual: number; - /** - * Total number of chunks available - */ - chunksTotal: number; - /** - * Total number of chunks uploaded - */ - chunksUploaded: number; - /** - * Whether file contents are encrypted at rest. - */ - encryption: boolean; - /** - * Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - */ - compression: string; - } - - /** - * Bucket - */ - export type Bucket = { - /** - * Bucket ID. - */ - $id: string; - /** - * Bucket creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Bucket update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - $permissions: string[]; - /** - * Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). - */ - fileSecurity: boolean; - /** - * Bucket name. - */ - name: string; - /** - * Bucket enabled. - */ - enabled: boolean; - /** - * Maximum file size supported. - */ - maximumFileSize: number; - /** - * Allowed file extensions. - */ - allowedFileExtensions: string[]; - /** - * Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). - */ - compression: string; - /** - * Bucket is encrypted. - */ - encryption: boolean; - /** - * Virus scanning is enabled. - */ - antivirus: boolean; - /** - * Image transformations are enabled. - */ - transformations: boolean; - /** - * Total size of this bucket in bytes. - */ - totalSize: number; - } - - /** - * ResourceToken - */ - export type ResourceToken = { - /** - * Token ID. - */ - $id: string; - /** - * Token creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Resource ID. - */ - resourceId: string; - /** - * Resource type. - */ - resourceType: string; - /** - * Token expiration date in ISO 8601 format. - */ - expire: string; - /** - * JWT encoded string. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - } - - /** - * Team - */ - export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { - /** - * Team ID. - */ - $id: string; - /** - * Team creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Team update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Team name. - */ - name: string; - /** - * Total number of team members. - */ - total: number; - /** - * Team preferences as a key-value object - */ - prefs: Preferences; - } - - /** - * Membership - */ - export type Membership = { - /** - * Membership ID. - */ - $id: string; - /** - * Membership creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Membership update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * User ID. - */ - userId: string; - /** - * User name. Hide this attribute by toggling membership privacy in the Console. - */ - userName: string; - /** - * User email address. Hide this attribute by toggling membership privacy in the Console. - */ - userEmail: string; - /** - * User phone number. Hide this attribute by toggling membership privacy in the Console. - */ - userPhone: string; - /** - * Team ID. - */ - teamId: string; - /** - * Team name. - */ - teamName: string; - /** - * Date, the user has been invited to join the team in ISO 8601 format. - */ - invited: string; - /** - * Date, the user has accepted the invitation to join the team in ISO 8601 format. - */ - joined: string; - /** - * User confirmation status, true if the user has joined the team or false otherwise. - */ - confirm: boolean; - /** - * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. - */ - mfa: boolean; - /** - * User list of roles - */ - roles: string[]; - } - - /** - * Site - */ - export type Site = { - /** - * Site ID. - */ - $id: string; - /** - * Site creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Site update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Site name. - */ - name: string; - /** - * Site enabled. - */ - enabled: boolean; - /** - * Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. - */ - live: boolean; - /** - * When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - */ - logging: boolean; - /** - * Site framework. - */ - framework: string; - /** - * How many days to keep the non-active deployments before they will be automatically deleted. - */ - deploymentRetention: number; - /** - * Site's active deployment ID. - */ - deploymentId: string; - /** - * Active deployment creation date in ISO 8601 format. - */ - deploymentCreatedAt: string; - /** - * Screenshot of active deployment with light theme preference file ID. - */ - deploymentScreenshotLight: string; - /** - * Screenshot of active deployment with dark theme preference file ID. - */ - deploymentScreenshotDark: string; - /** - * Site's latest deployment ID. - */ - latestDeploymentId: string; - /** - * Latest deployment creation date in ISO 8601 format. - */ - latestDeploymentCreatedAt: string; - /** - * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - */ - latestDeploymentStatus: string; - /** - * Site variables. - */ - vars: Variable[]; - /** - * Site request timeout in seconds. - */ - timeout: number; - /** - * The install command used to install the site dependencies. - */ - installCommand: string; - /** - * The build command used to build the site. - */ - buildCommand: string; - /** - * Custom command to use when starting site runtime. - */ - startCommand: string; - /** - * The directory where the site build output is located. - */ - outputDirectory: string; - /** - * Site VCS (Version Control System) installation id. - */ - installationId: string; - /** - * VCS (Version Control System) Repository ID - */ - providerRepositoryId: string; - /** - * VCS (Version Control System) branch name - */ - providerBranch: string; - /** - * Path to site in VCS (Version Control System) repository - */ - providerRootDirectory: string; - /** - * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - */ - providerSilentMode: boolean; - /** - * Machine specification for deployment builds. - */ - buildSpecification: string; - /** - * Machine specification for SSR executions. - */ - runtimeSpecification: string; - /** - * Site build runtime. - */ - buildRuntime: string; - /** - * Site framework adapter. - */ - adapter: string; - /** - * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - */ - fallbackFile: string; - } - - /** - * Function - */ - export type Function = { - /** - * Function ID. - */ - $id: string; - /** - * Function creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Function update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Execution permissions. - */ - execute: string[]; - /** - * Function name. - */ - name: string; - /** - * Function enabled. - */ - enabled: boolean; - /** - * Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. - */ - live: boolean; - /** - * When disabled, executions will exclude logs and errors, and will be slightly faster. - */ - logging: boolean; - /** - * Function execution and build runtime. - */ - runtime: string; - /** - * How many days to keep the non-active deployments before they will be automatically deleted. - */ - deploymentRetention: number; - /** - * Function's active deployment ID. - */ - deploymentId: string; - /** - * Active deployment creation date in ISO 8601 format. - */ - deploymentCreatedAt: string; - /** - * Function's latest deployment ID. - */ - latestDeploymentId: string; - /** - * Latest deployment creation date in ISO 8601 format. - */ - latestDeploymentCreatedAt: string; - /** - * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". - */ - latestDeploymentStatus: string; - /** - * Allowed permission scopes. - */ - scopes: string[]; - /** - * Function variables. - */ - vars: Variable[]; - /** - * Function trigger events. - */ - events: string[]; - /** - * Function execution schedule in CRON format. - */ - schedule: string; - /** - * Function execution timeout in seconds. - */ - timeout: number; - /** - * The entrypoint file used to execute the deployment. - */ - entrypoint: string; - /** - * The build command used to build the deployment. - */ - commands: string; - /** - * Version of Open Runtimes used for the function. - */ - version: string; - /** - * Function VCS (Version Control System) installation id. - */ - installationId: string; - /** - * VCS (Version Control System) Repository ID - */ - providerRepositoryId: string; - /** - * VCS (Version Control System) branch name - */ - providerBranch: string; - /** - * Path to function in VCS (Version Control System) repository - */ - providerRootDirectory: string; - /** - * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests - */ - providerSilentMode: boolean; - /** - * Machine specification for deployment builds. - */ - buildSpecification: string; - /** - * Machine specification for executions. - */ - runtimeSpecification: string; - } - - /** - * Runtime - */ - export type Runtime = { - /** - * Runtime ID. - */ - $id: string; - /** - * Parent runtime key. - */ - key: string; - /** - * Runtime Name. - */ - name: string; - /** - * Runtime version. - */ - version: string; - /** - * Base Docker image used to build the runtime. - */ - base: string; - /** - * Image name of Docker Hub. - */ - image: string; - /** - * Name of the logo image. - */ - logo: string; - /** - * List of supported architectures. - */ - supports: string[]; - } - - /** - * Framework - */ - export type Framework = { - /** - * Framework key. - */ - key: string; - /** - * Framework Name. - */ - name: string; - /** - * Default runtime version. - */ - buildRuntime: string; - /** - * List of supported runtime versions. - */ - runtimes: string[]; - /** - * List of supported adapters. - */ - adapters: FrameworkAdapter[]; - } - - /** - * Framework Adapter - */ - export type FrameworkAdapter = { - /** - * Adapter key. - */ - key: string; - /** - * Default command to download dependencies. - */ - installCommand: string; - /** - * Default command to build site into output directory. - */ - buildCommand: string; - /** - * Default output directory of build. - */ - outputDirectory: string; - /** - * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. - */ - fallbackFile: string; - } - - /** - * Deployment - */ - export type Deployment = { - /** - * Deployment ID. - */ - $id: string; - /** - * Deployment creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Deployment update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Type of deployment. - */ - type: string; - /** - * Resource ID. - */ - resourceId: string; - /** - * Resource type. - */ - resourceType: string; - /** - * The entrypoint file to use to execute the deployment code. - */ - entrypoint: string; - /** - * The code size in bytes. - */ - sourceSize: number; - /** - * The build output size in bytes. - */ - buildSize: number; - /** - * The total size in bytes (source and build output). - */ - totalSize: number; - /** - * The current build ID. - */ - buildId: string; - /** - * Whether the deployment should be automatically activated. - */ - activate: boolean; - /** - * Screenshot with light theme preference file ID. - */ - screenshotLight: string; - /** - * Screenshot with dark theme preference file ID. - */ - screenshotDark: string; - /** - * The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". - */ - status: DeploymentStatus; - /** - * The build logs. - */ - buildLogs: string; - /** - * The current build time in seconds. - */ - buildDuration: number; - /** - * The name of the vcs provider repository - */ - providerRepositoryName: string; - /** - * The name of the vcs provider repository owner - */ - providerRepositoryOwner: string; - /** - * The url of the vcs provider repository - */ - providerRepositoryUrl: string; - /** - * The commit hash of the vcs commit - */ - providerCommitHash: string; - /** - * The url of vcs commit author - */ - providerCommitAuthorUrl: string; - /** - * The name of vcs commit author - */ - providerCommitAuthor: string; - /** - * The commit message - */ - providerCommitMessage: string; - /** - * The url of the vcs commit - */ - providerCommitUrl: string; - /** - * The branch of the vcs repository - */ - providerBranch: string; - /** - * The branch of the vcs repository - */ - providerBranchUrl: string; - } - - /** - * Execution - */ - export type Execution = { - /** - * Execution ID. - */ - $id: string; - /** - * Execution creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Execution update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Execution roles. - */ - $permissions: string[]; - /** - * Function ID. - */ - functionId: string; - /** - * Function's deployment ID used to create the execution. - */ - deploymentId: string; - /** - * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. - */ - trigger: ExecutionTrigger; - /** - * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. - */ - status: ExecutionStatus; - /** - * HTTP request method type. - */ - requestMethod: string; - /** - * HTTP request path and query. - */ - requestPath: string; - /** - * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - */ - requestHeaders: Headers[]; - /** - * HTTP response status code. - */ - responseStatusCode: number; - /** - * HTTP response body. This will return empty unless execution is created as synchronous. - */ - responseBody: string; - /** - * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. - */ - responseHeaders: Headers[]; - /** - * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - */ - logs: string; - /** - * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. - */ - errors: string; - /** - * Resource(function/site) execution duration in seconds. - */ - duration: number; - /** - * The scheduled time for execution. If left empty, execution will be queued immediately. - */ - scheduledAt?: string; - } - - /** - * Project - */ - export type Project = { - /** - * Project ID. - */ - $id: string; - /** - * Project creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Project update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Project name. - */ - name: string; - /** - * Project team ID. - */ - teamId: string; - /** - * Deprecated since 1.9.5: List of dev keys. - */ - devKeys: DevKey[]; - /** - * Status for custom SMTP - */ - smtpEnabled: boolean; - /** - * SMTP sender name - */ - smtpSenderName: string; - /** - * SMTP sender email - */ - smtpSenderEmail: string; - /** - * SMTP reply to name - */ - smtpReplyToName: string; - /** - * SMTP reply to email - */ - smtpReplyToEmail: string; - /** - * SMTP server host name - */ - smtpHost: string; - /** - * SMTP server port - */ - smtpPort: number; - /** - * SMTP server username - */ - smtpUsername: string; - /** - * SMTP server password. This property is write-only and always returned empty. - */ - smtpPassword: string; - /** - * SMTP server secure protocol - */ - smtpSecure: string; - /** - * Number of times the ping was received for this project. - */ - pingCount: number; - /** - * Last ping datetime in ISO 8601 format. - */ - pingedAt: string; - /** - * Labels for the project. - */ - labels: string[]; - /** - * Project status - */ - status: string; - /** - * List of auth methods. - */ - authMethods: ProjectAuthMethod[]; - /** - * List of services. - */ - services: ProjectService[]; - /** - * List of protocols. - */ - protocols: ProjectProtocol[]; - /** - * Project region - */ - region: string; - /** - * Billing limits reached - */ - billingLimits?: BillingLimits; - /** - * Project blocks information - */ - blocks: Block[]; - /** - * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. - */ - consoleAccessedAt: string; - } - - /** - * ProjectAuthMethod - */ - export type ProjectAuthMethod = { - /** - * Auth method ID. - */ - $id: ProjectAuthMethodId; - /** - * Auth method status. - */ - enabled: boolean; - } - - /** - * ProjectService - */ - export type ProjectService = { - /** - * Service ID. - */ - $id: ProjectServiceId; - /** - * Service status. - */ - enabled: boolean; - } - - /** - * ProjectProtocol - */ - export type ProjectProtocol = { - /** - * Protocol ID. - */ - $id: ProjectProtocolId; - /** - * Protocol status. - */ - enabled: boolean; - } - - /** - * Webhook - */ - export type Webhook = { - /** - * Webhook ID. - */ - $id: string; - /** - * Webhook creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Webhook update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Webhook name. - */ - name: string; - /** - * Webhook URL endpoint. - */ - url: string; - /** - * Webhook trigger events. - */ - events: string[]; - /** - * Indicates if SSL / TLS certificate verification is enabled. - */ - tls: boolean; - /** - * HTTP basic authentication username. - */ - authUsername: string; - /** - * HTTP basic authentication password. - */ - authPassword: string; - /** - * Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. - */ - secret: string; - /** - * Indicates if this webhook is enabled. - */ - enabled: boolean; - /** - * Webhook error logs from the most recent failure. - */ - logs: string; - /** - * Number of consecutive failed webhook attempts. - */ - attempts: number; - } - - /** - * Key - */ - export type Key = { - /** - * Key ID. - */ - $id: string; - /** - * Key creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Key update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Key name. - */ - name: string; - /** - * Key expiration date in ISO 8601 format. - */ - expire: string; - /** - * Allowed permission scopes. - */ - scopes: string[]; - /** - * Secret key. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * List of SDK user agents that used this key. - */ - sdks: string[]; - } - - /** - * Ephemeral Key - */ - export type EphemeralKey = { - /** - * Key ID. - */ - $id: string; - /** - * Key creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Key update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Key name. - */ - name: string; - /** - * Key expiration date in ISO 8601 format. - */ - expire: string; - /** - * Allowed permission scopes. - */ - scopes: string[]; - /** - * Secret key. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * List of SDK user agents that used this key. - */ - sdks: string[]; - } - - /** - * DevKey - */ - export type DevKey = { - /** - * Key ID. - */ - $id: string; - /** - * Key creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Key update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Key name. - */ - name: string; - /** - * Key expiration date in ISO 8601 format. - */ - expire: string; - /** - * Secret key. - */ - secret: string; - /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. - */ - accessedAt: string; - /** - * List of SDK user agents that used this key. - */ - sdks: string[]; - } - - /** - * Mock Number - */ - export type MockNumber = { - /** - * Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. - */ - number: string; - /** - * Mock OTP for the number. - */ - otp: string; - /** - * Attribute creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Attribute update date in ISO 8601 format. - */ - $updatedAt: string; - } - - /** - * OAuth2GitHub - */ - export type OAuth2Github = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. - */ - clientId: string; - /** - * GitHub OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Discord - */ - export type OAuth2Discord = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Discord OAuth2 client ID. - */ - clientId: string; - /** - * Discord OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Figma - */ - export type OAuth2Figma = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Figma OAuth2 client ID. - */ - clientId: string; - /** - * Figma OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Dropbox - */ - export type OAuth2Dropbox = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Dropbox OAuth2 app key. - */ - appKey: string; - /** - * Dropbox OAuth2 app secret. - */ - appSecret: string; - } - - /** - * OAuth2Dailymotion - */ - export type OAuth2Dailymotion = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Dailymotion OAuth2 API key. - */ - apiKey: string; - /** - * Dailymotion OAuth2 API secret. - */ - apiSecret: string; - } - - /** - * OAuth2Bitbucket - */ - export type OAuth2Bitbucket = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Bitbucket OAuth2 key. - */ - key: string; - /** - * Bitbucket OAuth2 secret. - */ - secret: string; - } - - /** - * OAuth2Bitly - */ - export type OAuth2Bitly = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Bitly OAuth2 client ID. - */ - clientId: string; - /** - * Bitly OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Box - */ - export type OAuth2Box = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Box OAuth2 client ID. - */ - clientId: string; - /** - * Box OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Autodesk - */ - export type OAuth2Autodesk = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Autodesk OAuth2 client ID. - */ - clientId: string; - /** - * Autodesk OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Google - */ - export type OAuth2Google = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Google OAuth2 client ID. - */ - clientId: string; - /** - * Google OAuth2 client secret. - */ - clientSecret: string; - /** - * Google OAuth2 prompt values. - */ - prompt: OAuth2GooglePrompt[]; - } - - /** - * OAuth2Zoom - */ - export type OAuth2Zoom = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Zoom OAuth2 client ID. - */ - clientId: string; - /** - * Zoom OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Zoho - */ - export type OAuth2Zoho = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Zoho OAuth2 client ID. - */ - clientId: string; - /** - * Zoho OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Yandex - */ - export type OAuth2Yandex = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Yandex OAuth2 client ID. - */ - clientId: string; - /** - * Yandex OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2X - */ - export type OAuth2X = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * X OAuth2 customer key. - */ - customerKey: string; - /** - * X OAuth2 secret key. - */ - secretKey: string; - } - - /** - * OAuth2WordPress - */ - export type OAuth2WordPress = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * WordPress OAuth2 client ID. - */ - clientId: string; - /** - * WordPress OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Twitch - */ - export type OAuth2Twitch = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Twitch OAuth2 client ID. - */ - clientId: string; - /** - * Twitch OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Stripe - */ - export type OAuth2Stripe = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Stripe OAuth2 client ID. - */ - clientId: string; - /** - * Stripe OAuth2 API secret key. - */ - apiSecretKey: string; - } - - /** - * OAuth2Spotify - */ - export type OAuth2Spotify = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Spotify OAuth2 client ID. - */ - clientId: string; - /** - * Spotify OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Slack - */ - export type OAuth2Slack = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Slack OAuth2 client ID. - */ - clientId: string; - /** - * Slack OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Podio - */ - export type OAuth2Podio = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Podio OAuth2 client ID. - */ - clientId: string; - /** - * Podio OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Notion - */ - export type OAuth2Notion = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Notion OAuth2 client ID. - */ - oauthClientId: string; - /** - * Notion OAuth2 client secret. - */ - oauthClientSecret: string; - } - - /** - * OAuth2Salesforce - */ - export type OAuth2Salesforce = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Salesforce OAuth2 consumer key. - */ - customerKey: string; - /** - * Salesforce OAuth2 consumer secret. - */ - customerSecret: string; - } - - /** - * OAuth2Yahoo - */ - export type OAuth2Yahoo = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Yahoo OAuth2 client ID. - */ - clientId: string; - /** - * Yahoo OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Linkedin - */ - export type OAuth2Linkedin = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * LinkedIn OAuth2 client ID. - */ - clientId: string; - /** - * LinkedIn OAuth2 primary client secret. - */ - primaryClientSecret: string; - } - - /** - * OAuth2Disqus - */ - export type OAuth2Disqus = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Disqus OAuth2 public key. - */ - publicKey: string; - /** - * Disqus OAuth2 secret key. - */ - secretKey: string; - } - - /** - * OAuth2Amazon - */ - export type OAuth2Amazon = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Amazon OAuth2 client ID. - */ - clientId: string; - /** - * Amazon OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Etsy - */ - export type OAuth2Etsy = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Etsy OAuth2 keystring. - */ - keyString: string; - /** - * Etsy OAuth2 shared secret. - */ - sharedSecret: string; - } - - /** - * OAuth2Facebook - */ - export type OAuth2Facebook = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Facebook OAuth2 app ID. - */ - appId: string; - /** - * Facebook OAuth2 app secret. - */ - appSecret: string; - } - - /** - * OAuth2Tradeshift - */ - export type OAuth2Tradeshift = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Tradeshift OAuth2 client ID. - */ - oauth2ClientId: string; - /** - * Tradeshift OAuth2 client secret. - */ - oauth2ClientSecret: string; - } - - /** - * OAuth2Paypal - */ - export type OAuth2Paypal = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * PayPal OAuth2 client ID. - */ - clientId: string; - /** - * PayPal OAuth2 secret key. - */ - secretKey: string; - } - - /** - * OAuth2Gitlab - */ - export type OAuth2Gitlab = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * GitLab OAuth2 application ID. - */ - applicationId: string; - /** - * GitLab OAuth2 secret. - */ - secret: string; - /** - * GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. - */ - endpoint: string; - } - - /** - * OAuth2Authentik - */ - export type OAuth2Authentik = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Authentik OAuth2 client ID. - */ - clientId: string; - /** - * Authentik OAuth2 client secret. - */ - clientSecret: string; - /** - * Authentik OAuth2 endpoint domain. - */ - endpoint: string; - } - - /** - * OAuth2Auth0 - */ - export type OAuth2Auth0 = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Auth0 OAuth2 client ID. - */ - clientId: string; - /** - * Auth0 OAuth2 client secret. - */ - clientSecret: string; - /** - * Auth0 OAuth2 endpoint domain. - */ - endpoint: string; - } - - /** - * OAuth2FusionAuth - */ - export type OAuth2FusionAuth = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * FusionAuth OAuth2 client ID. - */ - clientId: string; - /** - * FusionAuth OAuth2 client secret. - */ - clientSecret: string; - /** - * FusionAuth OAuth2 endpoint domain. - */ - endpoint: string; - } - - /** - * OAuth2Keycloak - */ - export type OAuth2Keycloak = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Keycloak OAuth2 client ID. - */ - clientId: string; - /** - * Keycloak OAuth2 client secret. - */ - clientSecret: string; - /** - * Keycloak OAuth2 endpoint domain. - */ - endpoint: string; - /** - * Keycloak OAuth2 realm name. - */ - realmName: string; - } - - /** - * OAuth2Oidc - */ - export type OAuth2Oidc = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * OpenID Connect OAuth2 client ID. - */ - clientId: string; - /** - * OpenID Connect OAuth2 client secret. - */ - clientSecret: string; - /** - * OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. - */ - wellKnownURL: string; - /** - * OpenID Connect authorization endpoint URL. - */ - authorizationURL: string; - /** - * OpenID Connect token endpoint URL. - */ - tokenURL: string; - /** - * OpenID Connect user info endpoint URL. - */ - userInfoURL: string; - } - - /** - * OAuth2Okta - */ - export type OAuth2Okta = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Okta OAuth2 client ID. - */ - clientId: string; - /** - * Okta OAuth2 client secret. - */ - clientSecret: string; - /** - * Okta OAuth2 domain. - */ - domain: string; - /** - * Okta OAuth2 authorization server ID. - */ - authorizationServerId: string; - } - - /** - * OAuth2Kick - */ - export type OAuth2Kick = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Kick OAuth2 client ID. - */ - clientId: string; - /** - * Kick OAuth2 client secret. - */ - clientSecret: string; - } - - /** - * OAuth2Apple - */ - export type OAuth2Apple = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Apple OAuth2 service ID. - */ - serviceId: string; - /** - * Apple OAuth2 key ID. - */ - keyId: string; - /** - * Apple OAuth2 team ID. - */ - teamId: string; - /** - * Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. - */ - p8File: string; - } - - /** - * OAuth2Microsoft - */ - export type OAuth2Microsoft = { - /** - * OAuth2 provider ID. - */ - $id: string; - /** - * OAuth2 provider is active and can be used to create sessions. - */ - enabled: boolean; - /** - * Microsoft OAuth2 application ID. - */ - applicationId: string; - /** - * Microsoft OAuth2 application secret. - */ - applicationSecret: string; - /** - * Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. - */ - tenant: string; - } - - /** - * OAuth2 Providers List - */ - export type OAuth2ProviderList = { - /** - * Total number of OAuth2 providers in the given project. - */ - total: number; - /** - * List of OAuth2 providers. - */ - providers: (Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft)[]; - } - - /** - * Policy Password Dictionary - */ - export type PolicyPasswordDictionary = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether password dictionary policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Password History - */ - export type PolicyPasswordHistory = { - /** - * Policy ID. - */ - $id: string; - /** - * Password history length. A value of 0 means the policy is disabled. - */ - total: number; - } - - /** - * Policy Password Personal Data - */ - export type PolicyPasswordPersonalData = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether password personal data policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Session Alert - */ - export type PolicySessionAlert = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether session alert policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Session Duration - */ - export type PolicySessionDuration = { - /** - * Policy ID. - */ - $id: string; - /** - * Session duration in seconds. - */ - duration: number; - } - - /** - * Policy Session Invalidation - */ - export type PolicySessionInvalidation = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether session invalidation policy is enabled. - */ - enabled: boolean; - } - - /** - * Policy Session Limit - */ - export type PolicySessionLimit = { - /** - * Policy ID. - */ - $id: string; - /** - * Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. - */ - total: number; - } - - /** - * Policy User Limit - */ - export type PolicyUserLimit = { - /** - * Policy ID. - */ - $id: string; - /** - * Maximum number of users allowed in the project. A value of 0 means the policy is disabled. - */ - total: number; - } - - /** - * Policy Membership Privacy - */ - export type PolicyMembershipPrivacy = { - /** - * Policy ID. - */ - $id: string; - /** - * Whether user ID is visible in memberships. - */ - userId: boolean; - /** - * Whether user email is visible in memberships. - */ - userEmail: boolean; - /** - * Whether user phone is visible in memberships. - */ - userPhone: boolean; - /** - * Whether user name is visible in memberships. - */ - userName: boolean; - /** - * Whether user MFA status is visible in memberships. - */ - userMFA: boolean; - } - - /** - * Platform Web - */ - export type PlatformWeb = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Web app hostname. Empty string for other platforms. - */ - hostname: string; - } - - /** - * Platform Apple - */ - export type PlatformApple = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Apple bundle identifier. - */ - bundleIdentifier: string; - } - - /** - * Platform Android - */ - export type PlatformAndroid = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Android application ID. - */ - applicationId: string; - } - - /** - * Platform Windows - */ - export type PlatformWindows = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Windows package identifier name. - */ - packageIdentifierName: string; - } - - /** - * Platform Linux - */ - export type PlatformLinux = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Platform update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Platform name. - */ - name: string; - /** - * Platform type. Possible values are: windows, apple, android, linux, web. - */ - type: PlatformType; - /** - * Linux package name. - */ - packageName: string; - } - - /** - * Platforms List - */ - export type PlatformList = { - /** - * Total number of platforms in the given project. - */ - total: number; - /** - * List of platforms. - */ - platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; - } - - /** - * Variable - */ - export type Variable = { - /** - * Variable ID. - */ - $id: string; - /** - * Variable creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Variable creation date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Variable key. - */ - key: string; - /** - * Variable value. - */ - value: string; - /** - * Variable secret flag. Secret variables can only be updated or deleted, but never read. - */ - secret: boolean; - /** - * Service to which the variable belongs. Possible values are "project", "function" - */ - resourceType: string; - /** - * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. - */ - resourceId: string; - } - - /** - * Country - */ - export type Country = { - /** - * Country name. - */ - name: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - code: string; - } - - /** - * Continent - */ - export type Continent = { - /** - * Continent name. - */ - name: string; - /** - * Continent two letter code. - */ - code: string; - } - - /** - * Language - */ - export type Language = { - /** - * Language name. - */ - name: string; - /** - * Language two-character ISO 639-1 codes. - */ - code: string; - /** - * Language native name. - */ - nativeName: string; - } - - /** - * Currency - */ - export type Currency = { - /** - * Currency symbol. - */ - symbol: string; - /** - * Currency name. - */ - name: string; - /** - * Currency native symbol. - */ - symbolNative: string; - /** - * Number of decimal digits. - */ - decimalDigits: number; - /** - * Currency digit rounding. - */ - rounding: number; - /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. - */ - code: string; - /** - * Currency plural name - */ - namePlural: string; - } - - /** - * Phone - */ - export type Phone = { - /** - * Phone code. - */ - code: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - } - - /** - * Health Antivirus - */ - export type HealthAntivirus = { - /** - * Antivirus version. - */ - version: string; - /** - * Antivirus status. Possible values are: `disabled`, `offline`, `online` - */ - status: HealthAntivirusStatus; - } - - /** - * Health Queue - */ - export type HealthQueue = { - /** - * Amount of actions in the queue. - */ - size: number; - } - - /** - * Health Status - */ - export type HealthStatus = { - /** - * Name of the service. - */ - name: string; - /** - * Duration in milliseconds how long the health check took. - */ - ping: number; - /** - * Service status. Possible values are: `pass`, `fail` - */ - status: HealthCheckStatus; - } - - /** - * Health Certificate - */ - export type HealthCertificate = { - /** - * Certificate name - */ - name: string; - /** - * Subject SN - */ - subjectSN: string; - /** - * Issuer organisation - */ - issuerOrganisation: string; - /** - * Valid from - */ - validFrom: string; - /** - * Valid to - */ - validTo: string; - /** - * Signature type SN - */ - signatureTypeSN: string; - } - - /** - * Health Time - */ - export type HealthTime = { - /** - * Current unix timestamp on trustful remote server. - */ - remoteTime: number; - /** - * Current unix timestamp of local server where Appwrite runs. - */ - localTime: number; - /** - * Difference of unix remote and local timestamps in milliseconds. - */ - diff: number; - } - - /** - * Headers - */ - export type Headers = { - /** - * Header name. - */ - name: string; - /** - * Header value. - */ - value: string; - } - - /** - * Specification - */ - export type Specification = { - /** - * Memory size in MB. - */ - memory: number; - /** - * Number of CPUs. - */ - cpus: number; - /** - * Is size enabled. - */ - enabled: boolean; - /** - * Size slug. - */ - slug: string; - } - - /** - * Rule - */ - export type ProxyRule = { - /** - * Rule ID. - */ - $id: string; - /** - * Rule creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Rule update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Domain name. - */ - domain: string; - /** - * Action definition for the rule. Possible values are "api", "deployment", or "redirect" - */ - type: string; - /** - * Defines how the rule was created. Possible values are "manual" or "deployment" - */ - trigger: string; - /** - * URL to redirect to. Used if type is "redirect" - */ - redirectUrl: string; - /** - * Status code to apply during redirect. Used if type is "redirect" - */ - redirectStatusCode: number; - /** - * ID of deployment. Used if type is "deployment" - */ - deploymentId: string; - /** - * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". - */ - deploymentResourceType?: ProxyRuleDeploymentResourceType; - /** - * ID of deployment's resource (site or function ID). Used if type is "deployment" - */ - deploymentResourceId: string; - /** - * Name of Git branch that updates rule. Used if type is "deployment" - */ - deploymentVcsProviderBranch: string; - /** - * Domain verification status. Possible values are "unverified", "verifying", "verified" - */ - status: ProxyRuleStatus; - /** - * Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. - */ - logs: string; - /** - * Certificate auto-renewal date in ISO 8601 format. - */ - renewAt: string; - } - - /** - * EmailTemplate - */ - export type EmailTemplate = { - /** - * Template type - */ - templateId: string; - /** - * Template locale - */ - locale: string; - /** - * Template message - */ - message: string; - /** - * Name of the sender - */ - senderName: string; - /** - * Email of the sender - */ - senderEmail: string; - /** - * Reply to email address - */ - replyToEmail: string; - /** - * Reply to name - */ - replyToName: string; - /** - * Email subject - */ - subject: string; - } - - /** - * MFA Challenge - */ - export type MfaChallenge = { - /** - * Token ID. - */ - $id: string; - /** - * Token creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * User ID. - */ - userId: string; - /** - * Token expiration date in ISO 8601 format. - */ - expire: string; - } - - /** - * MFA Recovery Codes - */ - export type MfaRecoveryCodes = { - /** - * Recovery codes. - */ - recoveryCodes: string[]; - } - - /** - * MFAType - */ - export type MfaType = { - /** - * Secret token used for TOTP factor. - */ - secret: string; - /** - * URI for authenticator apps. - */ - uri: string; - } - - /** - * MFAFactors - */ - export type MfaFactors = { - /** - * Can TOTP be used for MFA challenge for this account. - */ - totp: boolean; - /** - * Can phone (SMS) be used for MFA challenge for this account. - */ - phone: boolean; - /** - * Can email be used for MFA challenge for this account. - */ - email: boolean; - /** - * Can recovery code be used for MFA challenge for this account. - */ - recoveryCode: boolean; - } - - /** - * Provider - */ - export type Provider = { - /** - * Provider ID. - */ - $id: string; - /** - * Provider creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Provider update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The name for the provider instance. - */ - name: string; - /** - * The name of the provider service. - */ - provider: string; - /** - * Is provider enabled? - */ - enabled: boolean; - /** - * Type of provider. - */ - type: string; - /** - * Provider credentials. - */ - credentials: object; - /** - * Provider options. - */ - options?: object; - } - - /** - * Message - */ - export type Message = { - /** - * Message ID. - */ - $id: string; - /** - * Message creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Message update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Message provider type. - */ - providerType: string; - /** - * Topic IDs set as recipients. - */ - topics: string[]; - /** - * User IDs set as recipients. - */ - users: string[]; - /** - * Target IDs set as recipients. - */ - targets: string[]; - /** - * The scheduled time for message. - */ - scheduledAt?: string; - /** - * The time when the message was delivered. - */ - deliveredAt?: string; - /** - * Delivery errors if any. - */ - deliveryErrors?: string[]; - /** - * Number of recipients the message was delivered to. - */ - deliveredTotal: number; - /** - * Data of the message. - */ - data: object; - /** - * Status of delivery. - */ - status: MessageStatus; - } - - /** - * Topic - */ - export type Topic = { - /** - * Topic ID. - */ - $id: string; - /** - * Topic creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Topic update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The name of the topic. - */ - name: string; - /** - * Total count of email subscribers subscribed to the topic. - */ - emailTotal: number; - /** - * Total count of SMS subscribers subscribed to the topic. - */ - smsTotal: number; - /** - * Total count of push subscribers subscribed to the topic. - */ - pushTotal: number; - /** - * Subscribe permissions. - */ - subscribe: string[]; - } - - /** - * Transaction - */ - export type Transaction = { - /** - * Transaction ID. - */ - $id: string; - /** - * Transaction creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Transaction update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. - */ - status: string; - /** - * Number of operations in the transaction. - */ - operations: number; - /** - * Expiration time in ISO 8601 format. - */ - expiresAt: string; - } - - /** - * Subscriber - */ - export type Subscriber = { - /** - * Subscriber ID. - */ - $id: string; - /** - * Subscriber creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Subscriber update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Target ID. - */ - targetId: string; - /** - * Target. - */ - target: Target; - /** - * Topic ID. - */ - userId: string; - /** - * User Name. - */ - userName: string; - /** - * Topic ID. - */ - topicId: string; - /** - * The target provider type. Can be one of the following: `email`, `sms` or `push`. - */ - providerType: string; - } - - /** - * Target - */ - export type Target = { - /** - * Target ID. - */ - $id: string; - /** - * Target creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Target update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Target Name. - */ - name: string; - /** - * User ID. - */ - userId: string; - /** - * Provider ID. - */ - providerId?: string; - /** - * The target provider type. Can be one of the following: `email`, `sms` or `push`. - */ - providerType: string; - /** - * The target identifier. - */ - identifier: string; - /** - * Is the target expired. - */ - expired: boolean; - } - - /** - * Insight - */ - export type Insight = { - /** - * Insight ID. - */ - $id: string; - /** - * Insight creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Insight update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Parent report ID. Insights always belong to a report. - */ - reportId: string; - /** - * Insight type. One of databaseIndex (legacy), tablesDBIndex, documentsDBIndex, vectorsDBIndex, databasePerformance, sitePerformance, siteAccessibility, siteSeo, functionPerformance. The index types are engine-specific so each CTA can pair the right service+method (databases.createIndex, tablesDB.createIndex, documentsDB.createIndex, or vectorsDB.createIndex). - */ - type: string; - /** - * Insight severity. One of info, warning, critical. - */ - severity: string; - /** - * Insight status. One of active, dismissed. - */ - status: string; - /** - * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. - */ - resourceType: string; - /** - * ID of the resource the insight is about. - */ - resourceId: string; - /** - * Plural noun for the parent resource that contains the insight's resource, e.g. an insight about a column index on a table → resourceType=indexes, parentResourceType=tables. Empty when the resource has no parent. - */ - parentResourceType: string; - /** - * ID of the parent resource. Empty when the resource has no parent. - */ - parentResourceId: string; - /** - * Insight title. - */ - title: string; - /** - * Short markdown summary describing the insight. - */ - summary: string; - /** - * List of call-to-action buttons attached to this insight. - */ - ctas: InsightCTA[]; - /** - * Time the insight was analyzed in ISO 8601 format. - */ - analyzedAt?: string; - /** - * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. - */ - dismissedAt?: string; - /** - * User ID that dismissed the insight. Empty when not dismissed. - */ - dismissedBy?: string; - } - - /** - * InsightCTA - */ - export type InsightCTA = { - /** - * Human-readable label for the CTA, used in UI. - */ - label: string; - /** - * Public API service (SDK namespace) the client should invoke. Must match the engine that owns the resource — for index suggestions: databases (legacy), tablesDB, documentsDB, or vectorsDB. - */ - service: string; - /** - * Public API method on the chosen service the client should invoke when this CTA is triggered. - */ - method: string; - /** - * Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). - */ - params: object; - } - - /** - * Report - */ - export type Report = { - /** - * Report ID. - */ - $id: string; - /** - * Report creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Report update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * ID of the third-party app that submitted the report. - */ - appId: string; - /** - * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. - */ - type: string; - /** - * Short, human-readable title for the report. - */ - title: string; - /** - * Markdown summary describing the report. - */ - summary: string; - /** - * Plural noun describing what the report analyzes, e.g. databases, sites, urls. - */ - targetType: string; - /** - * Free-form target identifier (URL for lighthouse, resource ID for db). - */ - target: string; - /** - * Categories covered by the report, e.g. performance, accessibility. - */ - categories: string[]; - /** - * Insights nested under this report. - */ - insights: Insight[]; - /** - * Time the report was analyzed in ISO 8601 format. - */ - analyzedAt?: string; - } - - /** - * ActivityEvent - */ - export type ActivityEvent = { - /** - * Event ID. - */ - $id: string; - /** - * User type. - */ - userType: string; - /** - * User ID. - */ - userId: string; - /** - * User Email. - */ - userEmail: string; - /** - * User Name. - */ - userName: string; - /** - * Resource parent. - */ - resourceParent: string; - /** - * Resource type. - */ - resourceType: string; - /** - * Resource ID. - */ - resourceId: string; - /** - * Resource. - */ - resource: string; - /** - * Event name. - */ - event: string; - /** - * User agent. - */ - userAgent: string; - /** - * IP address. - */ - ip: string; - /** - * API mode when event triggered. - */ - mode: string; - /** - * Location. - */ - country: string; - /** - * Log creation date in ISO 8601 format. - */ - time: string; - /** - * Project ID. - */ - projectId: string; - /** - * Team ID. - */ - teamId: string; - /** - * Hostname. - */ - hostname: string; - /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). - */ - osCode: string; - /** - * Operating system name. - */ - osName: string; - /** - * Operating system version. - */ - osVersion: string; - /** - * Client type. - */ - clientType: string; - /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). - */ - clientCode: string; - /** - * Client name. - */ - clientName: string; - /** - * Client version. - */ - clientVersion: string; - /** - * Client engine name. - */ - clientEngine: string; - /** - * Client engine name. - */ - clientEngineVersion: string; - /** - * Device name. - */ - deviceName: string; - /** - * Device brand name. - */ - deviceBrand: string; - /** - * Device model name. - */ - deviceModel: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; - /** - * Country name. - */ - countryName: string; - } - - /** - * Archive - */ - export type BackupArchive = { - /** - * Archive ID. - */ - $id: string; - /** - * Archive creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Archive update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Archive policy ID. - */ - policyId: string; - /** - * Archive size in bytes. - */ - size: number; - /** - * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. - */ - status: string; - /** - * The backup start time. - */ - startedAt: string; - /** - * Migration ID. - */ - migrationId: string; - /** - * The services that are backed up by this archive. - */ - services: string[]; - /** - * The resources that are backed up by this archive. - */ - resources: string[]; - /** - * The resource ID to backup. Set only if this archive should backup a single resource. - */ - resourceId?: string; - /** - * The resource type to backup. Set only if this archive should backup a single resource. - */ - resourceType?: string; - } - - /** - * BillingLimits - */ - export type BillingLimits = { - /** - * Bandwidth limit - */ - bandwidth?: number; - /** - * Storage limit - */ - storage?: number; - /** - * Users limit - */ - users?: number; - /** - * Executions limit - */ - executions?: number; - /** - * GBHours limit - */ - GBHours?: number; - /** - * Image transformations limit - */ - imageTransformations?: number; - /** - * Auth phone limit - */ - authPhone?: number; - /** - * Budget limit percentage - */ - budgetLimit?: number; - } - - /** - * Block - */ - export type Block = { - /** - * Block creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Resource type that is blocked - */ - resourceType: string; - /** - * Resource identifier that is blocked - */ - resourceId: string; - /** - * Reason for the block. Can be null if no reason was provided. - */ - reason?: string; - /** - * Block expiration date in ISO 8601 format. Can be null if the block does not expire. - */ - expiredAt?: string; - /** - * Name of the project this block applies to. - */ - projectName: string; - /** - * Region of the project this block applies to. - */ - region: string; - /** - * Name of the organization that owns the project. - */ - organizationName: string; - /** - * ID of the organization that owns the project. - */ - organizationId: string; - /** - * Billing plan of the organization that owns the project. - */ - billingPlan: string; - } - - /** - * backup - */ - export type BackupPolicy = { - /** - * Backup policy ID. - */ - $id: string; - /** - * Backup policy name. - */ - name: string; - /** - * Policy creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * Policy update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * The services that are backed up by this policy. - */ - services: string[]; - /** - * The resources that are backed up by this policy. - */ - resources: string[]; - /** - * The resource ID to backup. Set only if this policy should backup a single resource. - */ - resourceId?: string; - /** - * The resource type to backup. Set only if this policy should backup a single resource. - */ - resourceType?: string; - /** - * How many days to keep the backup before it will be automatically deleted. - */ - retention: number; - /** - * Policy backup schedule in CRON format. - */ - schedule: string; - /** - * Is this policy enabled. - */ - enabled: boolean; - } - - /** - * Restoration - */ - export type BackupRestoration = { - /** - * Restoration ID. - */ - $id: string; - /** - * Restoration creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Restoration update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Backup archive ID. - */ - archiveId: string; - /** - * Backup policy ID. - */ - policyId: string; - /** - * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. - */ - status: string; - /** - * The backup start time. - */ - startedAt: string; - /** - * Migration ID. - */ - migrationId: string; - /** - * The services that are backed up by this policy. - */ - services: string[]; - /** - * The resources that are backed up by this policy. - */ - resources: string[]; - /** - * Optional data in key-value object. - */ - options: string; - } - - /** - * usageEvent - */ - export type UsageEvent = { - /** - * The metric key. - */ - metric: string; - /** - * The metric value. - */ - value: number; - /** - * The event timestamp. - */ - time: string; - /** - * The API endpoint path. - */ - path: string; - /** - * The HTTP method. - */ - method: string; - /** - * HTTP status code. Stored as string to preserve unset state (empty string = not available). - */ - status: string; - /** - * The resource type. - */ - resourceType: string; - /** - * The resource ID. - */ - resourceId: string; - /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. - */ - countryCode: string; - /** - * The user agent string. - */ - userAgent: string; - } - - /** - * Usage events list - */ - export type UsageEventList = { - /** - * Total number of events that matched your query. - */ - total: number; - /** - * List of events. - */ - events: UsageEvent[]; - } - - /** - * usageGauge - */ - export type UsageGauge = { - /** - * The metric key. - */ - metric: string; - /** - * The current snapshot value. - */ - value: number; - /** - * The snapshot timestamp. - */ - time: string; - } - - /** - * Usage gauges list - */ - export type UsageGaugeList = { - /** - * Total number of gauges that matched your query. - */ - total: number; - /** - * List of gauges. - */ - gauges: UsageGauge[]; - } - - /** - * Activity event list - */ - export type ActivityEventList = { - /** - * Total number of events that matched your query. - */ - total: number; - /** - * List of events. - */ - events: ActivityEvent[]; - } - - /** - * Backup archive list - */ - export type BackupArchiveList = { - /** - * Total number of archives that matched your query. - */ - total: number; - /** - * List of archives. - */ - archives: BackupArchive[]; - } - - /** - * Backup policy list - */ - export type BackupPolicyList = { - /** - * Total number of policies that matched your query. - */ - total: number; - /** - * List of policies. - */ - policies: BackupPolicy[]; - } - - /** - * Backup restoration list - */ - export type BackupRestorationList = { - /** - * Total number of restorations that matched your query. - */ - total: number; - /** - * List of restorations. - */ - restorations: BackupRestoration[]; - } -} diff --git a/src/operator.ts b/src/operator.ts deleted file mode 100644 index 2386a6c4..00000000 --- a/src/operator.ts +++ /dev/null @@ -1,308 +0,0 @@ -type OperatorValuesSingle = string | number | boolean; -export type OperatorValuesList = string[] | number[] | boolean[] | any[]; -export type OperatorValues = OperatorValuesSingle | OperatorValuesList; - -export enum Condition { - Equal = "equal", - NotEqual = "notEqual", - GreaterThan = "greaterThan", - GreaterThanEqual = "greaterThanEqual", - LessThan = "lessThan", - LessThanEqual = "lessThanEqual", - Contains = "contains", - IsNull = "isNull", - IsNotNull = "isNotNull", -} - -/** - * Helper class to generate operator strings for atomic operations. - */ -export class Operator { - method: string; - values: OperatorValuesList | undefined; - - /** - * Constructor for Operator class. - * - * @param {string} method - * @param {OperatorValues} values - */ - constructor( - method: string, - values?: OperatorValues - ) { - this.method = method; - - if (values !== undefined) { - if (Array.isArray(values)) { - this.values = values; - } else { - this.values = [values] as OperatorValuesList; - } - } - } - - /** - * Convert the operator object to a JSON string. - * - * @returns {string} - */ - toString(): string { - return JSON.stringify({ - method: this.method, - values: this.values, - }); - } - - /** - * Increment a numeric attribute by a specified value. - * - * @param {number} value - * @param {number} max - * @returns {string} - */ - static increment = (value: number = 1, max?: number): string => { - if (isNaN(value) || !isFinite(value)) { - throw new Error("Value cannot be NaN or Infinity"); - } - if (max !== undefined && (isNaN(max) || !isFinite(max))) { - throw new Error("Max cannot be NaN or Infinity"); - } - const values: any[] = [value]; - if (max !== undefined) { - values.push(max); - } - return new Operator("increment", values).toString(); - }; - - /** - * Decrement a numeric attribute by a specified value. - * - * @param {number} value - * @param {number} min - * @returns {string} - */ - static decrement = (value: number = 1, min?: number): string => { - if (isNaN(value) || !isFinite(value)) { - throw new Error("Value cannot be NaN or Infinity"); - } - if (min !== undefined && (isNaN(min) || !isFinite(min))) { - throw new Error("Min cannot be NaN or Infinity"); - } - const values: any[] = [value]; - if (min !== undefined) { - values.push(min); - } - return new Operator("decrement", values).toString(); - }; - - /** - * Multiply a numeric attribute by a specified factor. - * - * @param {number} factor - * @param {number} max - * @returns {string} - */ - static multiply = (factor: number, max?: number): string => { - if (isNaN(factor) || !isFinite(factor)) { - throw new Error("Factor cannot be NaN or Infinity"); - } - if (max !== undefined && (isNaN(max) || !isFinite(max))) { - throw new Error("Max cannot be NaN or Infinity"); - } - const values: any[] = [factor]; - if (max !== undefined) { - values.push(max); - } - return new Operator("multiply", values).toString(); - }; - - /** - * Divide a numeric attribute by a specified divisor. - * - * @param {number} divisor - * @param {number} min - * @returns {string} - */ - static divide = (divisor: number, min?: number): string => { - if (isNaN(divisor) || !isFinite(divisor)) { - throw new Error("Divisor cannot be NaN or Infinity"); - } - if (min !== undefined && (isNaN(min) || !isFinite(min))) { - throw new Error("Min cannot be NaN or Infinity"); - } - if (divisor === 0) { - throw new Error("Divisor cannot be zero"); - } - const values: any[] = [divisor]; - if (min !== undefined) { - values.push(min); - } - return new Operator("divide", values).toString(); - }; - - /** - * Apply modulo operation on a numeric attribute. - * - * @param {number} divisor - * @returns {string} - */ - static modulo = (divisor: number): string => { - if (isNaN(divisor) || !isFinite(divisor)) { - throw new Error("Divisor cannot be NaN or Infinity"); - } - if (divisor === 0) { - throw new Error("Divisor cannot be zero"); - } - return new Operator("modulo", [divisor]).toString(); - }; - - /** - * Raise a numeric attribute to a specified power. - * - * @param {number} exponent - * @param {number} max - * @returns {string} - */ - static power = (exponent: number, max?: number): string => { - if (isNaN(exponent) || !isFinite(exponent)) { - throw new Error("Exponent cannot be NaN or Infinity"); - } - if (max !== undefined && (isNaN(max) || !isFinite(max))) { - throw new Error("Max cannot be NaN or Infinity"); - } - const values: any[] = [exponent]; - if (max !== undefined) { - values.push(max); - } - return new Operator("power", values).toString(); - }; - - /** - * Append values to an array attribute. - * - * @param {any[]} values - * @returns {string} - */ - static arrayAppend = (values: any[]): string => - new Operator("arrayAppend", values).toString(); - - /** - * Prepend values to an array attribute. - * - * @param {any[]} values - * @returns {string} - */ - static arrayPrepend = (values: any[]): string => - new Operator("arrayPrepend", values).toString(); - - /** - * Insert a value at a specific index in an array attribute. - * - * @param {number} index - * @param {any} value - * @returns {string} - */ - static arrayInsert = (index: number, value: any): string => - new Operator("arrayInsert", [index, value]).toString(); - - /** - * Remove a value from an array attribute. - * - * @param {any} value - * @returns {string} - */ - static arrayRemove = (value: any): string => - new Operator("arrayRemove", [value]).toString(); - - /** - * Remove duplicate values from an array attribute. - * - * @returns {string} - */ - static arrayUnique = (): string => - new Operator("arrayUnique", []).toString(); - - /** - * Keep only values that exist in both the current array and the provided array. - * - * @param {any[]} values - * @returns {string} - */ - static arrayIntersect = (values: any[]): string => - new Operator("arrayIntersect", values).toString(); - - /** - * Remove values from the array that exist in the provided array. - * - * @param {any[]} values - * @returns {string} - */ - static arrayDiff = (values: any[]): string => - new Operator("arrayDiff", values).toString(); - - /** - * Filter array values based on a condition. - * - * @param {Condition} condition - * @param {any} value - * @returns {string} - */ - static arrayFilter = (condition: Condition, value?: any): string => { - const values: any[] = [condition as string, value === undefined ? null : value]; - return new Operator("arrayFilter", values).toString(); - }; - - /** - * Concatenate a value to a string or array attribute. - * - * @param {any} value - * @returns {string} - */ - static stringConcat = (value: any): string => - new Operator("stringConcat", [value]).toString(); - - /** - * Replace occurrences of a search string with a replacement string. - * - * @param {string} search - * @param {string} replace - * @returns {string} - */ - static stringReplace = (search: string, replace: string): string => - new Operator("stringReplace", [search, replace]).toString(); - - /** - * Toggle a boolean attribute. - * - * @returns {string} - */ - static toggle = (): string => - new Operator("toggle", []).toString(); - - /** - * Add days to a date attribute. - * - * @param {number} days - * @returns {string} - */ - static dateAddDays = (days: number): string => - new Operator("dateAddDays", [days]).toString(); - - /** - * Subtract days from a date attribute. - * - * @param {number} days - * @returns {string} - */ - static dateSubDays = (days: number): string => - new Operator("dateSubDays", [days]).toString(); - - /** - * Set a date attribute to the current date and time. - * - * @returns {string} - */ - static dateSetNow = (): string => - new Operator("dateSetNow", []).toString(); -} diff --git a/src/permission.ts b/src/permission.ts deleted file mode 100644 index 94d9cedd..00000000 --- a/src/permission.ts +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Helper class to generate permission strings for resources. - */ -export class Permission { - /** - * Generate read permission string for the provided role. - * - * @param {string} role - * @returns {string} - */ - static read = (role: string): string => { - return `read("${role}")`; - } - - /** - * Generate write permission string for the provided role. - * - * This is an alias of update, delete, and possibly create. - * Don't use write in combination with update, delete, or create. - * - * @param {string} role - * @returns {string} - */ - static write = (role: string): string => { - return `write("${role}")`; - } - - /** - * Generate create permission string for the provided role. - * - * @param {string} role - * @returns {string} - */ - static create = (role: string): string => { - return `create("${role}")`; - } - - /** - * Generate update permission string for the provided role. - * - * @param {string} role - * @returns {string} - */ - static update = (role: string): string => { - return `update("${role}")`; - } - - /** - * Generate delete permission string for the provided role. - * - * @param {string} role - * @returns {string} - */ - static delete = (role: string): string => { - return `delete("${role}")`; - } -} diff --git a/src/query.ts b/src/query.ts deleted file mode 100644 index fdd9f407..00000000 --- a/src/query.ts +++ /dev/null @@ -1,576 +0,0 @@ -import JSONbigModule from 'json-bigint'; -const JSONbig = JSONbigModule({ useNativeBigInt: true }); - -type QueryTypesSingle = string | number | bigint | boolean; -export type QueryTypesList = string[] | number[] | bigint[] | boolean[] | Query[] | any[]; -export type QueryTypes = QueryTypesSingle | QueryTypesList; -type AttributesTypes = string | string[]; - -/** - * Helper class to generate query strings. - */ -export class Query { - method: string; - attribute: AttributesTypes | undefined; - values: QueryTypesList | undefined; - - /** - * Constructor for Query class. - * - * @param {string} method - * @param {AttributesTypes} attribute - * @param {QueryTypes} values - */ - constructor( - method: string, - attribute?: AttributesTypes, - values?: QueryTypes - ) { - this.method = method; - this.attribute = attribute; - - if (values !== undefined) { - if (Array.isArray(values)) { - this.values = values; - } else { - this.values = [values] as QueryTypesList; - } - } - } - - /** - * Convert the query object to a JSON string. - * - * @returns {string} - */ - toString(): string { - return JSONbig.stringify({ - method: this.method, - attribute: this.attribute, - values: this.values, - }); - } - - /** - * Filter resources where attribute is equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static equal = (attribute: string, value: QueryTypes): string => - new Query("equal", attribute, value).toString(); - - /** - * Filter resources where attribute is not equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static notEqual = (attribute: string, value: QueryTypes): string => - new Query("notEqual", attribute, value).toString(); - - /** - * Filter resources where attribute matches a regular expression pattern. - * - * @param {string} attribute The attribute to filter on. - * @param {string} pattern The regular expression pattern to match. - * @returns {string} - */ - static regex = (attribute: string, pattern: string): string => - new Query("regex", attribute, pattern).toString(); - - /** - * Filter resources where attribute is less than value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static lessThan = (attribute: string, value: QueryTypes): string => - new Query("lessThan", attribute, value).toString(); - - /** - * Filter resources where attribute is less than or equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static lessThanEqual = (attribute: string, value: QueryTypes): string => - new Query("lessThanEqual", attribute, value).toString(); - - /** - * Filter resources where attribute is greater than value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static greaterThan = (attribute: string, value: QueryTypes): string => - new Query("greaterThan", attribute, value).toString(); - - /** - * Filter resources where attribute is greater than or equal to value. - * - * @param {string} attribute - * @param {QueryTypes} value - * @returns {string} - */ - static greaterThanEqual = (attribute: string, value: QueryTypes): string => - new Query("greaterThanEqual", attribute, value).toString(); - - /** - * Filter resources where attribute is null. - * - * @param {string} attribute - * @returns {string} - */ - static isNull = (attribute: string): string => - new Query("isNull", attribute).toString(); - - /** - * Filter resources where attribute is not null. - * - * @param {string} attribute - * @returns {string} - */ - static isNotNull = (attribute: string): string => - new Query("isNotNull", attribute).toString(); - - /** - * Filter resources where the specified attributes exist. - * - * @param {string[]} attributes The list of attributes that must exist. - * @returns {string} - */ - static exists = (attributes: string[]): string => - new Query("exists", undefined, attributes).toString(); - - /** - * Filter resources where the specified attributes do not exist. - * - * @param {string[]} attributes The list of attributes that must not exist. - * @returns {string} - */ - static notExists = (attributes: string[]): string => - new Query("notExists", undefined, attributes).toString(); - - /** - * Filter resources where attribute is between start and end (inclusive). - * - * @param {string} attribute - * @param {string | number | bigint} start - * @param {string | number | bigint} end - * @returns {string} - */ - static between = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => - new Query("between", attribute, [start, end] as QueryTypesList).toString(); - - /** - * Filter resources where attribute starts with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static startsWith = (attribute: string, value: string): string => - new Query("startsWith", attribute, value).toString(); - - /** - * Filter resources where attribute ends with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static endsWith = (attribute: string, value: string): string => - new Query("endsWith", attribute, value).toString(); - - /** - * Specify which attributes should be returned by the API call. - * - * @param {string[]} attributes - * @returns {string} - */ - static select = (attributes: string[]): string => - new Query("select", undefined, attributes).toString(); - - /** - * Filter resources by searching attribute for value. - * A fulltext index on attribute is required for this query to work. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static search = (attribute: string, value: string): string => - new Query("search", attribute, value).toString(); - - /** - * Sort results by attribute descending. - * - * @param {string} attribute - * @returns {string} - */ - static orderDesc = (attribute: string): string => - new Query("orderDesc", attribute).toString(); - - /** - * Sort results by attribute ascending. - * - * @param {string} attribute - * @returns {string} - */ - static orderAsc = (attribute: string): string => - new Query("orderAsc", attribute).toString(); - - /** - * Sort results randomly. - * - * @returns {string} - */ - static orderRandom = (): string => - new Query("orderRandom").toString(); - - /** - * Return results after documentId. - * - * @param {string} documentId - * @returns {string} - */ - static cursorAfter = (documentId: string): string => - new Query("cursorAfter", undefined, documentId).toString(); - - /** - * Return results before documentId. - * - * @param {string} documentId - * @returns {string} - */ - static cursorBefore = (documentId: string): string => - new Query("cursorBefore", undefined, documentId).toString(); - - /** - * Return only limit results. - * - * @param {number} limit - * @returns {string} - */ - static limit = (limit: number): string => - new Query("limit", undefined, limit).toString(); - - /** - * Filter resources by skipping the first offset results. - * - * @param {number} offset - * @returns {string} - */ - static offset = (offset: number): string => - new Query("offset", undefined, offset).toString(); - - /** - * Filter resources where attribute contains the specified value. - * For string attributes, checks if the string contains the substring. - * - * Note: For array attributes, use {@link containsAny} or {@link containsAll} instead. - * @param {string} attribute - * @param {string | string[]} value - * @returns {string} - */ - static contains = (attribute: string, value: string | any[]): string => - new Query("contains", attribute, value).toString(); - - /** - * Filter resources where attribute contains ANY of the specified values. - * For array and relationship attributes, matches documents where the attribute - * contains at least one of the given values. - * - * @param {string} attribute - * @param {any[]} value - * @returns {string} - */ - static containsAny = (attribute: string, value: any[]): string => - new Query("containsAny", attribute, value).toString(); - - /** - * Filter resources where attribute contains ALL of the specified values. - * For array and relationship attributes, matches documents where the attribute - * contains every one of the given values. - * - * @param {string} attribute - * @param {any[]} value - * @returns {string} - */ - static containsAll = (attribute: string, value: any[]): string => - new Query("containsAll", attribute, value).toString(); - - /** - * Filter resources where attribute does not contain the specified value. - * - * @param {string} attribute - * @param {string | any[]} value - * @returns {string} - */ - static notContains = (attribute: string, value: string | any[]): string => - new Query("notContains", attribute, value).toString(); - - /** - * Filter resources by searching attribute for value (inverse of search). - * A fulltext index on attribute is required for this query to work. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static notSearch = (attribute: string, value: string): string => - new Query("notSearch", attribute, value).toString(); - - /** - * Filter resources where attribute is not between start and end (exclusive). - * - * @param {string} attribute - * @param {string | number | bigint} start - * @param {string | number | bigint} end - * @returns {string} - */ - static notBetween = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => - new Query("notBetween", attribute, [start, end] as QueryTypesList).toString(); - - /** - * Filter resources where attribute does not start with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static notStartsWith = (attribute: string, value: string): string => - new Query("notStartsWith", attribute, value).toString(); - - /** - * Filter resources where attribute does not end with value. - * - * @param {string} attribute - * @param {string} value - * @returns {string} - */ - static notEndsWith = (attribute: string, value: string): string => - new Query("notEndsWith", attribute, value).toString(); - - /** - * Filter resources where document was created before date. - * - * @param {string} value - * @returns {string} - */ - static createdBefore = (value: string): string => - Query.lessThan("$createdAt", value); - - /** - * Filter resources where document was created after date. - * - * @param {string} value - * @returns {string} - */ - static createdAfter = (value: string): string => - Query.greaterThan("$createdAt", value); - - /** - * Filter resources where document was created between dates. - * - * @param {string} start - * @param {string} end - * @returns {string} - */ - static createdBetween = (start: string, end: string): string => - Query.between("$createdAt", start, end); - - /** - * Filter resources where document was updated before date. - * - * @param {string} value - * @returns {string} - */ - static updatedBefore = (value: string): string => - Query.lessThan("$updatedAt", value); - - /** - * Filter resources where document was updated after date. - * - * @param {string} value - * @returns {string} - */ - static updatedAfter = (value: string): string => - Query.greaterThan("$updatedAt", value); - - /** - * Filter resources where document was updated between dates. - * - * @param {string} start - * @param {string} end - * @returns {string} - */ - static updatedBetween = (start: string, end: string): string => - Query.between("$updatedAt", start, end); - - /** - * Combine multiple queries using logical OR operator. - * - * @param {string[]} queries - * @returns {string} - */ - static or = (queries: string[]) => - new Query("or", undefined, queries.map((query) => JSONbig.parse(query))).toString(); - - /** - * Combine multiple queries using logical AND operator. - * - * @param {string[]} queries - * @returns {string} - */ - static and = (queries: string[]) => - new Query("and", undefined, queries.map((query) => JSONbig.parse(query))).toString(); - - /** - * Filter array elements where at least one element matches all the specified queries. - * - * @param {string} attribute The attribute containing the array to filter on. - * @param {string[]} queries The list of query strings to match against array elements. - * @returns {string} - */ - static elemMatch = (attribute: string, queries: string[]): string => - new Query( - "elemMatch", - attribute, - queries.map((query) => JSONbig.parse(query)) - ).toString(); - - /** - * Filter resources where attribute is at a specific distance from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources where attribute is not at a specific distance from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources where attribute is at a distance less than the specified value from the given coordinates. - * - * @param {string} attribute - * @param {any[]} values - * @param {number} distance - * @param {boolean} meters - * @returns {string} - */ - static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => - new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); - - /** - * Filter resources where attribute intersects with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static intersects = (attribute: string, values: any[]): string => - new Query("intersects", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not intersect with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notIntersects = (attribute: string, values: any[]): string => - new Query("notIntersects", attribute, [values]).toString(); - - /** - * Filter resources where attribute crosses the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static crosses = (attribute: string, values: any[]): string => - new Query("crosses", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not cross the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notCrosses = (attribute: string, values: any[]): string => - new Query("notCrosses", attribute, [values]).toString(); - - /** - * Filter resources where attribute overlaps with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static overlaps = (attribute: string, values: any[]): string => - new Query("overlaps", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not overlap with the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notOverlaps = (attribute: string, values: any[]): string => - new Query("notOverlaps", attribute, [values]).toString(); - - /** - * Filter resources where attribute touches the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static touches = (attribute: string, values: any[]): string => - new Query("touches", attribute, [values]).toString(); - - /** - * Filter resources where attribute does not touch the given geometry. - * - * @param {string} attribute - * @param {any[]} values - * @returns {string} - */ - static notTouches = (attribute: string, values: any[]): string => - new Query("notTouches", attribute, [values]).toString(); -} diff --git a/src/role.ts b/src/role.ts deleted file mode 100644 index 79f8c6b6..00000000 --- a/src/role.ts +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Helper class to generate role strings for `Permission`. - */ -export class Role { - - /** - * Grants access to anyone. - * - * This includes authenticated and unauthenticated users. - * - * @returns {string} - */ - public static any(): string { - return 'any' - } - - /** - * Grants access to a specific user by user ID. - * - * You can optionally pass verified or unverified for - * `status` to target specific types of users. - * - * @param {string} id - * @param {string} status - * @returns {string} - */ - public static user(id: string, status: string = ''): string { - if (status === '') { - return `user:${id}` - } - return `user:${id}/${status}` - } - - /** - * Grants access to any authenticated or anonymous user. - * - * You can optionally pass verified or unverified for - * `status` to target specific types of users. - * - * @param {string} status - * @returns {string} - */ - public static users(status: string = ''): string { - if (status === '') { - return 'users' - } - return `users/${status}` - } - - /** - * Grants access to any guest user without a session. - * - * Authenticated users don't have access to this role. - * - * @returns {string} - */ - public static guests(): string { - return 'guests' - } - - /** - * Grants access to a team by team ID. - * - * You can optionally pass a role for `role` to target - * team members with the specified role. - * - * @param {string} id - * @param {string} role - * @returns {string} - */ - public static team(id: string, role: string = ''): string { - if (role === '') { - return `team:${id}` - } - return `team:${id}/${role}` - } - - /** - * Grants access to a specific member of a team. - * - * When the member is removed from the team, they will - * no longer have access. - * - * @param {string} id - * @returns {string} - */ - public static member(id: string): string { - return `member:${id}` - } - - /** - * Grants access to a user with the specified label. - * - * @param {string} name - * @returns {string} - */ - public static label(name: string): string { - return `label:${name}` - } -} \ No newline at end of file diff --git a/src/services/account.ts b/src/services/account.ts deleted file mode 100644 index c98e454b..00000000 --- a/src/services/account.ts +++ /dev/null @@ -1,2831 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { AuthenticatorType } from '../enums/authenticator-type'; -import { AuthenticationFactor } from '../enums/authentication-factor'; -import { OAuthProvider } from '../enums/o-auth-provider'; - -export class Account { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get the currently logged in user. - * - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - get<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> { - - const apiPath = '/account'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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). - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.password - New user password. Must be between 8 and 256 chars. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * 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). - * - * @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. - * @param {string} email - User email. - * @param {string} password - New user password. Must be between 8 and 256 chars. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - create<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/account'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. - * - * - * @param {string} params.email - User email. - * @param {string} params.password - User password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { email: string, password: string }): Promise<Models.User<Preferences>>; - /** - * 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. - * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. - * - * - * @param {string} email - User email. - * @param {string} password - User password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>>; - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { email: string, password: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { email: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { email: string, password: string }; - } else { - params = { - email: paramsOrFirst as string, - password: rest[0] as string - }; - } - - const email = params.email; - const password = params.password; - - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/account/email'; - const payload: Payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the list of identities for the currently logged in user. - * - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IdentityList>} - */ - listIdentities(params?: { queries?: string[], total?: boolean }): Promise<Models.IdentityList>; - /** - * Get the list of identities for the currently logged in user. - * - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IdentityList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listIdentities(queries?: string[], total?: boolean): Promise<Models.IdentityList>; - listIdentities( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.IdentityList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/account/identities'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an identity by its unique ID. - * - * @param {string} params.identityId - Identity ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteIdentity(params: { identityId: string }): Promise<{}>; - /** - * Delete an identity by its unique ID. - * - * @param {string} identityId - Identity ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteIdentity(identityId: string): Promise<{}>; - deleteIdentity( - paramsOrFirst: { identityId: string } | string - ): Promise<{}> { - let params: { identityId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { identityId: string }; - } else { - params = { - identityId: paramsOrFirst as string - }; - } - - const identityId = params.identityId; - - if (typeof identityId === 'undefined') { - throw new AppwriteException('Missing required parameter: "identityId"'); - } - - const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Jwt>} - */ - createJWT(params?: { duration?: number }): Promise<Models.Jwt>; - /** - * 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. - * - * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Jwt>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createJWT(duration?: number): Promise<Models.Jwt>; - createJWT( - paramsOrFirst?: { duration?: number } | number - ): Promise<Models.Jwt> { - let params: { duration?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { duration?: number }; - } else { - params = { - duration: paramsOrFirst as number - }; - } - - const duration = params.duration; - - - const apiPath = '/account/jwts'; - const payload: Payload = {}; - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listLogs(params?: { queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * 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. - * - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listLogs(queries?: string[], total?: boolean): Promise<Models.LogList>; - listLogs( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.LogList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/account/logs'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Enable or disable MFA on an account. - * - * @param {boolean} params.mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { mfa: boolean }): Promise<Models.User<Preferences>>; - /** - * Enable or disable MFA on an account. - * - * @param {boolean} mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>>; - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { mfa: boolean } | boolean - ): Promise<Models.User<Preferences>> { - let params: { mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { mfa: boolean }; - } else { - params = { - mfa: paramsOrFirst as boolean - }; - } - - const mfa = params.mfa; - - if (typeof mfa === 'undefined') { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - - const apiPath = '/account/mfa'; - const payload: Payload = {}; - if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp` - * @throws {AppwriteException} - * @returns {Promise<Models.MfaType>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead. - */ - createMfaAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>; - /** - * 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. - * - * @param {AuthenticatorType} type - Type of authenticator. Must be `totp` - * @throws {AppwriteException} - * @returns {Promise<Models.MfaType>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>; - createMfaAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType - ): Promise<Models.MfaType> { - let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType }; - } else { - params = { - type: paramsOrFirst as AuthenticatorType - }; - } - - const type = params.type; - - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp` - * @throws {AppwriteException} - * @returns {Promise<Models.MfaType>} - */ - createMFAAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>; - /** - * 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. - * - * @param {AuthenticatorType} type - Type of authenticator. Must be `totp` - * @throws {AppwriteException} - * @returns {Promise<Models.MfaType>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMFAAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>; - createMFAAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType - ): Promise<Models.MfaType> { - let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType }; - } else { - params = { - type: paramsOrFirst as AuthenticatorType - }; - } - - const type = params.type; - - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. - * - * @param {AuthenticatorType} params.type - Type of authenticator. - * @param {string} params.otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead. - */ - updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>; - /** - * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. - * - * @param {AuthenticatorType} type - Type of authenticator. - * @param {string} otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>; - updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { type: AuthenticatorType, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string }; - } else { - params = { - type: paramsOrFirst as AuthenticatorType, - otp: rest[0] as string - }; - } - - const type = params.type; - const otp = params.otp; - - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); - const payload: Payload = {}; - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. - * - * @param {AuthenticatorType} params.type - Type of authenticator. - * @param {string} params.otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>; - /** - * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. - * - * @param {AuthenticatorType} type - Type of authenticator. - * @param {string} otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>; - updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { type: AuthenticatorType, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string }; - } else { - params = { - type: paramsOrFirst as AuthenticatorType, - otp: rest[0] as string - }; - } - - const type = params.type; - const otp = params.otp; - - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); - const payload: Payload = {}; - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an authenticator for a user by ID. - * - * @param {AuthenticatorType} params.type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead. - */ - deleteMfaAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; - /** - * Delete an authenticator for a user by ID. - * - * @param {AuthenticatorType} type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>; - deleteMfaAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType - ): Promise<{}> { - let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType }; - } else { - params = { - type: paramsOrFirst as AuthenticatorType - }; - } - - const type = params.type; - - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an authenticator for a user by ID. - * - * @param {AuthenticatorType} params.type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteMFAAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; - /** - * Delete an authenticator for a user by ID. - * - * @param {AuthenticatorType} type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>; - deleteMFAAuthenticator( - paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType - ): Promise<{}> { - let params: { type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { type: AuthenticatorType }; - } else { - params = { - type: paramsOrFirst as AuthenticatorType - }; - } - - const type = params.type; - - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. - * - * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaChallenge>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead. - */ - createMfaChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>; - /** - * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. - * - * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaChallenge>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>; - createMfaChallenge( - paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor - ): Promise<Models.MfaChallenge> { - let params: { factor: AuthenticationFactor }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { factor: AuthenticationFactor }; - } else { - params = { - factor: paramsOrFirst as AuthenticationFactor - }; - } - - const factor = params.factor; - - if (typeof factor === 'undefined') { - throw new AppwriteException('Missing required parameter: "factor"'); - } - - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; - if (typeof factor !== 'undefined') { - payload['factor'] = factor; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. - * - * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaChallenge>} - */ - createMFAChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>; - /** - * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. - * - * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaChallenge>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMFAChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>; - createMFAChallenge( - paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor - ): Promise<Models.MfaChallenge> { - let params: { factor: AuthenticationFactor }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { factor: AuthenticationFactor }; - } else { - params = { - factor: paramsOrFirst as AuthenticationFactor - }; - } - - const factor = params.factor; - - if (typeof factor === 'undefined') { - throw new AppwriteException('Missing required parameter: "factor"'); - } - - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; - if (typeof factor !== 'undefined') { - payload['factor'] = factor; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.challengeId - ID of the challenge. - * @param {string} params.otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead. - */ - updateMfaChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>; - /** - * 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. - * - * @param {string} challengeId - ID of the challenge. - * @param {string} otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>; - updateMfaChallenge( - paramsOrFirst: { challengeId: string, otp: string } | string, - ...rest: [(string)?] - ): Promise<Models.Session> { - let params: { challengeId: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { challengeId: string, otp: string }; - } else { - params = { - challengeId: paramsOrFirst as string, - otp: rest[0] as string - }; - } - - const challengeId = params.challengeId; - const otp = params.otp; - - if (typeof challengeId === 'undefined') { - throw new AppwriteException('Missing required parameter: "challengeId"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; - if (typeof challengeId !== 'undefined') { - payload['challengeId'] = challengeId; - } - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.challengeId - ID of the challenge. - * @param {string} params.otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - updateMFAChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>; - /** - * 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. - * - * @param {string} challengeId - ID of the challenge. - * @param {string} otp - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMFAChallenge(challengeId: string, otp: string): Promise<Models.Session>; - updateMFAChallenge( - paramsOrFirst: { challengeId: string, otp: string } | string, - ...rest: [(string)?] - ): Promise<Models.Session> { - let params: { challengeId: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { challengeId: string, otp: string }; - } else { - params = { - challengeId: paramsOrFirst as string, - otp: rest[0] as string - }; - } - - const challengeId = params.challengeId; - const otp = params.otp; - - if (typeof challengeId === 'undefined') { - throw new AppwriteException('Missing required parameter: "challengeId"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/account/mfa/challenges'; - const payload: Payload = {}; - if (typeof challengeId !== 'undefined') { - payload['challengeId'] = challengeId; - } - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * List the factors available on the account to be used as a MFA challange. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead. - */ - listMfaFactors(): Promise<Models.MfaFactors> { - - const apiPath = '/account/mfa/factors'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List the factors available on the account to be used as a MFA challange. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - */ - listMFAFactors(): Promise<Models.MfaFactors> { - - const apiPath = '/account/mfa/factors'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead. - */ - getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> { - - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - getMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> { - - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead. - */ - createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> { - - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> { - - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead. - */ - updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> { - - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> { - - const apiPath = '/account/mfa/recovery-codes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update currently logged in user account name. - * - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { name: string }): Promise<Models.User<Preferences>>; - /** - * Update currently logged in user account name. - * - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>>; - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { name: string } | string - ): Promise<Models.User<Preferences>> { - let params: { name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name: string }; - } else { - params = { - name: paramsOrFirst as string - }; - } - - const name = params.name; - - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/account/name'; - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.password - New user password. Must be at least 8 chars. - * @param {string} params.oldPassword - Current user password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { password: string, oldPassword?: string }): Promise<Models.User<Preferences>>; - /** - * 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. - * - * @param {string} password - New user password. Must be at least 8 chars. - * @param {string} oldPassword - Current user password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>; - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { password: string, oldPassword?: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { password: string, oldPassword?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { password: string, oldPassword?: string }; - } else { - params = { - password: paramsOrFirst as string, - oldPassword: rest[0] as string - }; - } - - const password = params.password; - const oldPassword = params.oldPassword; - - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/account/password'; - const payload: Payload = {}; - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof oldPassword !== 'undefined') { - payload['oldPassword'] = oldPassword; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.password - User password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { phone: string, password: string }): Promise<Models.User<Preferences>>; - /** - * 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. - * - * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} password - User password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>>; - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { phone: string, password: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { phone: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { phone: string, password: string }; - } else { - params = { - phone: paramsOrFirst as string, - password: rest[0] as string - }; - } - - const phone = params.phone; - const password = params.password; - - if (typeof phone === 'undefined') { - throw new AppwriteException('Missing required parameter: "phone"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/account/phone'; - const payload: Payload = {}; - if (typeof phone !== 'undefined') { - payload['phone'] = phone; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the preferences as a key-value object for the currently logged in user. - * - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - */ - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences> { - - const apiPath = '/account/prefs'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {Partial<Preferences>} params.prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { prefs: Partial<Preferences> }): Promise<Models.User<Preferences>>; - /** - * 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. - * - * @param {Partial<Preferences>} prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>; - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { prefs: Partial<Preferences> } | Partial<Preferences> - ): Promise<Models.User<Preferences>> { - let params: { prefs: Partial<Preferences> }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('prefs' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { prefs: Partial<Preferences> }; - } else { - params = { - prefs: paramsOrFirst as Partial<Preferences> - }; - } - - const prefs = params.prefs; - - if (typeof prefs === 'undefined') { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - - const apiPath = '/account/prefs'; - const payload: Payload = {}; - if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.email - User email. - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createRecovery(params: { email: string, url: string }): Promise<Models.Token>; - /** - * 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. - * - * @param {string} email - User email. - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRecovery(email: string, url: string): Promise<Models.Token>; - createRecovery( - paramsOrFirst: { email: string, url: string } | string, - ...rest: [(string)?] - ): Promise<Models.Token> { - let params: { email: string, url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { email: string, url: string }; - } else { - params = { - email: paramsOrFirst as string, - url: rest[0] as string - }; - } - - const email = params.email; - const url = params.url; - - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - - const apiPath = '/account/recovery'; - const payload: Payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * 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. - * - * @param {string} params.userId - User ID. - * @param {string} params.secret - Valid reset token. - * @param {string} params.password - New user password. Must be between 8 and 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - updateRecovery(params: { userId: string, secret: string, password: string }): Promise<Models.Token>; - /** - * 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. - * - * 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. - * - * @param {string} userId - User ID. - * @param {string} secret - Valid reset token. - * @param {string} password - New user password. Must be between 8 and 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>; - updateRecovery( - paramsOrFirst: { userId: string, secret: string, password: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Token> { - let params: { userId: string, secret: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string, password: string }; - } else { - params = { - userId: paramsOrFirst as string, - secret: rest[0] as string, - password: rest[1] as string - }; - } - - const userId = params.userId; - const secret = params.secret; - const password = params.password; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/account/recovery'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the list of active sessions across different devices for the currently logged in user. - * - * @throws {AppwriteException} - * @returns {Promise<Models.SessionList>} - */ - listSessions(): Promise<Models.SessionList> { - - const apiPath = '/account/sessions'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete all sessions from the user account and remove any sessions cookies from the end client. - * - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSessions(): Promise<{}> { - - const apiPath = '/account/sessions'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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). - * - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - createAnonymousSession(): Promise<Models.Session> { - - const apiPath = '/account/sessions/anonymous'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * 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). - * - * @param {string} params.email - User email. - * @param {string} params.password - User password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - createEmailPasswordSession(params: { email: string, password: string }): Promise<Models.Session>; - /** - * 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. - * - * 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). - * - * @param {string} email - User email. - * @param {string} password - User password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmailPasswordSession(email: string, password: string): Promise<Models.Session>; - createEmailPasswordSession( - paramsOrFirst: { email: string, password: string } | string, - ...rest: [(string)?] - ): Promise<Models.Session> { - let params: { email: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { email: string, password: string }; - } else { - params = { - email: paramsOrFirst as string, - password: rest[0] as string - }; - } - - const email = params.email; - const password = params.password; - - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/account/sessions/email'; - const payload: Payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @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. - * @param {string} params.secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. - */ - updateMagicURLSession(params: { userId: string, secret: string }): Promise<Models.Session>; - /** - * 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. - * - * @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. - * @param {string} secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>; - updateMagicURLSession( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] - ): Promise<Models.Session> { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; - } else { - params = { - userId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const userId = params.userId; - const secret = params.secret; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - - const apiPath = '/account/sessions/magic-url'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @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. - * @param {string} params.secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. - */ - updatePhoneSession(params: { userId: string, secret: string }): Promise<Models.Session>; - /** - * 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. - * - * @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. - * @param {string} secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePhoneSession(userId: string, secret: string): Promise<Models.Session>; - updatePhoneSession( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] - ): Promise<Models.Session> { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; - } else { - params = { - userId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const userId = params.userId; - const secret = params.secret; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - - const apiPath = '/account/sessions/phone'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @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. - * @param {string} params.secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - createSession(params: { userId: string, secret: string }): Promise<Models.Session>; - /** - * 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. - * - * @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. - * @param {string} secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSession(userId: string, secret: string): Promise<Models.Session>; - createSession( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] - ): Promise<Models.Session> { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; - } else { - params = { - userId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const userId = params.userId; - const secret = params.secret; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - - const apiPath = '/account/sessions/token'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. - * - * @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - getSession(params: { sessionId: string }): Promise<Models.Session>; - /** - * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. - * - * @param {string} sessionId - Session ID. Use the string 'current' to get the current device session. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getSession(sessionId: string): Promise<Models.Session>; - getSession( - paramsOrFirst: { sessionId: string } | string - ): Promise<Models.Session> { - let params: { sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { sessionId: string }; - } else { - params = { - sessionId: paramsOrFirst as string - }; - } - - const sessionId = params.sessionId; - - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.sessionId - Session ID. Use the string 'current' to update the current device session. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - updateSession(params: { sessionId: string }): Promise<Models.Session>; - /** - * 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. - * - * @param {string} sessionId - Session ID. Use the string 'current' to update the current device session. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSession(sessionId: string): Promise<Models.Session>; - updateSession( - paramsOrFirst: { sessionId: string } | string - ): Promise<Models.Session> { - let params: { sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { sessionId: string }; - } else { - params = { - sessionId: paramsOrFirst as string - }; - } - - const sessionId = params.sessionId; - - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSession(params: { sessionId: string }): Promise<{}>; - /** - * 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. - * - * @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteSession(sessionId: string): Promise<{}>; - deleteSession( - paramsOrFirst: { sessionId: string } | string - ): Promise<{}> { - let params: { sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { sessionId: string }; - } else { - params = { - sessionId: paramsOrFirst as string - }; - } - - const sessionId = params.sessionId; - - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - - const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> { - - const apiPath = '/account/status'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * 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). - * - * - * @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. - * @param {string} params.email - User email. - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise<Models.Token>; - /** - * 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. - * - * 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). - * - * - * @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. - * @param {string} email - User email. - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>; - createEmailToken( - paramsOrFirst: { userId: string, email: string, phrase?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Token> { - let params: { userId: string, email: string, phrase?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, phrase?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - phrase: rest[1] as boolean - }; - } - - const userId = params.userId; - const email = params.email; - const phrase = params.phrase; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - - const apiPath = '/account/tokens/email'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof phrase !== 'undefined') { - payload['phrase'] = phrase; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * 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). - * - * - * @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. - * @param {string} params.email - User email. - * @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. - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise<Models.Token>; - /** - * 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. - * - * 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). - * - * - * @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. - * @param {string} email - User email. - * @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. - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>; - createMagicURLToken( - paramsOrFirst: { userId: string, email: string, url?: string, phrase?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.Token> { - let params: { userId: string, email: string, url?: string, phrase?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, url?: string, phrase?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - url: rest[1] as string, - phrase: rest[2] as boolean - }; - } - - const userId = params.userId; - const email = params.email; - const url = params.url; - const phrase = params.phrase; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - - const apiPath = '/account/tokens/magic-url'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof phrase !== 'undefined') { - payload['phrase'] = phrase; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * 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. - * - * 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). - * - * @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, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. - * @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. - * @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. - * @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. - * @throws {AppwriteException} - * @returns {Promise<string>} - */ - createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): Promise<string>; - /** - * 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. - * - * 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. - * - * 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). - * - * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. - * @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. - * @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. - * @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. - * @throws {AppwriteException} - * @returns {Promise<string>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<string>; - createOAuth2Token( - paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider, - ...rest: [(string)?, (string)?, (string[])?] - ): Promise<string> { - let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; - } else { - params = { - provider: paramsOrFirst as OAuthProvider, - success: rest[0] as string, - failure: rest[1] as string, - scopes: rest[2] as string[] - }; - } - - const provider = params.provider; - const success = params.success; - const failure = params.failure; - const scopes = params.scopes; - - if (typeof provider === 'undefined') { - throw new AppwriteException('Missing required parameter: "provider"'); - } - - const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider); - const payload: Payload = {}; - if (typeof success !== 'undefined') { - payload['success'] = success; - } - if (typeof failure !== 'undefined') { - payload['failure'] = failure; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.redirect( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * 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. - * - * 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). - * - * @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. - * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createPhoneToken(params: { userId: string, phone: string }): Promise<Models.Token>; - /** - * 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. - * - * 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). - * - * @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. - * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPhoneToken(userId: string, phone: string): Promise<Models.Token>; - createPhoneToken( - paramsOrFirst: { userId: string, phone: string } | string, - ...rest: [(string)?] - ): Promise<Models.Token> { - let params: { userId: string, phone: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, phone: string }; - } else { - params = { - userId: paramsOrFirst as string, - phone: rest[0] as string - }; - } - - const userId = params.userId; - const phone = params.phone; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof phone === 'undefined') { - throw new AppwriteException('Missing required parameter: "phone"'); - } - - const apiPath = '/account/tokens/phone'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof phone !== 'undefined') { - payload['phone'] = phone; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * 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. - * - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createEmailVerification(params: { url: string }): Promise<Models.Token>; - /** - * 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. - * - * 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. - * - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmailVerification(url: string): Promise<Models.Token>; - createEmailVerification( - paramsOrFirst: { url: string } | string - ): Promise<Models.Token> { - let params: { url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string }; - } else { - params = { - url: paramsOrFirst as string - }; - } - - const url = params.url; - - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * 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. - * - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead. - */ - createVerification(params: { url: string }): Promise<Models.Token>; - /** - * 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. - * - * 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. - * - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVerification(url: string): Promise<Models.Token>; - createVerification( - paramsOrFirst: { url: string } | string - ): Promise<Models.Token> { - let params: { url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string }; - } else { - params = { - url: paramsOrFirst as string - }; - } - - const url = params.url; - - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.userId - User ID. - * @param {string} params.secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - updateEmailVerification(params: { userId: string, secret: string }): Promise<Models.Token>; - /** - * 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. - * - * @param {string} userId - User ID. - * @param {string} secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailVerification(userId: string, secret: string): Promise<Models.Token>; - updateEmailVerification( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] - ): Promise<Models.Token> { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; - } else { - params = { - userId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const userId = params.userId; - const secret = params.secret; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.userId - User ID. - * @param {string} params.secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead. - */ - updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>; - /** - * 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. - * - * @param {string} userId - User ID. - * @param {string} secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVerification(userId: string, secret: string): Promise<Models.Token>; - updateVerification( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] - ): Promise<Models.Token> { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; - } else { - params = { - userId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const userId = params.userId; - const secret = params.secret; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - - const apiPath = '/account/verifications/email'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createPhoneVerification(): Promise<Models.Token> { - - const apiPath = '/account/verifications/phone'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * 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. - * - * @param {string} params.userId - User ID. - * @param {string} params.secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - updatePhoneVerification(params: { userId: string, secret: string }): Promise<Models.Token>; - /** - * 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. - * - * @param {string} userId - User ID. - * @param {string} secret - Valid verification token. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>; - updatePhoneVerification( - paramsOrFirst: { userId: string, secret: string } | string, - ...rest: [(string)?] - ): Promise<Models.Token> { - let params: { userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, secret: string }; - } else { - params = { - userId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const userId = params.userId; - const secret = params.secret; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - - const apiPath = '/account/verifications/phone'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/activities.ts b/src/services/activities.ts deleted file mode 100644 index 64e79410..00000000 --- a/src/services/activities.ts +++ /dev/null @@ -1,116 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Activities { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List all events for selected filters. - * - * @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 attributes such as userId, teamId, etc. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEventList>} - */ - listEvents(params?: { queries?: string }): Promise<Models.ActivityEventList>; - /** - * List all events for selected filters. - * - * @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 attributes such as userId, teamId, etc. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEventList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listEvents(queries?: string): Promise<Models.ActivityEventList>; - listEvents( - paramsOrFirst?: { queries?: string } | string - ): Promise<Models.ActivityEventList> { - let params: { queries?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string }; - } else { - params = { - queries: paramsOrFirst as string - }; - } - - const queries = params.queries; - - - const apiPath = '/activities/events'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get event by ID. - * - * - * @param {string} params.eventId - Event ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEvent>} - */ - getEvent(params: { eventId: string }): Promise<Models.ActivityEvent>; - /** - * Get event by ID. - * - * - * @param {string} eventId - Event ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ActivityEvent>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getEvent(eventId: string): Promise<Models.ActivityEvent>; - getEvent( - paramsOrFirst: { eventId: string } | string - ): Promise<Models.ActivityEvent> { - let params: { eventId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { eventId: string }; - } else { - params = { - eventId: paramsOrFirst as string - }; - } - - const eventId = params.eventId; - - if (typeof eventId === 'undefined') { - throw new AppwriteException('Missing required parameter: "eventId"'); - } - - const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/advisor.ts b/src/services/advisor.ts deleted file mode 100644 index 02587b99..00000000 --- a/src/services/advisor.ts +++ /dev/null @@ -1,309 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Advisor { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all the project's analyzer reports. You can use the query params to filter your results. - * - * - * @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: appId, type, targetType, target, analyzedAt - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ReportList>} - */ - listReports(params?: { queries?: string[], total?: boolean }): Promise<Models.ReportList>; - /** - * Get a list of all the project's analyzer reports. You can use the query params to filter your results. - * - * - * @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: appId, type, targetType, target, analyzedAt - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ReportList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listReports(queries?: string[], total?: boolean): Promise<Models.ReportList>; - listReports( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.ReportList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/reports'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. - * - * - * @param {string} params.reportId - Report ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Report>} - */ - getReport(params: { reportId: string }): Promise<Models.Report>; - /** - * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. - * - * - * @param {string} reportId - Report ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Report>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getReport(reportId: string): Promise<Models.Report>; - getReport( - paramsOrFirst: { reportId: string } | string - ): Promise<Models.Report> { - let params: { reportId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string }; - } else { - params = { - reportId: paramsOrFirst as string - }; - } - - const reportId = params.reportId; - - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); - } - - const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. - * - * - * @param {string} params.reportId - Report ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteReport(params: { reportId: string }): Promise<{}>; - /** - * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. - * - * - * @param {string} reportId - Report ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteReport(reportId: string): Promise<{}>; - deleteReport( - paramsOrFirst: { reportId: string } | string - ): Promise<{}> { - let params: { reportId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string }; - } else { - params = { - reportId: paramsOrFirst as string - }; - } - - const reportId = params.reportId; - - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); - } - - const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * List the insights produced under a single analyzer report. You can use the query params to filter your results further. - * - * - * @param {string} params.reportId - Parent report ID. - * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.InsightList>} - */ - listInsights(params: { reportId: string, queries?: string[], total?: boolean }): Promise<Models.InsightList>; - /** - * List the insights produced under a single analyzer report. You can use the query params to filter your results further. - * - * - * @param {string} reportId - Parent report ID. - * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.InsightList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listInsights(reportId: string, queries?: string[], total?: boolean): Promise<Models.InsightList>; - listInsights( - paramsOrFirst: { reportId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.InsightList> { - let params: { reportId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string, queries?: string[], total?: boolean }; - } else { - params = { - reportId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const reportId = params.reportId; - const queries = params.queries; - const total = params.total; - - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); - } - - const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', reportId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get an insight by its unique ID, scoped to its parent report. - * - * - * @param {string} params.reportId - Parent report ID. - * @param {string} params.insightId - Insight ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Insight>} - */ - getInsight(params: { reportId: string, insightId: string }): Promise<Models.Insight>; - /** - * Get an insight by its unique ID, scoped to its parent report. - * - * - * @param {string} reportId - Parent report ID. - * @param {string} insightId - Insight ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Insight>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getInsight(reportId: string, insightId: string): Promise<Models.Insight>; - getInsight( - paramsOrFirst: { reportId: string, insightId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Insight> { - let params: { reportId: string, insightId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { reportId: string, insightId: string }; - } else { - params = { - reportId: paramsOrFirst as string, - insightId: rest[0] as string - }; - } - - const reportId = params.reportId; - const insightId = params.insightId; - - if (typeof reportId === 'undefined') { - throw new AppwriteException('Missing required parameter: "reportId"'); - } - if (typeof insightId === 'undefined') { - throw new AppwriteException('Missing required parameter: "insightId"'); - } - - const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', reportId).replace('{insightId}', insightId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/avatars.ts b/src/services/avatars.ts deleted file mode 100644 index 37ed3bd3..00000000 --- a/src/services/avatars.ts +++ /dev/null @@ -1,754 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { Browser } from '../enums/browser'; -import { CreditCard } from '../enums/credit-card'; -import { Flag } from '../enums/flag'; -import { Theme } from '../enums/theme'; -import { Timezone } from '../enums/timezone'; -import { BrowserPermission } from '../enums/browser-permission'; -import { ImageFormat } from '../enums/image-format'; - -export class Avatars { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * @param {Browser} params.code - Browser Code. - * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getBrowser(params: { code: Browser, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>; - /** - * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * @param {Browser} code - Browser Code. - * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>; - getBrowser( - paramsOrFirst: { code: Browser, width?: number, height?: number, quality?: number } | Browser, - ...rest: [(number)?, (number)?, (number)?] - ): Promise<ArrayBuffer> { - let params: { code: Browser, width?: number, height?: number, quality?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { code: Browser, width?: number, height?: number, quality?: number }; - } else { - params = { - code: paramsOrFirst as Browser, - width: rest[0] as number, - height: rest[1] as number, - quality: rest[2] as number - }; - } - - const code = params.code; - const width = params.width; - const height = params.height; - const quality = params.quality; - - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - - const apiPath = '/avatars/browsers/{code}'.replace('{code}', code); - const payload: Payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * - * @param {CreditCard} params.code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. - * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getCreditCard(params: { code: CreditCard, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>; - /** - * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * - * @param {CreditCard} code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. - * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>; - getCreditCard( - paramsOrFirst: { code: CreditCard, width?: number, height?: number, quality?: number } | CreditCard, - ...rest: [(number)?, (number)?, (number)?] - ): Promise<ArrayBuffer> { - let params: { code: CreditCard, width?: number, height?: number, quality?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { code: CreditCard, width?: number, height?: number, quality?: number }; - } else { - params = { - code: paramsOrFirst as CreditCard, - width: rest[0] as number, - height: rest[1] as number, - quality: rest[2] as number - }; - } - - const code = params.code; - const width = params.width; - const height = params.height; - const quality = params.quality; - - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - - const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code); - const payload: Payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. - * - * This endpoint does not follow HTTP redirects. - * - * @param {string} params.url - Website URL which you want to fetch the favicon from. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getFavicon(params: { url: string }): Promise<ArrayBuffer>; - /** - * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. - * - * This endpoint does not follow HTTP redirects. - * - * @param {string} url - Website URL which you want to fetch the favicon from. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFavicon(url: string): Promise<ArrayBuffer>; - getFavicon( - paramsOrFirst: { url: string } | string - ): Promise<ArrayBuffer> { - let params: { url: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string }; - } else { - params = { - url: paramsOrFirst as string - }; - } - - const url = params.url; - - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - - const apiPath = '/avatars/favicon'; - const payload: Payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * - * @param {Flag} params.code - Country Code. ISO Alpha-2 country code format. - * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getFlag(params: { code: Flag, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>; - /** - * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * - * @param {Flag} code - Country Code. ISO Alpha-2 country code format. - * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>; - getFlag( - paramsOrFirst: { code: Flag, width?: number, height?: number, quality?: number } | Flag, - ...rest: [(number)?, (number)?, (number)?] - ): Promise<ArrayBuffer> { - let params: { code: Flag, width?: number, height?: number, quality?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { code: Flag, width?: number, height?: number, quality?: number }; - } else { - params = { - code: paramsOrFirst as Flag, - width: rest[0] as number, - height: rest[1] as number, - quality: rest[2] as number - }; - } - - const code = params.code; - const width = params.width; - const height = params.height; - const quality = params.quality; - - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - - const apiPath = '/avatars/flags/{code}'.replace('{code}', code); - const payload: Payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. - * - * This endpoint does not follow HTTP redirects. - * - * @param {string} params.url - Image URL which you want to crop. - * @param {number} params.width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. - * @param {number} params.height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getImage(params: { url: string, width?: number, height?: number }): Promise<ArrayBuffer>; - /** - * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. - * - * This endpoint does not follow HTTP redirects. - * - * @param {string} url - Image URL which you want to crop. - * @param {number} width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. - * @param {number} height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer>; - getImage( - paramsOrFirst: { url: string, width?: number, height?: number } | string, - ...rest: [(number)?, (number)?] - ): Promise<ArrayBuffer> { - let params: { url: string, width?: number, height?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string, width?: number, height?: number }; - } else { - params = { - url: paramsOrFirst as string, - width: rest[0] as number, - height: rest[1] as number - }; - } - - const url = params.url; - const width = params.width; - const height = params.height; - - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - - const apiPath = '/avatars/image'; - const payload: Payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. - * - * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * - * @param {string} params.name - Full Name. When empty, current user name or email will be used. Max length: 128 chars. - * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {string} params.background - Changes background color. By default a random color will be picked and stay will persistent to the given name. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getInitials(params?: { name?: string, width?: number, height?: number, background?: string }): Promise<ArrayBuffer>; - /** - * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. - * - * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. - * - * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. - * - * - * @param {string} name - Full Name. When empty, current user name or email will be used. Max length: 128 chars. - * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. - * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. - * @param {string} background - Changes background color. By default a random color will be picked and stay will persistent to the given name. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer>; - getInitials( - paramsOrFirst?: { name?: string, width?: number, height?: number, background?: string } | string, - ...rest: [(number)?, (number)?, (string)?] - ): Promise<ArrayBuffer> { - let params: { name?: string, width?: number, height?: number, background?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name?: string, width?: number, height?: number, background?: string }; - } else { - params = { - name: paramsOrFirst as string, - width: rest[0] as number, - height: rest[1] as number, - background: rest[2] as string - }; - } - - const name = params.name; - const width = params.width; - const height = params.height; - const background = params.background; - - - const apiPath = '/avatars/initials'; - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof background !== 'undefined') { - payload['background'] = background; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. - * - * - * @param {string} params.text - Plain text to be converted to QR code image. - * @param {number} params.size - QR code size. Pass an integer between 1 to 1000. Defaults to 400. - * @param {number} params.margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1. - * @param {boolean} params.download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getQR(params: { text: string, size?: number, margin?: number, download?: boolean }): Promise<ArrayBuffer>; - /** - * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. - * - * - * @param {string} text - Plain text to be converted to QR code image. - * @param {number} size - QR code size. Pass an integer between 1 to 1000. Defaults to 400. - * @param {number} margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1. - * @param {boolean} download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer>; - getQR( - paramsOrFirst: { text: string, size?: number, margin?: number, download?: boolean } | string, - ...rest: [(number)?, (number)?, (boolean)?] - ): Promise<ArrayBuffer> { - let params: { text: string, size?: number, margin?: number, download?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { text: string, size?: number, margin?: number, download?: boolean }; - } else { - params = { - text: paramsOrFirst as string, - size: rest[0] as number, - margin: rest[1] as number, - download: rest[2] as boolean - }; - } - - const text = params.text; - const size = params.size; - const margin = params.margin; - const download = params.download; - - if (typeof text === 'undefined') { - throw new AppwriteException('Missing required parameter: "text"'); - } - - const apiPath = '/avatars/qr'; - const payload: Payload = {}; - if (typeof text !== 'undefined') { - payload['text'] = text; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof margin !== 'undefined') { - payload['margin'] = margin; - } - if (typeof download !== 'undefined') { - payload['download'] = download; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. - * - * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll. - * - * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. - * - * @param {string} params.url - Website URL which you want to capture. - * @param {object} params.headers - HTTP headers to send with the browser request. Defaults to empty. - * @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. - * @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. - * @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - * @param {Theme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light". - * @param {string} params.userAgent - Custom user agent string. Defaults to browser default. - * @param {boolean} params.fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. - * @param {string} params.locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. - * @param {Timezone} params.timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. - * @param {number} params.latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. - * @param {number} params.longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. - * @param {number} params.accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. - * @param {boolean} params.touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. - * @param {BrowserPermission[]} params.permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. - * @param {number} params.sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. - * @param {number} params.width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). - * @param {number} params.height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). - * @param {number} params.quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp). - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): Promise<ArrayBuffer>; - /** - * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. - * - * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll. - * - * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. - * - * @param {string} url - Website URL which you want to capture. - * @param {object} headers - HTTP headers to send with the browser request. Defaults to empty. - * @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. - * @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. - * @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - * @param {Theme} theme - Browser theme. Pass "light" or "dark". Defaults to "light". - * @param {string} userAgent - Custom user agent string. Defaults to browser default. - * @param {boolean} fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. - * @param {string} locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. - * @param {Timezone} timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. - * @param {number} latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. - * @param {number} longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. - * @param {number} accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. - * @param {boolean} touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. - * @param {BrowserPermission[]} permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. - * @param {number} sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. - * @param {number} width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). - * @param {number} height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). - * @param {number} quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp). - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): Promise<ArrayBuffer>; - getScreenshot( - paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, - ...rest: [(object)?, (number)?, (number)?, (number)?, (Theme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] - ): Promise<ArrayBuffer> { - let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; - } else { - params = { - url: paramsOrFirst as string, - headers: rest[0] as object, - viewportWidth: rest[1] as number, - viewportHeight: rest[2] as number, - scale: rest[3] as number, - theme: rest[4] as Theme, - userAgent: rest[5] as string, - fullpage: rest[6] as boolean, - locale: rest[7] as string, - timezone: rest[8] as Timezone, - latitude: rest[9] as number, - longitude: rest[10] as number, - accuracy: rest[11] as number, - touch: rest[12] as boolean, - permissions: rest[13] as BrowserPermission[], - sleep: rest[14] as number, - width: rest[15] as number, - height: rest[16] as number, - quality: rest[17] as number, - output: rest[18] as ImageFormat - }; - } - - const url = params.url; - const headers = params.headers; - const viewportWidth = params.viewportWidth; - const viewportHeight = params.viewportHeight; - const scale = params.scale; - const theme = params.theme; - const userAgent = params.userAgent; - const fullpage = params.fullpage; - const locale = params.locale; - const timezone = params.timezone; - const latitude = params.latitude; - const longitude = params.longitude; - const accuracy = params.accuracy; - const touch = params.touch; - const permissions = params.permissions; - const sleep = params.sleep; - const width = params.width; - const height = params.height; - const quality = params.quality; - const output = params.output; - - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - - const apiPath = '/avatars/screenshots'; - const payload: Payload = {}; - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof headers !== 'undefined') { - payload['headers'] = headers; - } - if (typeof viewportWidth !== 'undefined') { - payload['viewportWidth'] = viewportWidth; - } - if (typeof viewportHeight !== 'undefined') { - payload['viewportHeight'] = viewportHeight; - } - if (typeof scale !== 'undefined') { - payload['scale'] = scale; - } - if (typeof theme !== 'undefined') { - payload['theme'] = theme; - } - if (typeof userAgent !== 'undefined') { - payload['userAgent'] = userAgent; - } - if (typeof fullpage !== 'undefined') { - payload['fullpage'] = fullpage; - } - if (typeof locale !== 'undefined') { - payload['locale'] = locale; - } - if (typeof timezone !== 'undefined') { - payload['timezone'] = timezone; - } - if (typeof latitude !== 'undefined') { - payload['latitude'] = latitude; - } - if (typeof longitude !== 'undefined') { - payload['longitude'] = longitude; - } - if (typeof accuracy !== 'undefined') { - payload['accuracy'] = accuracy; - } - if (typeof touch !== 'undefined') { - payload['touch'] = touch; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof sleep !== 'undefined') { - payload['sleep'] = sleep; - } - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - if (typeof output !== 'undefined') { - payload['output'] = output; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } -} diff --git a/src/services/backups.ts b/src/services/backups.ts deleted file mode 100644 index ef8dbc03..00000000 --- a/src/services/backups.ts +++ /dev/null @@ -1,754 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { BackupServices } from '../enums/backup-services'; - -export class Backups { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List all archives for a project. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchiveList>} - */ - listArchives(params?: { queries?: string[] }): Promise<Models.BackupArchiveList>; - /** - * List all archives for a project. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchiveList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listArchives(queries?: string[]): Promise<Models.BackupArchiveList>; - listArchives( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.BackupArchiveList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/archives'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new archive asynchronously for a project. - * - * @param {BackupServices[]} params.services - Array of services to backup - * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - */ - createArchive(params: { services: BackupServices[], resourceId?: string }): Promise<Models.BackupArchive>; - /** - * Create a new archive asynchronously for a project. - * - * @param {BackupServices[]} services - Array of services to backup - * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createArchive(services: BackupServices[], resourceId?: string): Promise<Models.BackupArchive>; - createArchive( - paramsOrFirst: { services: BackupServices[], resourceId?: string } | BackupServices[], - ...rest: [(string)?] - ): Promise<Models.BackupArchive> { - let params: { services: BackupServices[], resourceId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('services' in paramsOrFirst || 'resourceId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { services: BackupServices[], resourceId?: string }; - } else { - params = { - services: paramsOrFirst as BackupServices[], - resourceId: rest[0] as string - }; - } - - const services = params.services; - const resourceId = params.resourceId; - - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - - const apiPath = '/backups/archives'; - const payload: Payload = {}; - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a backup archive using it's ID. - * - * @param {string} params.archiveId - Archive ID. Choose a custom ID`. 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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - */ - getArchive(params: { archiveId: string }): Promise<Models.BackupArchive>; - /** - * Get a backup archive using it's ID. - * - * @param {string} archiveId - Archive ID. Choose a custom ID`. 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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupArchive>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getArchive(archiveId: string): Promise<Models.BackupArchive>; - getArchive( - paramsOrFirst: { archiveId: string } | string - ): Promise<Models.BackupArchive> { - let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string }; - } else { - params = { - archiveId: paramsOrFirst as string - }; - } - - const archiveId = params.archiveId; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an existing archive for a project. - * - * @param {string} params.archiveId - Policy 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. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteArchive(params: { archiveId: string }): Promise<{}>; - /** - * Delete an existing archive for a project. - * - * @param {string} archiveId - Policy 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. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteArchive(archiveId: string): Promise<{}>; - deleteArchive( - paramsOrFirst: { archiveId: string } | string - ): Promise<{}> { - let params: { archiveId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string }; - } else { - params = { - archiveId: paramsOrFirst as string - }; - } - - const archiveId = params.archiveId; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - - const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * List all policies for a project. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicyList>} - */ - listPolicies(params?: { queries?: string[] }): Promise<Models.BackupPolicyList>; - /** - * List all policies for a project. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicyList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listPolicies(queries?: string[]): Promise<Models.BackupPolicyList>; - listPolicies( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.BackupPolicyList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/policies'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new backup policy. - * - * @param {string} params.policyId - Policy 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. - * @param {BackupServices[]} params.services - Array of services to backup - * @param {number} params.retention - Days to keep backups before deletion - * @param {string} params.schedule - Schedule CRON syntax. - * @param {string} params.name - Policy name. Max length: 128 chars. - * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. - * @param {boolean} params.enabled - Is policy enabled? When set to 'disabled', no backups will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - */ - createPolicy(params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; - /** - * Create a new backup policy. - * - * @param {string} policyId - Policy 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. - * @param {BackupServices[]} services - Array of services to backup - * @param {number} retention - Days to keep backups before deletion - * @param {string} schedule - Schedule CRON syntax. - * @param {string} name - Policy name. Max length: 128 chars. - * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. - * @param {boolean} enabled - Is policy enabled? When set to 'disabled', no backups will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPolicy(policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>; - createPolicy( - paramsOrFirst: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string, - ...rest: [(BackupServices[])?, (number)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.BackupPolicy> { - let params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; - } else { - params = { - policyId: paramsOrFirst as string, - services: rest[0] as BackupServices[], - retention: rest[1] as number, - schedule: rest[2] as string, - name: rest[3] as string, - resourceId: rest[4] as string, - enabled: rest[5] as boolean - }; - } - - const policyId = params.policyId; - const services = params.services; - const retention = params.retention; - const schedule = params.schedule; - const name = params.name; - const resourceId = params.resourceId; - const enabled = params.enabled; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - if (typeof retention === 'undefined') { - throw new AppwriteException('Missing required parameter: "retention"'); - } - if (typeof schedule === 'undefined') { - throw new AppwriteException('Missing required parameter: "schedule"'); - } - - const apiPath = '/backups/policies'; - const payload: Payload = {}; - if (typeof policyId !== 'undefined') { - payload['policyId'] = policyId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof retention !== 'undefined') { - payload['retention'] = retention; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a backup policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID`. 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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - */ - getPolicy(params: { policyId: string }): Promise<Models.BackupPolicy>; - /** - * Get a backup policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID`. 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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPolicy(policyId: string): Promise<Models.BackupPolicy>; - getPolicy( - paramsOrFirst: { policyId: string } | string - ): Promise<Models.BackupPolicy> { - let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string }; - } else { - params = { - policyId: paramsOrFirst as string - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an existing policy using it's ID. - * - * @param {string} params.policyId - Policy ID. Choose a custom ID`. 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. - * @param {string} params.name - Policy name. Max length: 128 chars. - * @param {number} params.retention - Days to keep backups before deletion - * @param {string} params.schedule - Cron expression - * @param {boolean} params.enabled - Is Backup enabled? When set to 'disabled', No backup will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - */ - updatePolicy(params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; - /** - * Update an existing policy using it's ID. - * - * @param {string} policyId - Policy ID. Choose a custom ID`. 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. - * @param {string} name - Policy name. Max length: 128 chars. - * @param {number} retention - Days to keep backups before deletion - * @param {string} schedule - Cron expression - * @param {boolean} enabled - Is Backup enabled? When set to 'disabled', No backup will be taken - * @throws {AppwriteException} - * @returns {Promise<Models.BackupPolicy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise<Models.BackupPolicy>; - updatePolicy( - paramsOrFirst: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean } | string, - ...rest: [(string)?, (number)?, (string)?, (boolean)?] - ): Promise<Models.BackupPolicy> { - let params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; - } else { - params = { - policyId: paramsOrFirst as string, - name: rest[0] as string, - retention: rest[1] as number, - schedule: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const policyId = params.policyId; - const name = params.name; - const retention = params.retention; - const schedule = params.schedule; - const enabled = params.enabled; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof retention !== 'undefined') { - payload['retention'] = retention; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a policy using it's ID. - * - * @param {string} params.policyId - Policy 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. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deletePolicy(params: { policyId: string }): Promise<{}>; - /** - * Delete a policy using it's ID. - * - * @param {string} policyId - Policy 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. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deletePolicy(policyId: string): Promise<{}>; - deletePolicy( - paramsOrFirst: { policyId: string } | string - ): Promise<{}> { - let params: { policyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: string }; - } else { - params = { - policyId: paramsOrFirst as string - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create and trigger a new restoration for a backup on a project. - * - * @param {string} params.archiveId - Backup archive ID to restore - * @param {BackupServices[]} params.services - Array of services to restore - * @param {string} params.newResourceId - 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. - * @param {string} params.newResourceName - Database name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - */ - createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise<Models.BackupRestoration>; - /** - * Create and trigger a new restoration for a backup on a project. - * - * @param {string} archiveId - Backup archive ID to restore - * @param {BackupServices[]} services - Array of services to restore - * @param {string} newResourceId - 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. - * @param {string} newResourceName - Database name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise<Models.BackupRestoration>; - createRestoration( - paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, - ...rest: [(BackupServices[])?, (string)?, (string)?] - ): Promise<Models.BackupRestoration> { - let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; - } else { - params = { - archiveId: paramsOrFirst as string, - services: rest[0] as BackupServices[], - newResourceId: rest[1] as string, - newResourceName: rest[2] as string - }; - } - - const archiveId = params.archiveId; - const services = params.services; - const newResourceId = params.newResourceId; - const newResourceName = params.newResourceName; - - if (typeof archiveId === 'undefined') { - throw new AppwriteException('Missing required parameter: "archiveId"'); - } - if (typeof services === 'undefined') { - throw new AppwriteException('Missing required parameter: "services"'); - } - - const apiPath = '/backups/restoration'; - const payload: Payload = {}; - if (typeof archiveId !== 'undefined') { - payload['archiveId'] = archiveId; - } - if (typeof services !== 'undefined') { - payload['services'] = services; - } - if (typeof newResourceId !== 'undefined') { - payload['newResourceId'] = newResourceId; - } - if (typeof newResourceName !== 'undefined') { - payload['newResourceName'] = newResourceName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * List all backup restorations for a project. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestorationList>} - */ - listRestorations(params?: { queries?: string[] }): Promise<Models.BackupRestorationList>; - /** - * List all backup restorations for a project. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestorationList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listRestorations(queries?: string[]): Promise<Models.BackupRestorationList>; - listRestorations( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.BackupRestorationList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/backups/restorations'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the current status of a backup restoration. - * - * @param {string} params.restorationId - Restoration ID. Choose a custom ID`. 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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - */ - getRestoration(params: { restorationId: string }): Promise<Models.BackupRestoration>; - /** - * Get the current status of a backup restoration. - * - * @param {string} restorationId - Restoration ID. Choose a custom ID`. 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. - * @throws {AppwriteException} - * @returns {Promise<Models.BackupRestoration>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getRestoration(restorationId: string): Promise<Models.BackupRestoration>; - getRestoration( - paramsOrFirst: { restorationId: string } | string - ): Promise<Models.BackupRestoration> { - let params: { restorationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { restorationId: string }; - } else { - params = { - restorationId: paramsOrFirst as string - }; - } - - const restorationId = params.restorationId; - - if (typeof restorationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "restorationId"'); - } - - const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/databases.ts b/src/services/databases.ts deleted file mode 100644 index 9a2e744c..00000000 --- a/src/services/databases.ts +++ /dev/null @@ -1,6224 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { RelationshipType } from '../enums/relationship-type'; -import { RelationMutate } from '../enums/relation-mutate'; -import { DatabasesIndexType } from '../enums/databases-index-type'; -import { OrderBy } from '../enums/order-by'; - -export class Databases { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. - * - * @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: name - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. - */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. - * - * @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: name - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.DatabaseList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/databases'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Database. - * - * - * @param {string} params.databaseId - 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. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. - */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Create a new Database. - * - * - * @param {string} databaseId - 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. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; - create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/databases'; - const payload: Payload = {}; - if (typeof databaseId !== 'undefined') { - payload['databaseId'] = databaseId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * List transactions across all databases. - * - * @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). - * @throws {AppwriteException} - * @returns {Promise<Models.TransactionList>} - */ - listTransactions(params?: { queries?: string[] }): Promise<Models.TransactionList>; - /** - * List transactions across all databases. - * - * @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). - * @throws {AppwriteException} - * @returns {Promise<Models.TransactionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTransactions(queries?: string[]): Promise<Models.TransactionList>; - listTransactions( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.TransactionList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/databases/transactions'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new transaction. - * - * @param {number} params.ttl - Seconds before the transaction expires. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - createTransaction(params?: { ttl?: number }): Promise<Models.Transaction>; - /** - * Create a new transaction. - * - * @param {number} ttl - Seconds before the transaction expires. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTransaction(ttl?: number): Promise<Models.Transaction>; - createTransaction( - paramsOrFirst?: { ttl?: number } | number - ): Promise<Models.Transaction> { - let params: { ttl?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ttl?: number }; - } else { - params = { - ttl: paramsOrFirst as number - }; - } - - const ttl = params.ttl; - - - const apiPath = '/databases/transactions'; - const payload: Payload = {}; - if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a transaction by its unique ID. - * - * @param {string} params.transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - getTransaction(params: { transactionId: string }): Promise<Models.Transaction>; - /** - * Get a transaction by its unique ID. - * - * @param {string} transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTransaction(transactionId: string): Promise<Models.Transaction>; - getTransaction( - paramsOrFirst: { transactionId: string } | string - ): Promise<Models.Transaction> { - let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string }; - } else { - params = { - transactionId: paramsOrFirst as string - }; - } - - const transactionId = params.transactionId; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a transaction, to either commit or roll back its operations. - * - * @param {string} params.transactionId - Transaction ID. - * @param {boolean} params.commit - Commit transaction? - * @param {boolean} params.rollback - Rollback transaction? - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise<Models.Transaction>; - /** - * Update a transaction, to either commit or roll back its operations. - * - * @param {string} transactionId - Transaction ID. - * @param {boolean} commit - Commit transaction? - * @param {boolean} rollback - Rollback transaction? - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>; - updateTransaction( - paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, - ...rest: [(boolean)?, (boolean)?] - ): Promise<Models.Transaction> { - let params: { transactionId: string, commit?: boolean, rollback?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean }; - } else { - params = { - transactionId: paramsOrFirst as string, - commit: rest[0] as boolean, - rollback: rest[1] as boolean - }; - } - - const transactionId = params.transactionId; - const commit = params.commit; - const rollback = params.rollback; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - if (typeof commit !== 'undefined') { - payload['commit'] = commit; - } - if (typeof rollback !== 'undefined') { - payload['rollback'] = rollback; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a transaction by its unique ID. - * - * @param {string} params.transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTransaction(params: { transactionId: string }): Promise<{}>; - /** - * Delete a transaction by its unique ID. - * - * @param {string} transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTransaction(transactionId: string): Promise<{}>; - deleteTransaction( - paramsOrFirst: { transactionId: string } | string - ): Promise<{}> { - let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string }; - } else { - params = { - transactionId: paramsOrFirst as string - }; - } - - const transactionId = params.transactionId; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create multiple operations in a single transaction. - * - * @param {string} params.transactionId - Transaction ID. - * @param {object[]} params.operations - Array of staged operations. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; - /** - * Create multiple operations in a single transaction. - * - * @param {string} transactionId - Transaction ID. - * @param {object[]} operations - Array of staged operations. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>; - createOperations( - paramsOrFirst: { transactionId: string, operations?: object[] } | string, - ...rest: [(object[])?] - ): Promise<Models.Transaction> { - let params: { transactionId: string, operations?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; - } else { - params = { - transactionId: paramsOrFirst as string, - operations: rest[0] as object[] - }; - } - - const transactionId = params.transactionId; - const operations = params.operations; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/databases/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - if (typeof operations !== 'undefined') { - payload['operations'] = operations; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. - */ - get(params: { databaseId: string }): Promise<Models.Database>; - /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(databaseId: string): Promise<Models.Database>; - get( - paramsOrFirst: { databaseId: string } | string - ): Promise<Models.Database> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a database by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. - */ - update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Update a database by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; - update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead. - */ - delete(params: { databaseId: string }): Promise<{}>; - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(databaseId: string): Promise<{}>; - delete( - paramsOrFirst: { databaseId: string } | string - ): Promise<{}> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param {string} params.databaseId - Database ID. - * @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: name, enabled, documentSecurity - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.CollectionList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. - */ - listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; - /** - * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param {string} databaseId - Database ID. - * @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: name, enabled, documentSecurity - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.CollectionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listCollections(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.CollectionList>; - listCollections( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.CollectionList> { - let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - 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. - * @param {string} params.name - Collection name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {object[]} params.attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. - */ - createCollection(params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise<Models.Collection>; - /** - * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - 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. - * @param {string} name - Collection name. Max length: 128 chars. - * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {object[]} attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[]): Promise<Models.Collection>; - createCollection( - paramsOrFirst: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] - ): Promise<Models.Collection> { - let params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - documentSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - attributes: rest[5] as object[], - indexes: rest[6] as object[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const name = params.name; - const permissions = params.permissions; - const documentSecurity = params.documentSecurity; - const enabled = params.enabled; - const attributes = params.attributes; - const indexes = params.indexes; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof collectionId !== 'undefined') { - payload['collectionId'] = collectionId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof documentSecurity !== 'undefined') { - payload['documentSecurity'] = documentSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof attributes !== 'undefined') { - payload['attributes'] = attributes; - } - if (typeof indexes !== 'undefined') { - payload['indexes'] = indexes; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. - */ - getCollection(params: { databaseId: string, collectionId: string }): Promise<Models.Collection>; - /** - * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getCollection(databaseId: string, collectionId: string): Promise<Models.Collection>; - getCollection( - paramsOrFirst: { databaseId: string, collectionId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Collection> { - let params: { databaseId: string, collectionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a collection by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.name - Collection name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {boolean} params.purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. - */ - updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Collection>; - /** - * Update a collection by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} name - Collection name. Max length: 128 chars. - * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. - * @param {boolean} purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Collection>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Collection>; - updateCollection( - paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Collection> { - let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - documentSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - purge: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const name = params.name; - const permissions = params.permissions; - const documentSecurity = params.documentSecurity; - const enabled = params.enabled; - const purge = params.purge; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof documentSecurity !== 'undefined') { - payload['documentSecurity'] = documentSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof purge !== 'undefined') { - payload['purge'] = purge; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead. - */ - deleteCollection(params: { databaseId: string, collectionId: string }): Promise<{}>; - /** - * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteCollection(databaseId: string, collectionId: string): Promise<{}>; - deleteCollection( - paramsOrFirst: { databaseId: string, collectionId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { databaseId: string, collectionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * List attributes in the collection. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @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: key, type, size, required, array, status, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. - */ - listAttributes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.AttributeList>; - /** - * List attributes in the collection. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @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: key, type, size, required, array, status, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listAttributes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.AttributeList>; - listAttributes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.AttributeList> { - let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a bigint attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead. - */ - createBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeBigint>; - /** - * Create a bigint attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeBigint>; - createBigIntAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.AttributeBigint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a bigint attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead. - */ - updateBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeBigint>; - /** - * Update a bigint attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeBigint>; - updateBigIntAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.AttributeBigint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a boolean attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. - */ - createBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.AttributeBoolean>; - /** - * Create a boolean attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>; - createBooleanAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeBoolean> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a boolean attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead. - */ - updateBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.AttributeBoolean>; - /** - * Update a boolean attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean>; - updateBooleanAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] - ): Promise<Models.AttributeBoolean> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a date time attribute according to the ISO 8601 standard. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead. - */ - createDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeDatetime>; - /** - * Create a date time attribute according to the ISO 8601 standard. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>; - createDatetimeAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeDatetime> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a date time attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead. - */ - updateDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeDatetime>; - /** - * Update a date time attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime>; - updateDatetimeAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeDatetime> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create an email attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. - */ - createEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEmail>; - /** - * Create an email attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>; - createEmailAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeEmail> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an email attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead. - */ - updateEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEmail>; - /** - * Update an email attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail>; - updateEmailAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeEmail> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {string[]} params.elements - Array of enum values. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. - */ - createEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEnum>; - /** - * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {string[]} elements - Array of enum values. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>; - createEnumAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeEnum> { - let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an enum attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {string[]} params.elements - Updated list of enum values. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead. - */ - updateEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEnum>; - /** - * Update an enum attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {string[]} elements - Updated list of enum values. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum>; - updateEnumAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeEnum> { - let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a float attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number} params.min - Minimum value. - * @param {number} params.max - Maximum value. - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead. - */ - createFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.AttributeFloat>; - /** - * Create a float attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number} min - Minimum value. - * @param {number} max - Maximum value. - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>; - createFloatAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] - ): Promise<Models.AttributeFloat> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number, - max: rest[4] as number, - xdefault: rest[5] as number, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a float attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {number} params.min - Minimum value. - * @param {number} params.max - Maximum value. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead. - */ - updateFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.AttributeFloat>; - /** - * Update a float attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {number} min - Minimum value. - * @param {number} max - Maximum value. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.AttributeFloat>; - updateFloatAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] - ): Promise<Models.AttributeFloat> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number, - min: rest[4] as number, - max: rest[5] as number, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create an integer attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead. - */ - createIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeInteger>; - /** - * Create an integer attribute. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeInteger>; - createIntegerAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.AttributeInteger> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an integer attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead. - */ - updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeInteger>; - /** - * Update an integer attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>; - updateIntegerAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.AttributeInteger> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create IP address attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. - */ - createIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeIp>; - /** - * Create IP address attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>; - createIpAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeIp> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an ip attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead. - */ - updateIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeIp>; - /** - * Update an ip attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp>; - updateIpAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeIp> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a geometric line attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. - */ - createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributeLine>; - /** - * Create a geometric line attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributeLine>; - createLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.AttributeLine> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a line attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. - */ - updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributeLine>; - /** - * Update a line attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributeLine>; - updateLineAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.AttributeLine> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a longtext attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - */ - createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeLongtext>; - /** - * Create a longtext attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeLongtext>; - createLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeLongtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a longtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - */ - updateLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeLongtext>; - /** - * Update a longtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeLongtext>; - updateLongtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeLongtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a mediumtext attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - */ - createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeMediumtext>; - /** - * Create a mediumtext attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeMediumtext>; - createMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeMediumtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - */ - updateMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeMediumtext>; - /** - * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeMediumtext>; - updateMediumtextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeMediumtext> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a geometric point attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. - */ - createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePoint>; - /** - * Create a geometric point attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePoint>; - createPointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.AttributePoint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a point attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. - */ - updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePoint>; - /** - * Update a point attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePoint>; - updatePointAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.AttributePoint> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a geometric polygon attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. - */ - createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePolygon>; - /** - * Create a geometric polygon attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePolygon>; - createPolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.AttributePolygon> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a polygon attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @param {string} params.newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. - */ - updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePolygon>; - /** - * Update a polygon attribute. Changing the `default` value will not update already existing documents. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. - * @param {string} newKey - New attribute key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributePolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePolygon>; - updatePolygonAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.AttributePolygon> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.relatedCollectionId - Related Collection ID. - * @param {RelationshipType} params.type - Relation type - * @param {boolean} params.twoWay - Is Two Way? - * @param {string} params.key - Attribute Key. - * @param {string} params.twoWayKey - Two Way Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. - */ - createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.AttributeRelationship>; - /** - * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} relatedCollectionId - Related Collection ID. - * @param {RelationshipType} type - Relation type - * @param {boolean} twoWay - Is Two Way? - * @param {string} key - Attribute Key. - * @param {string} twoWayKey - Two Way Attribute Key. - * @param {RelationMutate} onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship>; - createRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, - ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] - ): Promise<Models.AttributeRelationship> { - let params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - relatedCollectionId: rest[1] as string, - type: rest[2] as RelationshipType, - twoWay: rest[3] as boolean, - key: rest[4] as string, - twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const relatedCollectionId = params.relatedCollectionId; - const type = params.type; - const twoWay = params.twoWay; - const key = params.key; - const twoWayKey = params.twoWayKey; - const onDelete = params.onDelete; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof relatedCollectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof relatedCollectionId !== 'undefined') { - payload['relatedCollectionId'] = relatedCollectionId; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; - } - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. - */ - updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>; - /** - * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {RelationMutate} onDelete - Constraints option - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>; - updateRelationshipAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] - ): Promise<Models.AttributeRelationship> { - let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - onDelete: rest[2] as RelationMutate, - newKey: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const onDelete = params.onDelete; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a string attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {number} params.size - Attribute size for text attributes, in number of characters. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. - */ - createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeString>; - /** - * Create a string attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {number} size - Attribute size for text attributes, in number of characters. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString>; - createStringAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeString> { - let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a string attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} params.size - Maximum size of the string attribute. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. - */ - updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeString>; - /** - * Update a string attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} size - Maximum size of the string attribute. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString>; - updateStringAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.AttributeString> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a text attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - */ - createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeText>; - /** - * Create a text attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeText>; - createTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeText> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a text attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - */ - updateTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeText>; - /** - * Update a text attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeText>; - updateTextAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeText> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a URL attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. - */ - createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeUrl>; - /** - * Create a URL attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>; - createUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.AttributeUrl> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an url attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. - */ - updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeUrl>; - /** - * Update an url attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl>; - updateUrlAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.AttributeUrl> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a varchar attribute. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {number} params.size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} params.array - Is attribute an array? - * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - */ - createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeVarchar>; - /** - * Create a varchar attribute. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {number} size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {boolean} array - Is attribute an array? - * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeVarchar>; - createVarcharAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.AttributeVarchar> { - let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a varchar attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Attribute Key. - * @param {boolean} params.required - Is attribute required? - * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} params.size - Maximum size of the varchar attribute. - * @param {string} params.newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - */ - updateVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeVarchar>; - /** - * Update a varchar attribute. Changing the `default` value will not update already existing documents. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Attribute Key. - * @param {boolean} required - Is attribute required? - * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. - * @param {number} size - Maximum size of the varchar attribute. - * @param {string} newKey - New Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVarcharAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeVarchar>; - updateVarcharAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.AttributeVarchar> { - let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get attribute by ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. - */ - getAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; - /** - * Get attribute by ID. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getAttribute(databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; - getAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Deletes an attribute. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead. - */ - deleteAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; - /** - * Deletes an attribute. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} key - Attribute Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}>; - deleteAttribute( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @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. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. - */ - listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>; - /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @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. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>; - listDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string, - total: rest[3] as boolean, - ttl: rest[4] as number - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const queries = params.queries; - const transactionId = params.transactionId; - const total = params.total; - const ttl = params.ttl; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {string} params.documentId - Document 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. - * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON object. - * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. - */ - createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }): Promise<Document>; - /** - * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {string} documentId - Document 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. - * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON object. - * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string): Promise<Document>; - createDocument<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, - permissions: rest[3] as string[], - transactionId: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof documentId !== 'undefined') { - payload['documentId'] = documentId; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {object[]} params.documents - Array of documents data as JSON objects. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead. - */ - createDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. - * @param {object[]} documents - Array of documents data as JSON objects. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; - createDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documents: rest[1] as object[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documents = params.documents; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documents === 'undefined') { - throw new AppwriteException('Missing required parameter: "documents"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof documents !== 'undefined') { - payload['documents'] = documents; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {object[]} params.documents - Array of document data as JSON objects. May contain partial documents. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. - */ - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {object[]} documents - Array of document data as JSON objects. May contain partial documents. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; - upsertDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documents: rest[1] as object[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documents = params.documents; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documents === 'undefined') { - throw new AppwriteException('Missing required parameter: "documents"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof documents !== 'undefined') { - payload['documents'] = documents; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {object} params.data - Document data as JSON object. Include only attribute and value pairs to be updated. - * @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. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. - */ - updateDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {object} data - Document data as JSON object. Include only attribute and value pairs to be updated. - * @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. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; - updateDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (object)?, (string[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - data: rest[1] as object, - queries: rest[2] as string[], - transactionId: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const data = params.data; - const queries = params.queries; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Bulk delete documents using queries, if no queries are passed then all documents are deleted. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @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. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. - */ - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; - /** - * Bulk delete documents using queries, if no queries are passed then all documents are deleted. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @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. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.DocumentList<Document>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] - ): Promise<Models.DocumentList<Document>> { - let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const queries = params.queries; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.documentId - Document ID. - * @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. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead. - */ - getDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }): Promise<Document>; - /** - * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} documentId - Document ID. - * @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. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string): Promise<Document>; - getDocument<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - queries: rest[2] as string[], - transactionId: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const queries = params.queries; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.documentId - Document ID. - * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include all required attributes of the document to be created or updated. - * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead. - */ - upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>; - /** - * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} documentId - Document ID. - * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include all required attributes of the document to be created or updated. - * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>; - upsertDocument<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, - permissions: rest[3] as string[], - transactionId: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.documentId - Document ID. - * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include only attribute and value pairs to be updated. - * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead. - */ - updateDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>; - /** - * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} documentId - Document ID. - * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include only attribute and value pairs to be updated. - * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>; - updateDocument<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, - permissions: rest[3] as string[], - transactionId: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a document by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.documentId - Document ID. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead. - */ - deleteDocument(params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }): Promise<{}>; - /** - * Delete a document by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} documentId - Document ID. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteDocument(databaseId: string, collectionId: string, documentId: string, transactionId?: string): Promise<{}>; - deleteDocument( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); - const payload: Payload = {}; - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Decrement a specific attribute of a document by a given value. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.documentId - Document ID. - * @param {string} params.attribute - Attribute key. - * @param {number} params.value - Value to increment the attribute by. The value must be a number. - * @param {number} params.min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead. - */ - decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }): Promise<Document>; - /** - * Decrement a specific attribute of a document by a given value. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} documentId - Document ID. - * @param {string} attribute - Attribute key. - * @param {number} value - Value to increment the attribute by. The value must be a number. - * @param {number} min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string): Promise<Document>; - decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - attribute: rest[2] as string, - value: rest[3] as number, - min: rest[4] as number, - transactionId: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const attribute = params.attribute; - const value = params.value; - const min = params.min; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (typeof attribute === 'undefined') { - throw new AppwriteException('Missing required parameter: "attribute"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); - const payload: Payload = {}; - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Increment a specific attribute of a document by a given value. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. - * @param {string} params.documentId - Document ID. - * @param {string} params.attribute - Attribute key. - * @param {number} params.value - Value to increment the attribute by. The value must be a number. - * @param {number} params.max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead. - */ - incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }): Promise<Document>; - /** - * Increment a specific attribute of a document by a given value. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. - * @param {string} documentId - Document ID. - * @param {string} attribute - Attribute key. - * @param {number} value - Value to increment the attribute by. The value must be a number. - * @param {number} max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Document>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string): Promise<Document>; - incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>( - paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] - ): Promise<Document> { - let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - documentId: rest[1] as string, - attribute: rest[2] as string, - value: rest[3] as number, - max: rest[4] as number, - transactionId: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const documentId = params.documentId; - const attribute = params.attribute; - const value = params.value; - const max = params.max; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof documentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "documentId"'); - } - if (typeof attribute === 'undefined') { - throw new AppwriteException('Missing required parameter: "attribute"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); - const payload: Payload = {}; - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * List indexes in the collection. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @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: key, type, status, attributes, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IndexList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. - */ - listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.IndexList>; - /** - * List indexes in the collection. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @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: key, type, status, attributes, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IndexList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listIndexes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.IndexList>; - listIndexes( - paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.IndexList> { - let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Index Key. - * @param {DatabasesIndexType} params.type - Index type. - * @param {string[]} params.attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. - * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} params.lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead. - */ - createIndex(params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.Index>; - /** - * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. - * Attributes can be `key`, `fulltext`, and `unique`. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Index Key. - * @param {DatabasesIndexType} type - Index type. - * @param {string[]} attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. - * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIndex(databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.Index>; - createIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (DatabasesIndexType)?, (string[])?, (OrderBy[])?, (number[])?] - ): Promise<Models.Index> { - let params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string, - type: rest[2] as DatabasesIndexType, - attributes: rest[3] as string[], - orders: rest[4] as OrderBy[], - lengths: rest[5] as number[] - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - const type = params.type; - const attributes = params.attributes; - const orders = params.orders; - const lengths = params.lengths; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof attributes === 'undefined') { - throw new AppwriteException('Missing required parameter: "attributes"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof attributes !== 'undefined') { - payload['attributes'] = attributes; - } - if (typeof orders !== 'undefined') { - payload['orders'] = orders; - } - if (typeof lengths !== 'undefined') { - payload['lengths'] = lengths; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get an index by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. - */ - getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.Index>; - /** - * Get an index by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.Index>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index>; - getIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Index> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an index. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead. - */ - deleteIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; - /** - * Delete an index. - * - * @param {string} databaseId - Database ID. - * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}>; - deleteIndex( - paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, collectionId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - collectionId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const collectionId = params.collectionId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof collectionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "collectionId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/functions.ts b/src/services/functions.ts deleted file mode 100644 index 75835a0b..00000000 --- a/src/services/functions.ts +++ /dev/null @@ -1,2003 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - -import { InputFile } from '../inputFile'; - -import { Runtime } from '../enums/runtime'; -import { Scopes } from '../enums/scopes'; -import { TemplateReferenceType } from '../enums/template-reference-type'; -import { VCSReferenceType } from '../enums/vcs-reference-type'; -import { DeploymentDownloadType } from '../enums/deployment-download-type'; -import { ExecutionMethod } from '../enums/execution-method'; - -export class Functions { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all the project's functions. You can use the query params to filter your results. - * - * @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: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.FunctionList>} - */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.FunctionList>; - /** - * Get a list of all the project's functions. You can use the query params to filter your results. - * - * @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: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.FunctionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.FunctionList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/functions'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. - * - * @param {string} params.functionId - Function 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. - * @param {string} params.name - Function name. Max length: 128 chars. - * @param {Runtime} params.runtime - Execution runtime. - * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {string} params.schedule - Schedule CRON syntax. - * @param {number} params.timeout - Function maximum execution time in seconds. - * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} params.commands - Build Commands. - * @param {Scopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function. - * @param {string} params.providerBranch - Production branch for the repo linked to the function. - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to function code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the function deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the function executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; - /** - * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. - * - * @param {string} functionId - Function 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. - * @param {string} name - Function name. Max length: 128 chars. - * @param {Runtime} runtime - Execution runtime. - * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {string} schedule - Schedule CRON syntax. - * @param {number} timeout - Function maximum execution time in seconds. - * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} commands - Build Commands. - * @param {Scopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the function. - * @param {string} providerBranch - Production branch for the repo linked to the function. - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to function code in the linked repo. - * @param {string} buildSpecification - Build specification for the function deployments. - * @param {string} runtimeSpecification - Runtime specification for the function executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; - create( - paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Function> { - let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - functionId: paramsOrFirst as string, - name: rest[0] as string, - runtime: rest[1] as Runtime, - execute: rest[2] as string[], - events: rest[3] as string[], - schedule: rest[4] as string, - timeout: rest[5] as number, - enabled: rest[6] as boolean, - logging: rest[7] as boolean, - entrypoint: rest[8] as string, - commands: rest[9] as string, - scopes: rest[10] as Scopes[], - installationId: rest[11] as string, - providerRepositoryId: rest[12] as string, - providerBranch: rest[13] as string, - providerSilentMode: rest[14] as boolean, - providerRootDirectory: rest[15] as string, - buildSpecification: rest[16] as string, - runtimeSpecification: rest[17] as string, - deploymentRetention: rest[18] as number - }; - } - - const functionId = params.functionId; - const name = params.name; - const runtime = params.runtime; - const execute = params.execute; - const events = params.events; - const schedule = params.schedule; - const timeout = params.timeout; - const enabled = params.enabled; - const logging = params.logging; - const entrypoint = params.entrypoint; - const commands = params.commands; - const scopes = params.scopes; - const installationId = params.installationId; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof runtime === 'undefined') { - throw new AppwriteException('Missing required parameter: "runtime"'); - } - - const apiPath = '/functions'; - const payload: Payload = {}; - if (typeof functionId !== 'undefined') { - payload['functionId'] = functionId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof runtime !== 'undefined') { - payload['runtime'] = runtime; - } - if (typeof execute !== 'undefined') { - payload['execute'] = execute; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; - } - if (typeof commands !== 'undefined') { - payload['commands'] = commands; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all runtimes that are currently active on your instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.RuntimeList>} - */ - listRuntimes(): Promise<Models.RuntimeList> { - - const apiPath = '/functions/runtimes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List allowed function specifications for this instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.SpecificationList>} - */ - listSpecifications(): Promise<Models.SpecificationList> { - - const apiPath = '/functions/specifications'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a function by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - get(params: { functionId: string }): Promise<Models.Function>; - /** - * Get a function by its unique ID. - * - * @param {string} functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(functionId: string): Promise<Models.Function>; - get( - paramsOrFirst: { functionId: string } | string - ): Promise<Models.Function> { - let params: { functionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string }; - } else { - params = { - functionId: paramsOrFirst as string - }; - } - - const functionId = params.functionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update function by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.name - Function name. Max length: 128 chars. - * @param {Runtime} params.runtime - Execution runtime. - * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {string} params.schedule - Schedule CRON syntax. - * @param {number} params.timeout - Maximum execution time in seconds. - * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} params.commands - Build Commands. - * @param {Scopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function - * @param {string} params.providerBranch - Production branch for the repo linked to the function - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to function code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the function deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the function executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; - /** - * Update function by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} name - Function name. Max length: 128 chars. - * @param {Runtime} runtime - Execution runtime. - * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {string} schedule - Schedule CRON syntax. - * @param {number} timeout - Maximum execution time in seconds. - * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. - * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". - * @param {string} commands - Build Commands. - * @param {Scopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. - * @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the function - * @param {string} providerBranch - Production branch for the repo linked to the function - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to function code in the linked repo. - * @param {string} buildSpecification - Build specification for the function deployments. - * @param {string} runtimeSpecification - Runtime specification for the function executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; - update( - paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Function> { - let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - functionId: paramsOrFirst as string, - name: rest[0] as string, - runtime: rest[1] as Runtime, - execute: rest[2] as string[], - events: rest[3] as string[], - schedule: rest[4] as string, - timeout: rest[5] as number, - enabled: rest[6] as boolean, - logging: rest[7] as boolean, - entrypoint: rest[8] as string, - commands: rest[9] as string, - scopes: rest[10] as Scopes[], - installationId: rest[11] as string, - providerRepositoryId: rest[12] as string, - providerBranch: rest[13] as string, - providerSilentMode: rest[14] as boolean, - providerRootDirectory: rest[15] as string, - buildSpecification: rest[16] as string, - runtimeSpecification: rest[17] as string, - deploymentRetention: rest[18] as number - }; - } - - const functionId = params.functionId; - const name = params.name; - const runtime = params.runtime; - const execute = params.execute; - const events = params.events; - const schedule = params.schedule; - const timeout = params.timeout; - const enabled = params.enabled; - const logging = params.logging; - const entrypoint = params.entrypoint; - const commands = params.commands; - const scopes = params.scopes; - const installationId = params.installationId; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof runtime !== 'undefined') { - payload['runtime'] = runtime; - } - if (typeof execute !== 'undefined') { - payload['execute'] = execute; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof schedule !== 'undefined') { - payload['schedule'] = schedule; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; - } - if (typeof commands !== 'undefined') { - payload['commands'] = commands; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a function by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { functionId: string }): Promise<{}>; - /** - * Delete a function by its unique ID. - * - * @param {string} functionId - Function ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(functionId: string): Promise<{}>; - delete( - paramsOrFirst: { functionId: string } | string - ): Promise<{}> { - let params: { functionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string }; - } else { - params = { - functionId: paramsOrFirst as string - }; - } - - const functionId = params.functionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - */ - updateFunctionDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Function>; - /** - * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Function>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFunctionDeployment(functionId: string, deploymentId: string): Promise<Models.Function>; - updateFunctionDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Function> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all the function's code deployments. You can use the query params to filter your results. - * - * @param {string} params.functionId - Function ID. - * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - */ - listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; - /** - * Get a list of all the function's code deployments. You can use the query params to filter your results. - * - * @param {string} functionId - Function ID. - * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; - listDeployments( - paramsOrFirst: { functionId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.DeploymentList> { - let params: { functionId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const functionId = params.functionId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. - * - * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). - * - * Use the "command" param to set the entrypoint used to execute your code. - * - * @param {string} params.functionId - Function ID. - * @param {File | InputFile} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @param {string} params.entrypoint - Entrypoint File. - * @param {string} params.commands - Build Commands. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDeployment(params: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; - /** - * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. - * - * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). - * - * Use the "command" param to set the entrypoint used to execute your code. - * - * @param {string} functionId - Function ID. - * @param {File | InputFile} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @param {string} entrypoint - Entrypoint File. - * @param {string} commands - Build Commands. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDeployment(functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; - createDeployment( - paramsOrFirst: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File | InputFile)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string }; - let onProgress: ((progress: UploadProgress) => void); - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); - } else { - params = { - functionId: paramsOrFirst as string, - code: rest[0] as File | InputFile, - activate: rest[1] as boolean, - entrypoint: rest[2] as string, - commands: rest[3] as string - }; - onProgress = rest[4] as ((progress: UploadProgress) => void); - } - - const functionId = params.functionId; - const code = params.code; - const activate = params.activate; - const entrypoint = params.entrypoint; - const commands = params.commands; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - if (typeof activate === 'undefined') { - throw new AppwriteException('Missing required parameter: "activate"'); - } - - const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof entrypoint !== 'undefined') { - payload['entrypoint'] = entrypoint; - } - if (typeof commands !== 'undefined') { - payload['commands'] = commands; - } - if (typeof code !== 'undefined') { - payload['code'] = code; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'multipart/form-data', - } - - return this.client.chunkedUpload( - 'post', - uri, - apiHeaders, - payload, - onProgress - ); - } - - /** - * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @param {string} params.buildId - Build unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDuplicateDeployment(params: { functionId: string, deploymentId: string, buildId?: string }): Promise<Models.Deployment>; - /** - * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @param {string} buildId - Build unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>; - createDuplicateDeployment( - paramsOrFirst: { functionId: string, deploymentId: string, buildId?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, deploymentId: string, buildId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, buildId?: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string, - buildId: rest[1] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - const buildId = params.buildId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - if (typeof buildId !== 'undefined') { - payload['buildId'] = buildId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.repository - Repository name of the template. - * @param {string} params.owner - The name of the owner of the template. - * @param {string} params.rootDirectory - Path to function code in the template repo. - * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createTemplateDeployment(params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. - * - * @param {string} functionId - Function ID. - * @param {string} repository - Repository name of the template. - * @param {string} owner - The name of the owner of the template. - * @param {string} rootDirectory - Path to function code in the template repo. - * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTemplateDeployment(functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createTemplateDeployment( - paramsOrFirst: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - repository: rest[0] as string, - owner: rest[1] as string, - rootDirectory: rest[2] as string, - type: rest[3] as TemplateReferenceType, - reference: rest[4] as string, - activate: rest[5] as boolean - }; - } - - const functionId = params.functionId; - const repository = params.repository; - const owner = params.owner; - const rootDirectory = params.rootDirectory; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof repository === 'undefined') { - throw new AppwriteException('Missing required parameter: "repository"'); - } - if (typeof owner === 'undefined') { - throw new AppwriteException('Missing required parameter: "owner"'); - } - if (typeof rootDirectory === 'undefined') { - throw new AppwriteException('Missing required parameter: "rootDirectory"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof repository !== 'undefined') { - payload['repository'] = repository; - } - if (typeof owner !== 'undefined') { - payload['owner'] = owner; - } - if (typeof rootDirectory !== 'undefined') { - payload['rootDirectory'] = rootDirectory; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a deployment when a function is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} params.functionId - Function ID. - * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit - * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createVcsDeployment(params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment when a function is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} functionId - Function ID. - * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit - * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVcsDeployment(functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createVcsDeployment( - paramsOrFirst: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - type: rest[0] as VCSReferenceType, - reference: rest[1] as string, - activate: rest[2] as boolean - }; - } - - const functionId = params.functionId; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a function deployment by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - getDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Get a function deployment by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>; - getDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a code deployment by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteDeployment(params: { functionId: string, deploymentId: string }): Promise<{}>; - /** - * Delete a code deployment by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; - deleteDeployment( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise<ArrayBuffer>; - /** - * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>; - getDeploymentDownload( - paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, - ...rest: [(string)?, (DeploymentDownloadType)?] - ): Promise<ArrayBuffer> { - let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string, - type: rest[1] as DeploymentDownloadType - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - const type = params.type; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - updateDeploymentStatus(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} functionId - Function ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDeploymentStatus(functionId: string, deploymentId: string): Promise<Models.Deployment>; - updateDeploymentStatus( - paramsOrFirst: { functionId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const functionId = params.functionId; - const deploymentId = params.deploymentId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all the current user function execution logs. You can use the query params to filter your results. - * - * @param {string} params.functionId - Function ID. - * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - */ - listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; - /** - * Get a list of all the current user function execution logs. You can use the query params to filter your results. - * - * @param {string} functionId - Function ID. - * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; - listExecutions( - paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.ExecutionList> { - let params: { functionId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const functionId = params.functionId; - const queries = params.queries; - const total = params.total; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.body - HTTP body of execution. Default value is empty string. - * @param {boolean} params.async - Execute code in the background. Default value is false. - * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is / - * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST. - * @param {object} params.headers - HTTP headers of execution. Defaults to empty. - * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - */ - createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; - /** - * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. - * - * @param {string} functionId - Function ID. - * @param {string} body - HTTP body of execution. Default value is empty string. - * @param {boolean} async - Execute code in the background. Default value is false. - * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is / - * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST. - * @param {object} headers - HTTP headers of execution. Defaults to empty. - * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>; - createExecution( - paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?] - ): Promise<Models.Execution> { - let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; - } else { - params = { - functionId: paramsOrFirst as string, - body: rest[0] as string, - async: rest[1] as boolean, - xpath: rest[2] as string, - method: rest[3] as ExecutionMethod, - headers: rest[4] as object, - scheduledAt: rest[5] as string - }; - } - - const functionId = params.functionId; - const body = params.body; - const async = params.async; - const xpath = params.xpath; - const method = params.method; - const headers = params.headers; - const scheduledAt = params.scheduledAt; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof body !== 'undefined') { - payload['body'] = body; - } - if (typeof async !== 'undefined') { - payload['async'] = async; - } - if (typeof xpath !== 'undefined') { - payload['path'] = xpath; - } - if (typeof method !== 'undefined') { - payload['method'] = method; - } - if (typeof headers !== 'undefined') { - payload['headers'] = headers; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a function execution log by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - */ - getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; - /** - * Get a function execution log by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getExecution(functionId: string, executionId: string): Promise<Models.Execution>; - getExecution( - paramsOrFirst: { functionId: string, executionId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Execution> { - let params: { functionId: string, executionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - executionId: rest[0] as string - }; - } - - const functionId = params.functionId; - const executionId = params.executionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a function execution by its unique ID. - * - * @param {string} params.functionId - Function ID. - * @param {string} params.executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteExecution(params: { functionId: string, executionId: string }): Promise<{}>; - /** - * Delete a function execution by its unique ID. - * - * @param {string} functionId - Function ID. - * @param {string} executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteExecution(functionId: string, executionId: string): Promise<{}>; - deleteExecution( - paramsOrFirst: { functionId: string, executionId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { functionId: string, executionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - executionId: rest[0] as string - }; - } - - const functionId = params.functionId; - const executionId = params.executionId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); - } - - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all variables of a specific function. - * - * @param {string} params.functionId - Function unique ID. - * @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: key, resourceType, resourceId, secret - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - */ - listVariables(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; - /** - * Get a list of all variables of a specific function. - * - * @param {string} functionId - Function unique ID. - * @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: key, resourceType, resourceId, secret - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listVariables(functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; - listVariables( - paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.VariableList> { - let params: { functionId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const functionId = params.functionId; - const queries = params.queries; - const total = params.total; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. - * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable 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. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - createVariable(params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. - * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable 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. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVariable(functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; - createVariable( - paramsOrFirst: { functionId: string, variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; - } - - const functionId = params.functionId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof value === 'undefined') { - throw new AppwriteException('Missing required parameter: "value"'); - } - - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a variable by its unique ID. - * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - getVariable(params: { functionId: string, variableId: string }): Promise<Models.Variable>; - /** - * Get a variable by its unique ID. - * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getVariable(functionId: string, variableId: string): Promise<Models.Variable>; - getVariable( - paramsOrFirst: { functionId: string, variableId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Variable> { - let params: { functionId: string, variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - variableId: rest[0] as string - }; - } - - const functionId = params.functionId; - const variableId = params.variableId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update variable by its unique ID. - * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable unique ID. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - updateVariable(params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Update variable by its unique ID. - * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable unique ID. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVariable(functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; - updateVariable( - paramsOrFirst: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - } else { - params = { - functionId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; - } - - const functionId = params.functionId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a variable by its unique ID. - * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteVariable(params: { functionId: string, variableId: string }): Promise<{}>; - /** - * Delete a variable by its unique ID. - * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteVariable(functionId: string, variableId: string): Promise<{}>; - deleteVariable( - paramsOrFirst: { functionId: string, variableId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { functionId: string, variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; - } else { - params = { - functionId: paramsOrFirst as string, - variableId: rest[0] as string - }; - } - - const functionId = params.functionId; - const variableId = params.variableId; - - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/graphql.ts b/src/services/graphql.ts deleted file mode 100644 index fc553978..00000000 --- a/src/services/graphql.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Graphql { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Execute a GraphQL mutation. - * - * @param {object} params.query - The query or queries to execute. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - query(params: { query: object }): Promise<{}>; - /** - * Execute a GraphQL mutation. - * - * @param {object} query - The query or queries to execute. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - query(query: object): Promise<{}>; - query( - paramsOrFirst: { query: object } | object - ): Promise<{}> { - let params: { query: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { query: object }; - } else { - params = { - query: paramsOrFirst as object - }; - } - - const query = params.query; - - if (typeof query === 'undefined') { - throw new AppwriteException('Missing required parameter: "query"'); - } - - const apiPath = '/graphql'; - const payload: Payload = {}; - if (typeof query !== 'undefined') { - payload['query'] = query; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'x-sdk-graphql': 'true', - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Execute a GraphQL mutation. - * - * @param {object} params.query - The query or queries to execute. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - mutation(params: { query: object }): Promise<{}>; - /** - * Execute a GraphQL mutation. - * - * @param {object} query - The query or queries to execute. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - mutation(query: object): Promise<{}>; - mutation( - paramsOrFirst: { query: object } | object - ): Promise<{}> { - let params: { query: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { query: object }; - } else { - params = { - query: paramsOrFirst as object - }; - } - - const query = params.query; - - if (typeof query === 'undefined') { - throw new AppwriteException('Missing required parameter: "query"'); - } - - const apiPath = '/graphql/mutation'; - const payload: Payload = {}; - if (typeof query !== 'undefined') { - payload['query'] = query; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'x-sdk-graphql': 'true', - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/health.ts b/src/services/health.ts deleted file mode 100644 index 1bd2cf03..00000000 --- a/src/services/health.ts +++ /dev/null @@ -1,1043 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { Name } from '../enums/name'; - -export class Health { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Check the Appwrite HTTP server is up and responsive. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - get(): Promise<Models.HealthStatus> { - - const apiPath = '/health'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite Antivirus server is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthAntivirus>} - */ - getAntivirus(): Promise<Models.HealthAntivirus> { - - const apiPath = '/health/anti-virus'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite in-memory cache servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatusList>} - */ - getCache(): Promise<Models.HealthStatusList> { - - const apiPath = '/health/cache'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the SSL certificate for a domain - * - * @param {string} params.domain - string - * @throws {AppwriteException} - * @returns {Promise<Models.HealthCertificate>} - */ - getCertificate(params?: { domain?: string }): Promise<Models.HealthCertificate>; - /** - * Get the SSL certificate for a domain - * - * @param {string} domain - string - * @throws {AppwriteException} - * @returns {Promise<Models.HealthCertificate>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getCertificate(domain?: string): Promise<Models.HealthCertificate>; - getCertificate( - paramsOrFirst?: { domain?: string } | string - ): Promise<Models.HealthCertificate> { - let params: { domain?: string }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain?: string }; - } else { - params = { - domain: paramsOrFirst as string - }; - } - - const domain = params.domain; - - - const apiPath = '/health/certificate'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. - * - * - * @param {number} params.threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. - * @param {number} params.inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - getConsolePausing(params?: { threshold?: number, inactivityDays?: number }): Promise<Models.HealthStatus>; - /** - * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. - * - * - * @param {number} threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. - * @param {number} inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getConsolePausing(threshold?: number, inactivityDays?: number): Promise<Models.HealthStatus>; - getConsolePausing( - paramsOrFirst?: { threshold?: number, inactivityDays?: number } | number, - ...rest: [(number)?] - ): Promise<Models.HealthStatus> { - let params: { threshold?: number, inactivityDays?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number, inactivityDays?: number }; - } else { - params = { - threshold: paramsOrFirst as number, - inactivityDays: rest[0] as number - }; - } - - const threshold = params.threshold; - const inactivityDays = params.inactivityDays; - - - const apiPath = '/health/console-pausing'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - if (typeof inactivityDays !== 'undefined') { - payload['inactivityDays'] = inactivityDays; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite database servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatusList>} - */ - getDB(): Promise<Models.HealthStatusList> { - - const apiPath = '/health/db'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite pub-sub servers are up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatusList>} - */ - getPubSub(): Promise<Models.HealthStatusList> { - - const apiPath = '/health/pubsub'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. - * - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueAudits(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. - * - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueAudits(threshold?: number): Promise<Models.HealthQueue>; - getQueueAudits( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/audits'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueBuilds(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueBuilds(threshold?: number): Promise<Models.HealthQueue>; - getQueueBuilds( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/builds'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueCertificates(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueCertificates(threshold?: number): Promise<Models.HealthQueue>; - getQueueCertificates( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/certificates'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {string} params.name - Queue name for which to check the queue size - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueDatabases(params?: { name?: string, threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {string} name - Queue name for which to check the queue size - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueDatabases(name?: string, threshold?: number): Promise<Models.HealthQueue>; - getQueueDatabases( - paramsOrFirst?: { name?: string, threshold?: number } | string, - ...rest: [(number)?] - ): Promise<Models.HealthQueue> { - let params: { name?: string, threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name?: string, threshold?: number }; - } else { - params = { - name: paramsOrFirst as string, - threshold: rest[0] as number - }; - } - - const name = params.name; - const threshold = params.threshold; - - - const apiPath = '/health/queue/databases'; - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueDeletes(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueDeletes(threshold?: number): Promise<Models.HealthQueue>; - getQueueDeletes( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/deletes'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Returns the amount of failed jobs in a given queue. - * - * - * @param {Name} params.name - The name of the queue - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getFailedJobs(params: { name: Name, threshold?: number }): Promise<Models.HealthQueue>; - /** - * Returns the amount of failed jobs in a given queue. - * - * - * @param {Name} name - The name of the queue - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFailedJobs(name: Name, threshold?: number): Promise<Models.HealthQueue>; - getFailedJobs( - paramsOrFirst: { name: Name, threshold?: number } | Name, - ...rest: [(number)?] - ): Promise<Models.HealthQueue> { - let params: { name: Name, threshold?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('name' in paramsOrFirst || 'threshold' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name: Name, threshold?: number }; - } else { - params = { - name: paramsOrFirst as Name, - threshold: rest[0] as number - }; - } - - const name = params.name; - const threshold = params.threshold; - - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/health/queue/failed/{name}'.replace('{name}', name); - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueFunctions(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueFunctions(threshold?: number): Promise<Models.HealthQueue>; - getQueueFunctions( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/functions'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueLogs(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueLogs(threshold?: number): Promise<Models.HealthQueue>; - getQueueLogs( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/logs'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueMails(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMails(threshold?: number): Promise<Models.HealthQueue>; - getQueueMails( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/mails'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueMessaging(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMessaging(threshold?: number): Promise<Models.HealthQueue>; - getQueueMessaging( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/messaging'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueMigrations(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueMigrations(threshold?: number): Promise<Models.HealthQueue>; - getQueueMigrations( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/migrations'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueStatsResources(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueStatsResources(threshold?: number): Promise<Models.HealthQueue>; - getQueueStatsResources( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/stats-resources'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueUsage(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueUsage(threshold?: number): Promise<Models.HealthQueue>; - getQueueUsage( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/stats-usage'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - */ - getQueueWebhooks(params?: { threshold?: number }): Promise<Models.HealthQueue>; - /** - * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. - * - * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. - * @throws {AppwriteException} - * @returns {Promise<Models.HealthQueue>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getQueueWebhooks(threshold?: number): Promise<Models.HealthQueue>; - getQueueWebhooks( - paramsOrFirst?: { threshold?: number } | number - ): Promise<Models.HealthQueue> { - let params: { threshold?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { threshold?: number }; - } else { - params = { - threshold: paramsOrFirst as number - }; - } - - const threshold = params.threshold; - - - const apiPath = '/health/queue/webhooks'; - const payload: Payload = {}; - if (typeof threshold !== 'undefined') { - payload['threshold'] = threshold; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite storage device is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - getStorage(): Promise<Models.HealthStatus> { - - const apiPath = '/health/storage'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite local storage device is up and connection is successful. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthStatus>} - */ - getStorageLocal(): Promise<Models.HealthStatus> { - - const apiPath = '/health/storage/local'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. - * - * @throws {AppwriteException} - * @returns {Promise<Models.HealthTime>} - */ - getTime(): Promise<Models.HealthTime> { - - const apiPath = '/health/time'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/locale.ts b/src/services/locale.ts deleted file mode 100644 index 865a085f..00000000 --- a/src/services/locale.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Locale { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. - * - * ([IP Geolocation by DB-IP](https://db-ip.com)) - * - * @throws {AppwriteException} - * @returns {Promise<Models.Locale>} - */ - get(): Promise<Models.Locale> { - - const apiPath = '/locale'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). - * - * @throws {AppwriteException} - * @returns {Promise<Models.LocaleCodeList>} - */ - listCodes(): Promise<Models.LocaleCodeList> { - - const apiPath = '/locale/codes'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List of all continents. You can use the locale header to get the data in a supported language. - * - * @throws {AppwriteException} - * @returns {Promise<Models.ContinentList>} - */ - listContinents(): Promise<Models.ContinentList> { - - const apiPath = '/locale/continents'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List of all countries. You can use the locale header to get the data in a supported language. - * - * @throws {AppwriteException} - * @returns {Promise<Models.CountryList>} - */ - listCountries(): Promise<Models.CountryList> { - - const apiPath = '/locale/countries'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. - * - * @throws {AppwriteException} - * @returns {Promise<Models.CountryList>} - */ - listCountriesEU(): Promise<Models.CountryList> { - - const apiPath = '/locale/countries/eu'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List of all countries phone codes. You can use the locale header to get the data in a supported language. - * - * @throws {AppwriteException} - * @returns {Promise<Models.PhoneList>} - */ - listCountriesPhones(): Promise<Models.PhoneList> { - - const apiPath = '/locale/countries/phones'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. - * - * @throws {AppwriteException} - * @returns {Promise<Models.CurrencyList>} - */ - listCurrencies(): Promise<Models.CurrencyList> { - - const apiPath = '/locale/currencies'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. - * - * @throws {AppwriteException} - * @returns {Promise<Models.LanguageList>} - */ - listLanguages(): Promise<Models.LanguageList> { - - const apiPath = '/locale/languages'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/messaging.ts b/src/services/messaging.ts deleted file mode 100644 index 1b8ac968..00000000 --- a/src/services/messaging.ts +++ /dev/null @@ -1,5194 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { MessagePriority } from '../enums/message-priority'; -import { SmtpEncryption } from '../enums/smtp-encryption'; - -export class Messaging { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all messages from the current Appwrite project. - * - * @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: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MessageList>} - */ - listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.MessageList>; - /** - * Get a list of all messages from the current Appwrite project. - * - * @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: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MessageList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMessages(queries?: string[], search?: string, total?: boolean): Promise<Models.MessageList>; - listMessages( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.MessageList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/messaging/messages'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new email message. - * - * @param {string} params.messageId - Message 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. - * @param {string} params.subject - Email Subject. - * @param {string} params.content - Email Content. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string[]} params.cc - Array of target IDs to be added as CC. - * @param {string[]} params.bcc - Array of target IDs to be added as BCC. - * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {boolean} params.draft - Is message a draft - * @param {boolean} params.html - Is content of type HTML - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - createEmail(params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Create a new email message. - * - * @param {string} messageId - Message 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. - * @param {string} subject - Email Subject. - * @param {string} content - Email Content. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string[]} cc - Array of target IDs to be added as CC. - * @param {string[]} bcc - Array of target IDs to be added as BCC. - * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {boolean} draft - Is message a draft - * @param {boolean} html - Is content of type HTML - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise<Models.Message>; - createEmail( - paramsOrFirst: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (boolean)?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - subject: rest[0] as string, - content: rest[1] as string, - topics: rest[2] as string[], - users: rest[3] as string[], - targets: rest[4] as string[], - cc: rest[5] as string[], - bcc: rest[6] as string[], - attachments: rest[7] as string[], - draft: rest[8] as boolean, - html: rest[9] as boolean, - scheduledAt: rest[10] as string - }; - } - - const messageId = params.messageId; - const subject = params.subject; - const content = params.content; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const cc = params.cc; - const bcc = params.bcc; - const attachments = params.attachments; - const draft = params.draft; - const html = params.html; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (typeof subject === 'undefined') { - throw new AppwriteException('Missing required parameter: "subject"'); - } - if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); - } - - const apiPath = '/messaging/messages/email'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof subject !== 'undefined') { - payload['subject'] = subject; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof cc !== 'undefined') { - payload['cc'] = cc; - } - if (typeof bcc !== 'undefined') { - payload['bcc'] = bcc; - } - if (typeof attachments !== 'undefined') { - payload['attachments'] = attachments; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof html !== 'undefined') { - payload['html'] = html; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.subject - Email Subject. - * @param {string} params.content - Email Content. - * @param {boolean} params.draft - Is message a draft - * @param {boolean} params.html - Is content of type HTML - * @param {string[]} params.cc - Array of target IDs to be added as CC. - * @param {string[]} params.bcc - Array of target IDs to be added as BCC. - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - updateEmail(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise<Models.Message>; - /** - * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} subject - Email Subject. - * @param {string} content - Email Content. - * @param {boolean} draft - Is message a draft - * @param {boolean} html - Is content of type HTML - * @param {string[]} cc - Array of target IDs to be added as CC. - * @param {string[]} bcc - Array of target IDs to be added as BCC. - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message>; - updateEmail( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (boolean)?, (boolean)?, (string[])?, (string[])?, (string)?, (string[])?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - subject: rest[3] as string, - content: rest[4] as string, - draft: rest[5] as boolean, - html: rest[6] as boolean, - cc: rest[7] as string[], - bcc: rest[8] as string[], - scheduledAt: rest[9] as string, - attachments: rest[10] as string[] - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const subject = params.subject; - const content = params.content; - const draft = params.draft; - const html = params.html; - const cc = params.cc; - const bcc = params.bcc; - const scheduledAt = params.scheduledAt; - const attachments = params.attachments; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof subject !== 'undefined') { - payload['subject'] = subject; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof html !== 'undefined') { - payload['html'] = html; - } - if (typeof cc !== 'undefined') { - payload['cc'] = cc; - } - if (typeof bcc !== 'undefined') { - payload['bcc'] = bcc; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - if (typeof attachments !== 'undefined') { - payload['attachments'] = attachments; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new push notification. - * - * @param {string} params.messageId - Message 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. - * @param {string} params.title - Title for push notification. - * @param {string} params.body - Body for push notification. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {object} params.data - Additional key-value pair data for push notification. - * @param {string} params.action - Action for push notification. - * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} params.icon - Icon for push notification. Available only for Android and Web Platform. - * @param {string} params.sound - Sound for push notification. Available only for Android and iOS Platform. - * @param {string} params.color - Color for push notification. Available only for Android Platform. - * @param {string} params.tag - Tag for push notification. Available only for Android Platform. - * @param {number} params.badge - Badge for push notification. Available only for iOS Platform. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - createPush(params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; - /** - * Create a new push notification. - * - * @param {string} messageId - Message 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. - * @param {string} title - Title for push notification. - * @param {string} body - Body for push notification. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {object} data - Additional key-value pair data for push notification. - * @param {string} action - Action for push notification. - * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} icon - Icon for push notification. Available only for Android and Web Platform. - * @param {string} sound - Sound for push notification. Available only for Android and iOS Platform. - * @param {string} color - Color for push notification. Available only for Android Platform. - * @param {string} tag - Tag for push notification. Available only for Android Platform. - * @param {number} badge - Badge for push notification. Available only for iOS Platform. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPush(messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; - createPush( - paramsOrFirst: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, - ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] - ): Promise<Models.Message> { - let params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - } else { - params = { - messageId: paramsOrFirst as string, - title: rest[0] as string, - body: rest[1] as string, - topics: rest[2] as string[], - users: rest[3] as string[], - targets: rest[4] as string[], - data: rest[5] as object, - action: rest[6] as string, - image: rest[7] as string, - icon: rest[8] as string, - sound: rest[9] as string, - color: rest[10] as string, - tag: rest[11] as string, - badge: rest[12] as number, - draft: rest[13] as boolean, - scheduledAt: rest[14] as string, - contentAvailable: rest[15] as boolean, - critical: rest[16] as boolean, - priority: rest[17] as MessagePriority - }; - } - - const messageId = params.messageId; - const title = params.title; - const body = params.body; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const data = params.data; - const action = params.action; - const image = params.image; - const icon = params.icon; - const sound = params.sound; - const color = params.color; - const tag = params.tag; - const badge = params.badge; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - const contentAvailable = params.contentAvailable; - const critical = params.critical; - const priority = params.priority; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/push'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof title !== 'undefined') { - payload['title'] = title; - } - if (typeof body !== 'undefined') { - payload['body'] = body; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof action !== 'undefined') { - payload['action'] = action; - } - if (typeof image !== 'undefined') { - payload['image'] = image; - } - if (typeof icon !== 'undefined') { - payload['icon'] = icon; - } - if (typeof sound !== 'undefined') { - payload['sound'] = sound; - } - if (typeof color !== 'undefined') { - payload['color'] = color; - } - if (typeof tag !== 'undefined') { - payload['tag'] = tag; - } - if (typeof badge !== 'undefined') { - payload['badge'] = badge; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - if (typeof contentAvailable !== 'undefined') { - payload['contentAvailable'] = contentAvailable; - } - if (typeof critical !== 'undefined') { - payload['critical'] = critical; - } - if (typeof priority !== 'undefined') { - payload['priority'] = priority; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.title - Title for push notification. - * @param {string} params.body - Body for push notification. - * @param {object} params.data - Additional Data for push notification. - * @param {string} params.action - Action for push notification. - * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} params.icon - Icon for push notification. Available only for Android and Web platforms. - * @param {string} params.sound - Sound for push notification. Available only for Android and iOS platforms. - * @param {string} params.color - Color for push notification. Available only for Android platforms. - * @param {string} params.tag - Tag for push notification. Available only for Android platforms. - * @param {number} params.badge - Badge for push notification. Available only for iOS platforms. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - updatePush(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; - /** - * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} title - Title for push notification. - * @param {string} body - Body for push notification. - * @param {object} data - Additional Data for push notification. - * @param {string} action - Action for push notification. - * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. - * @param {string} icon - Icon for push notification. Available only for Android and Web platforms. - * @param {string} sound - Sound for push notification. Available only for Android and iOS platforms. - * @param {string} color - Color for push notification. Available only for Android platforms. - * @param {string} tag - Tag for push notification. Available only for Android platforms. - * @param {number} badge - Badge for push notification. Available only for iOS platforms. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. - * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. - * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; - updatePush( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - title: rest[3] as string, - body: rest[4] as string, - data: rest[5] as object, - action: rest[6] as string, - image: rest[7] as string, - icon: rest[8] as string, - sound: rest[9] as string, - color: rest[10] as string, - tag: rest[11] as string, - badge: rest[12] as number, - draft: rest[13] as boolean, - scheduledAt: rest[14] as string, - contentAvailable: rest[15] as boolean, - critical: rest[16] as boolean, - priority: rest[17] as MessagePriority - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const title = params.title; - const body = params.body; - const data = params.data; - const action = params.action; - const image = params.image; - const icon = params.icon; - const sound = params.sound; - const color = params.color; - const tag = params.tag; - const badge = params.badge; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - const contentAvailable = params.contentAvailable; - const critical = params.critical; - const priority = params.priority; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof title !== 'undefined') { - payload['title'] = title; - } - if (typeof body !== 'undefined') { - payload['body'] = body; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof action !== 'undefined') { - payload['action'] = action; - } - if (typeof image !== 'undefined') { - payload['image'] = image; - } - if (typeof icon !== 'undefined') { - payload['icon'] = icon; - } - if (typeof sound !== 'undefined') { - payload['sound'] = sound; - } - if (typeof color !== 'undefined') { - payload['color'] = color; - } - if (typeof tag !== 'undefined') { - payload['tag'] = tag; - } - if (typeof badge !== 'undefined') { - payload['badge'] = badge; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - if (typeof contentAvailable !== 'undefined') { - payload['contentAvailable'] = contentAvailable; - } - if (typeof critical !== 'undefined') { - payload['critical'] = critical; - } - if (typeof priority !== 'undefined') { - payload['priority'] = priority; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new SMS message. - * - * @param {string} params.messageId - Message 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. - * @param {string} params.content - SMS Content. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead. - */ - createSms(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Create a new SMS message. - * - * @param {string} messageId - Message 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. - * @param {string} content - SMS Content. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSms(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - createSms( - paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - content: rest[0] as string, - topics: rest[1] as string[], - users: rest[2] as string[], - targets: rest[3] as string[], - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const content = params.content; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); - } - - const apiPath = '/messaging/messages/sms'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new SMS message. - * - * @param {string} params.messageId - Message 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. - * @param {string} params.content - SMS Content. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - createSMS(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Create a new SMS message. - * - * @param {string} messageId - Message 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. - * @param {string} content - SMS Content. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSMS(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - createSMS( - paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - content: rest[0] as string, - topics: rest[1] as string[], - users: rest[2] as string[], - targets: rest[3] as string[], - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const content = params.content; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - if (typeof content === 'undefined') { - throw new AppwriteException('Missing required parameter: "content"'); - } - - const apiPath = '/messaging/messages/sms'; - const payload: Payload = {}; - if (typeof messageId !== 'undefined') { - payload['messageId'] = messageId; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.content - Email Content. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead. - */ - updateSms(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} content - Email Content. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSms(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - updateSms( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - content: rest[3] as string, - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const content = params.content; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} params.messageId - Message ID. - * @param {string[]} params.topics - List of Topic IDs. - * @param {string[]} params.users - List of User IDs. - * @param {string[]} params.targets - List of Targets IDs. - * @param {string} params.content - Email Content. - * @param {boolean} params.draft - Is message a draft - * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - updateSMS(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; - /** - * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. - * - * - * @param {string} messageId - Message ID. - * @param {string[]} topics - List of Topic IDs. - * @param {string[]} users - List of User IDs. - * @param {string[]} targets - List of Targets IDs. - * @param {string} content - Email Content. - * @param {boolean} draft - Is message a draft - * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSMS(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; - updateSMS( - paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, - ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] - ): Promise<Models.Message> { - let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; - } else { - params = { - messageId: paramsOrFirst as string, - topics: rest[0] as string[], - users: rest[1] as string[], - targets: rest[2] as string[], - content: rest[3] as string, - draft: rest[4] as boolean, - scheduledAt: rest[5] as string - }; - } - - const messageId = params.messageId; - const topics = params.topics; - const users = params.users; - const targets = params.targets; - const content = params.content; - const draft = params.draft; - const scheduledAt = params.scheduledAt; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof topics !== 'undefined') { - payload['topics'] = topics; - } - if (typeof users !== 'undefined') { - payload['users'] = users; - } - if (typeof targets !== 'undefined') { - payload['targets'] = targets; - } - if (typeof content !== 'undefined') { - payload['content'] = content; - } - if (typeof draft !== 'undefined') { - payload['draft'] = draft; - } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a message by its unique ID. - * - * - * @param {string} params.messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - */ - getMessage(params: { messageId: string }): Promise<Models.Message>; - /** - * Get a message by its unique ID. - * - * - * @param {string} messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Message>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMessage(messageId: string): Promise<Models.Message>; - getMessage( - paramsOrFirst: { messageId: string } | string - ): Promise<Models.Message> { - let params: { messageId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string }; - } else { - params = { - messageId: paramsOrFirst as string - }; - } - - const messageId = params.messageId; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. - * - * @param {string} params.messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { messageId: string }): Promise<{}>; - /** - * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. - * - * @param {string} messageId - Message ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(messageId: string): Promise<{}>; - delete( - paramsOrFirst: { messageId: string } | string - ): Promise<{}> { - let params: { messageId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string }; - } else { - params = { - messageId: paramsOrFirst as string - }; - } - - const messageId = params.messageId; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the message activity logs listed by its unique ID. - * - * @param {string} params.messageId - Message ID. - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the message activity logs listed by its unique ID. - * - * @param {string} messageId - Message ID. - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMessageLogs(messageId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listMessageLogs( - paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { messageId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; - } else { - params = { - messageId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const messageId = params.messageId; - const queries = params.queries; - const total = params.total; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}/logs'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of the targets associated with a message. - * - * @param {string} params.messageId - Message ID. - * @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, providerId, identifier, providerType - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - */ - listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; - /** - * Get a list of the targets associated with a message. - * - * @param {string} messageId - Message ID. - * @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, providerId, identifier, providerType - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTargets(messageId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; - listTargets( - paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.TargetList> { - let params: { messageId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; - } else { - params = { - messageId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const messageId = params.messageId; - const queries = params.queries; - const total = params.total; - - if (typeof messageId === 'undefined') { - throw new AppwriteException('Missing required parameter: "messageId"'); - } - - const apiPath = '/messaging/messages/{messageId}/targets'.replace('{messageId}', messageId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all providers from the current Appwrite project. - * - * @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: name, provider, type, enabled - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProviderList>} - */ - listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.ProviderList>; - /** - * Get a list of all providers from the current Appwrite project. - * - * @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: name, provider, type, enabled - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProviderList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listProviders(queries?: string[], search?: string, total?: boolean): Promise<Models.ProviderList>; - listProviders( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.ProviderList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/messaging/providers'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead. - */ - createApnsProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createApnsProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; - createApnsProvider( - paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - authKey: rest[1] as string, - authKeyId: rest[2] as string, - teamId: rest[3] as string, - bundleId: rest[4] as string, - sandbox: rest[5] as boolean, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/apns'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createAPNSProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Apple Push Notification service provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createAPNSProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; - createAPNSProvider( - paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - authKey: rest[1] as string, - authKeyId: rest[2] as string, - teamId: rest[3] as string, - bundleId: rest[4] as string, - sandbox: rest[5] as boolean, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/apns'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead. - */ - updateApnsProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateApnsProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; - updateApnsProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - authKey: rest[2] as string, - authKeyId: rest[3] as string, - teamId: rest[4] as string, - bundleId: rest[5] as string, - sandbox: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.authKey - APNS authentication key. - * @param {string} params.authKeyId - APNS authentication key ID. - * @param {string} params.teamId - APNS team ID. - * @param {string} params.bundleId - APNS bundle ID. - * @param {boolean} params.sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateAPNSProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; - /** - * Update a Apple Push Notification service provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} authKey - APNS authentication key. - * @param {string} authKeyId - APNS authentication key ID. - * @param {string} teamId - APNS team ID. - * @param {string} bundleId - APNS bundle ID. - * @param {boolean} sandbox - Use APNS sandbox environment. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAPNSProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; - updateAPNSProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - authKey: rest[2] as string, - authKeyId: rest[3] as string, - teamId: rest[4] as string, - bundleId: rest[5] as string, - sandbox: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const authKey = params.authKey; - const authKeyId = params.authKeyId; - const teamId = params.teamId; - const bundleId = params.bundleId; - const sandbox = params.sandbox; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof authKeyId !== 'undefined') { - payload['authKeyId'] = authKeyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof bundleId !== 'undefined') { - payload['bundleId'] = bundleId; - } - if (typeof sandbox !== 'undefined') { - payload['sandbox'] = sandbox; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead. - */ - createFcmProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; - createFcmProvider( - paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, - ...rest: [(string)?, (object)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - serviceAccountJSON: rest[1] as object, - enabled: rest[2] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const serviceAccountJSON = params.serviceAccountJSON; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/fcm'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createFCMProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Firebase Cloud Messaging provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFCMProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; - createFCMProvider( - paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, - ...rest: [(string)?, (object)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - serviceAccountJSON: rest[1] as object, - enabled: rest[2] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const serviceAccountJSON = params.serviceAccountJSON; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/fcm'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead. - */ - updateFcmProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFcmProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; - updateFcmProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, - ...rest: [(string)?, (boolean)?, (object)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - serviceAccountJSON: rest[2] as object - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const serviceAccountJSON = params.serviceAccountJSON; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {object} params.serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateFCMProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; - /** - * Update a Firebase Cloud Messaging provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {object} serviceAccountJSON - FCM service account JSON. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFCMProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; - updateFCMProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, - ...rest: [(string)?, (boolean)?, (object)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - serviceAccountJSON: rest[2] as object - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const serviceAccountJSON = params.serviceAccountJSON; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof serviceAccountJSON !== 'undefined') { - payload['serviceAccountJSON'] = serviceAccountJSON; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Mailgun provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Mailgun API Key. - * @param {string} params.domain - Mailgun Domain. - * @param {boolean} params.isEuRegion - Set as EU region. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createMailgunProvider(params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Mailgun provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} apiKey - Mailgun API Key. - * @param {string} domain - Mailgun Domain. - * @param {boolean} isEuRegion - Set as EU region. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMailgunProvider(providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createMailgunProvider( - paramsOrFirst: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - domain: rest[2] as string, - isEuRegion: rest[3] as boolean, - fromName: rest[4] as string, - fromEmail: rest[5] as string, - replyToName: rest[6] as string, - replyToEmail: rest[7] as string, - enabled: rest[8] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const domain = params.domain; - const isEuRegion = params.isEuRegion; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/mailgun'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof isEuRegion !== 'undefined') { - payload['isEuRegion'] = isEuRegion; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Mailgun provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Mailgun API Key. - * @param {string} params.domain - Mailgun Domain. - * @param {boolean} params.isEuRegion - Set as EU region. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateMailgunProvider(params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; - /** - * Update a Mailgun provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {string} apiKey - Mailgun API Key. - * @param {string} domain - Mailgun Domain. - * @param {boolean} isEuRegion - Set as EU region. - * @param {boolean} enabled - Set as enabled. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMailgunProvider(providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; - updateMailgunProvider( - paramsOrFirst: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - domain: rest[2] as string, - isEuRegion: rest[3] as boolean, - enabled: rest[4] as boolean, - fromName: rest[5] as string, - fromEmail: rest[6] as string, - replyToName: rest[7] as string, - replyToEmail: rest[8] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const domain = params.domain; - const isEuRegion = params.isEuRegion; - const enabled = params.enabled; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/mailgun/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof isEuRegion !== 'undefined') { - payload['isEuRegion'] = isEuRegion; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new MSG91 provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.templateId - Msg91 template ID - * @param {string} params.senderId - Msg91 sender ID. - * @param {string} params.authKey - Msg91 auth key. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createMsg91Provider(params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new MSG91 provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} templateId - Msg91 template ID - * @param {string} senderId - Msg91 sender ID. - * @param {string} authKey - Msg91 auth key. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider>; - createMsg91Provider( - paramsOrFirst: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - templateId: rest[1] as string, - senderId: rest[2] as string, - authKey: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const templateId = params.templateId; - const senderId = params.senderId; - const authKey = params.authKey; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/msg91'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; - } - if (typeof senderId !== 'undefined') { - payload['senderId'] = senderId; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a MSG91 provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.templateId - Msg91 template ID. - * @param {string} params.senderId - Msg91 sender ID. - * @param {string} params.authKey - Msg91 auth key. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateMsg91Provider(params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise<Models.Provider>; - /** - * Update a MSG91 provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} templateId - Msg91 template ID. - * @param {string} senderId - Msg91 sender ID. - * @param {string} authKey - Msg91 auth key. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider>; - updateMsg91Provider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - templateId: rest[2] as string, - senderId: rest[3] as string, - authKey: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const templateId = params.templateId; - const senderId = params.senderId; - const authKey = params.authKey; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; - } - if (typeof senderId !== 'undefined') { - payload['senderId'] = senderId; - } - if (typeof authKey !== 'undefined') { - payload['authKey'] = authKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Resend provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Resend API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Resend provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} apiKey - Resend API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createResendProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createResendProvider( - paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - fromName: rest[2] as string, - fromEmail: rest[3] as string, - replyToName: rest[4] as string, - replyToEmail: rest[5] as string, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/resend'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Resend provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.apiKey - Resend API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; - /** - * Update a Resend provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} apiKey - Resend API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateResendProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; - updateResendProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - apiKey: rest[2] as string, - fromName: rest[3] as string, - fromEmail: rest[4] as string, - replyToName: rest[5] as string, - replyToEmail: rest[6] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Sendgrid provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.apiKey - Sendgrid API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createSendgridProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Sendgrid provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} apiKey - Sendgrid API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSendgridProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createSendgridProvider( - paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - apiKey: rest[1] as string, - fromName: rest[2] as string, - fromEmail: rest[3] as string, - replyToName: rest[4] as string, - replyToEmail: rest[5] as string, - enabled: rest[6] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/sendgrid'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Sendgrid provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.apiKey - Sendgrid API key. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateSendgridProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; - /** - * Update a Sendgrid provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} apiKey - Sendgrid API key. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSendgridProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; - updateSendgridProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - apiKey: rest[2] as string, - fromName: rest[3] as string, - fromEmail: rest[4] as string, - replyToName: rest[5] as string, - replyToEmail: rest[6] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const apiKey = params.apiKey; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new SMTP provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - The default SMTP server port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead. - */ - createSmtpProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new SMTP provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - The default SMTP server port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSmtpProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createSmtpProvider( - paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof host === 'undefined') { - throw new AppwriteException('Missing required parameter: "host"'); - } - - const apiPath = '/messaging/providers/smtp'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new SMTP provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - The default SMTP server port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createSMTPProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new SMTP provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - The default SMTP server port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. - * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSMTPProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - createSMTPProvider( - paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof host === 'undefined') { - throw new AppwriteException('Missing required parameter: "host"'); - } - - const apiPath = '/messaging/providers/smtp'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - SMTP port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead. - */ - updateSmtpProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - SMTP port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSmtpProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - updateSmtpProvider( - paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} params.port - SMTP port. - * @param {string} params.username - Authentication username. - * @param {string} params.password - Authentication password. - * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. - * @param {string} params.mailer - The value to use for the X-Mailer header. - * @param {string} params.fromName - Sender Name. - * @param {string} params.fromEmail - Sender email address. - * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateSMTPProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Update a SMTP provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. - * @param {number} port - SMTP port. - * @param {string} username - Authentication username. - * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' - * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. - * @param {string} mailer - The value to use for the X-Mailer header. - * @param {string} fromName - Sender Name. - * @param {string} fromEmail - Sender email address. - * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. - * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSMTPProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; - updateSMTPProvider( - paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - host: rest[1] as string, - port: rest[2] as number, - username: rest[3] as string, - password: rest[4] as string, - encryption: rest[5] as SmtpEncryption, - autoTLS: rest[6] as boolean, - mailer: rest[7] as string, - fromName: rest[8] as string, - fromEmail: rest[9] as string, - replyToName: rest[10] as string, - replyToEmail: rest[11] as string, - enabled: rest[12] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const encryption = params.encryption; - const autoTLS = params.autoTLS; - const mailer = params.mailer; - const fromName = params.fromName; - const fromEmail = params.fromEmail; - const replyToName = params.replyToName; - const replyToEmail = params.replyToEmail; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof autoTLS !== 'undefined') { - payload['autoTLS'] = autoTLS; - } - if (typeof mailer !== 'undefined') { - payload['mailer'] = mailer; - } - if (typeof fromName !== 'undefined') { - payload['fromName'] = fromName; - } - if (typeof fromEmail !== 'undefined') { - payload['fromEmail'] = fromEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Telesign provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.customerId - Telesign customer ID. - * @param {string} params.apiKey - Telesign API key. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createTelesignProvider(params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Telesign provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} customerId - Telesign customer ID. - * @param {string} apiKey - Telesign API key. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTelesignProvider(providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; - createTelesignProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - customerId: rest[2] as string, - apiKey: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const customerId = params.customerId; - const apiKey = params.apiKey; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/telesign'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof customerId !== 'undefined') { - payload['customerId'] = customerId; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Telesign provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.customerId - Telesign customer ID. - * @param {string} params.apiKey - Telesign API key. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateTelesignProvider(params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Telesign provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} customerId - Telesign customer ID. - * @param {string} apiKey - Telesign API key. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTelesignProvider(providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise<Models.Provider>; - updateTelesignProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - customerId: rest[2] as string, - apiKey: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const customerId = params.customerId; - const apiKey = params.apiKey; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/telesign/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof customerId !== 'undefined') { - payload['customerId'] = customerId; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Textmagic provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.username - Textmagic username. - * @param {string} params.apiKey - Textmagic apiKey. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createTextmagicProvider(params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Textmagic provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} username - Textmagic username. - * @param {string} apiKey - Textmagic apiKey. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTextmagicProvider(providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; - createTextmagicProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - username: rest[2] as string, - apiKey: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const username = params.username; - const apiKey = params.apiKey; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/textmagic'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Textmagic provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.username - Textmagic username. - * @param {string} params.apiKey - Textmagic apiKey. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateTextmagicProvider(params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Textmagic provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} username - Textmagic username. - * @param {string} apiKey - Textmagic apiKey. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTextmagicProvider(providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise<Models.Provider>; - updateTextmagicProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - username: rest[2] as string, - apiKey: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const username = params.username; - const apiKey = params.apiKey; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/textmagic/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Twilio provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.accountSid - Twilio account secret ID. - * @param {string} params.authToken - Twilio authentication token. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createTwilioProvider(params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Twilio provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} accountSid - Twilio account secret ID. - * @param {string} authToken - Twilio authentication token. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTwilioProvider(providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise<Models.Provider>; - createTwilioProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - accountSid: rest[2] as string, - authToken: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const accountSid = params.accountSid; - const authToken = params.authToken; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/twilio'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof accountSid !== 'undefined') { - payload['accountSid'] = accountSid; - } - if (typeof authToken !== 'undefined') { - payload['authToken'] = authToken; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Twilio provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.accountSid - Twilio account secret ID. - * @param {string} params.authToken - Twilio authentication token. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateTwilioProvider(params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Twilio provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} accountSid - Twilio account secret ID. - * @param {string} authToken - Twilio authentication token. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTwilioProvider(providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise<Models.Provider>; - updateTwilioProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - accountSid: rest[2] as string, - authToken: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const accountSid = params.accountSid; - const authToken = params.authToken; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/twilio/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof accountSid !== 'undefined') { - payload['accountSid'] = accountSid; - } - if (typeof authToken !== 'undefined') { - payload['authToken'] = authToken; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Vonage provider. - * - * @param {string} params.providerId - Provider 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. - * @param {string} params.name - Provider name. - * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.apiKey - Vonage API key. - * @param {string} params.apiSecret - Vonage API secret. - * @param {boolean} params.enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - createVonageProvider(params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.Provider>; - /** - * Create a new Vonage provider. - * - * @param {string} providerId - Provider 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. - * @param {string} name - Provider name. - * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} apiKey - Vonage API key. - * @param {string} apiSecret - Vonage API secret. - * @param {boolean} enabled - Set as enabled. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVonageProvider(providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.Provider>; - createVonageProvider( - paramsOrFirst: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - from: rest[1] as string, - apiKey: rest[2] as string, - apiSecret: rest[3] as string, - enabled: rest[4] as boolean - }; - } - - const providerId = params.providerId; - const name = params.name; - const from = params.from; - const apiKey = params.apiKey; - const apiSecret = params.apiSecret; - const enabled = params.enabled; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/providers/vonage'; - const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Vonage provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @param {string} params.name - Provider name. - * @param {boolean} params.enabled - Set as enabled. - * @param {string} params.apiKey - Vonage API key. - * @param {string} params.apiSecret - Vonage API secret. - * @param {string} params.from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - updateVonageProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise<Models.Provider>; - /** - * Update a Vonage provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @param {string} name - Provider name. - * @param {boolean} enabled - Set as enabled. - * @param {string} apiKey - Vonage API key. - * @param {string} apiSecret - Vonage API secret. - * @param {string} from - Sender number. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVonageProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise<Models.Provider>; - updateVonageProvider( - paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string } | string, - ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Provider> { - let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; - } else { - params = { - providerId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - apiKey: rest[2] as string, - apiSecret: rest[3] as string, - from: rest[4] as string - }; - } - - const providerId = params.providerId; - const name = params.name; - const enabled = params.enabled; - const apiKey = params.apiKey; - const apiSecret = params.apiSecret; - const from = params.from; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/vonage/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; - } - if (typeof from !== 'undefined') { - payload['from'] = from; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a provider by its unique ID. - * - * - * @param {string} params.providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - */ - getProvider(params: { providerId: string }): Promise<Models.Provider>; - /** - * Get a provider by its unique ID. - * - * - * @param {string} providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Provider>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getProvider(providerId: string): Promise<Models.Provider>; - getProvider( - paramsOrFirst: { providerId: string } | string - ): Promise<Models.Provider> { - let params: { providerId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string }; - } else { - params = { - providerId: paramsOrFirst as string - }; - } - - const providerId = params.providerId; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a provider by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteProvider(params: { providerId: string }): Promise<{}>; - /** - * Delete a provider by its unique ID. - * - * @param {string} providerId - Provider ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteProvider(providerId: string): Promise<{}>; - deleteProvider( - paramsOrFirst: { providerId: string } | string - ): Promise<{}> { - let params: { providerId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string }; - } else { - params = { - providerId: paramsOrFirst as string - }; - } - - const providerId = params.providerId; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the provider activity logs listed by its unique ID. - * - * @param {string} params.providerId - Provider ID. - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the provider activity logs listed by its unique ID. - * - * @param {string} providerId - Provider ID. - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listProviderLogs(providerId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listProviderLogs( - paramsOrFirst: { providerId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { providerId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: string, queries?: string[], total?: boolean }; - } else { - params = { - providerId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const providerId = params.providerId; - const queries = params.queries; - const total = params.total; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/messaging/providers/{providerId}/logs'.replace('{providerId}', providerId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the subscriber activity logs listed by its unique ID. - * - * @param {string} params.subscriberId - Subscriber ID. - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the subscriber activity logs listed by its unique ID. - * - * @param {string} subscriberId - Subscriber ID. - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSubscriberLogs(subscriberId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listSubscriberLogs( - paramsOrFirst: { subscriberId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { subscriberId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { subscriberId: string, queries?: string[], total?: boolean }; - } else { - params = { - subscriberId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const subscriberId = params.subscriberId; - const queries = params.queries; - const total = params.total; - - if (typeof subscriberId === 'undefined') { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - - const apiPath = '/messaging/subscribers/{subscriberId}/logs'.replace('{subscriberId}', subscriberId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all topics from the current Appwrite project. - * - * @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: name, description, emailTotal, smsTotal, pushTotal - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TopicList>} - */ - listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TopicList>; - /** - * Get a list of all topics from the current Appwrite project. - * - * @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: name, description, emailTotal, smsTotal, pushTotal - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TopicList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTopics(queries?: string[], search?: string, total?: boolean): Promise<Models.TopicList>; - listTopics( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.TopicList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/messaging/topics'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new topic. - * - * @param {string} params.topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. - * @param {string} params.name - Topic Name. - * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - */ - createTopic(params: { topicId: string, name: string, subscribe?: string[] }): Promise<Models.Topic>; - /** - * Create a new topic. - * - * @param {string} topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. - * @param {string} name - Topic Name. - * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTopic(topicId: string, name: string, subscribe?: string[]): Promise<Models.Topic>; - createTopic( - paramsOrFirst: { topicId: string, name: string, subscribe?: string[] } | string, - ...rest: [(string)?, (string[])?] - ): Promise<Models.Topic> { - let params: { topicId: string, name: string, subscribe?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, name: string, subscribe?: string[] }; - } else { - params = { - topicId: paramsOrFirst as string, - name: rest[0] as string, - subscribe: rest[1] as string[] - }; - } - - const topicId = params.topicId; - const name = params.name; - const subscribe = params.subscribe; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/messaging/topics'; - const payload: Payload = {}; - if (typeof topicId !== 'undefined') { - payload['topicId'] = topicId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof subscribe !== 'undefined') { - payload['subscribe'] = subscribe; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a topic by its unique ID. - * - * - * @param {string} params.topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - */ - getTopic(params: { topicId: string }): Promise<Models.Topic>; - /** - * Get a topic by its unique ID. - * - * - * @param {string} topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTopic(topicId: string): Promise<Models.Topic>; - getTopic( - paramsOrFirst: { topicId: string } | string - ): Promise<Models.Topic> { - let params: { topicId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string }; - } else { - params = { - topicId: paramsOrFirst as string - }; - } - - const topicId = params.topicId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a topic by its unique ID. - * - * - * @param {string} params.topicId - Topic ID. - * @param {string} params.name - Topic Name. - * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - */ - updateTopic(params: { topicId: string, name?: string, subscribe?: string[] }): Promise<Models.Topic>; - /** - * Update a topic by its unique ID. - * - * - * @param {string} topicId - Topic ID. - * @param {string} name - Topic Name. - * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Topic>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTopic(topicId: string, name?: string, subscribe?: string[]): Promise<Models.Topic>; - updateTopic( - paramsOrFirst: { topicId: string, name?: string, subscribe?: string[] } | string, - ...rest: [(string)?, (string[])?] - ): Promise<Models.Topic> { - let params: { topicId: string, name?: string, subscribe?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, name?: string, subscribe?: string[] }; - } else { - params = { - topicId: paramsOrFirst as string, - name: rest[0] as string, - subscribe: rest[1] as string[] - }; - } - - const topicId = params.topicId; - const name = params.name; - const subscribe = params.subscribe; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof subscribe !== 'undefined') { - payload['subscribe'] = subscribe; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a topic by its unique ID. - * - * @param {string} params.topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTopic(params: { topicId: string }): Promise<{}>; - /** - * Delete a topic by its unique ID. - * - * @param {string} topicId - Topic ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTopic(topicId: string): Promise<{}>; - deleteTopic( - paramsOrFirst: { topicId: string } | string - ): Promise<{}> { - let params: { topicId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string }; - } else { - params = { - topicId: paramsOrFirst as string - }; - } - - const topicId = params.topicId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the topic activity logs listed by its unique ID. - * - * @param {string} params.topicId - Topic ID. - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the topic activity logs listed by its unique ID. - * - * @param {string} topicId - Topic ID. - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTopicLogs(topicId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listTopicLogs( - paramsOrFirst: { topicId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { topicId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], total?: boolean }; - } else { - params = { - topicId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const topicId = params.topicId; - const queries = params.queries; - const total = params.total; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}/logs'.replace('{topicId}', topicId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all subscribers from the current Appwrite project. - * - * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @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: targetId, topicId, userId, providerType - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SubscriberList>} - */ - listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.SubscriberList>; - /** - * Get a list of all subscribers from the current Appwrite project. - * - * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @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: targetId, topicId, userId, providerType - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SubscriberList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSubscribers(topicId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.SubscriberList>; - listSubscribers( - paramsOrFirst: { topicId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.SubscriberList> { - let params: { topicId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - topicId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const topicId = params.topicId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - - const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new subscriber. - * - * @param {string} params.topicId - Topic ID. The topic ID to subscribe to. - * @param {string} params.subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. - * @param {string} params.targetId - Target ID. The target ID to link to the specified Topic ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Subscriber>} - */ - createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise<Models.Subscriber>; - /** - * Create a new subscriber. - * - * @param {string} topicId - Topic ID. The topic ID to subscribe to. - * @param {string} subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. - * @param {string} targetId - Target ID. The target ID to link to the specified Topic ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Subscriber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber>; - createSubscriber( - paramsOrFirst: { topicId: string, subscriberId: string, targetId: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Subscriber> { - let params: { topicId: string, subscriberId: string, targetId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string, targetId: string }; - } else { - params = { - topicId: paramsOrFirst as string, - subscriberId: rest[0] as string, - targetId: rest[1] as string - }; - } - - const topicId = params.topicId; - const subscriberId = params.subscriberId; - const targetId = params.targetId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (typeof subscriberId === 'undefined') { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); - const payload: Payload = {}; - if (typeof subscriberId !== 'undefined') { - payload['subscriberId'] = subscriberId; - } - if (typeof targetId !== 'undefined') { - payload['targetId'] = targetId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a subscriber by its unique ID. - * - * - * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @param {string} params.subscriberId - Subscriber ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Subscriber>} - */ - getSubscriber(params: { topicId: string, subscriberId: string }): Promise<Models.Subscriber>; - /** - * Get a subscriber by its unique ID. - * - * - * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @param {string} subscriberId - Subscriber ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Subscriber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getSubscriber(topicId: string, subscriberId: string): Promise<Models.Subscriber>; - getSubscriber( - paramsOrFirst: { topicId: string, subscriberId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Subscriber> { - let params: { topicId: string, subscriberId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; - } else { - params = { - topicId: paramsOrFirst as string, - subscriberId: rest[0] as string - }; - } - - const topicId = params.topicId; - const subscriberId = params.subscriberId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (typeof subscriberId === 'undefined') { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - - const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a subscriber by its unique ID. - * - * @param {string} params.topicId - Topic ID. The topic ID subscribed to. - * @param {string} params.subscriberId - Subscriber ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>; - /** - * Delete a subscriber by its unique ID. - * - * @param {string} topicId - Topic ID. The topic ID subscribed to. - * @param {string} subscriberId - Subscriber ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteSubscriber(topicId: string, subscriberId: string): Promise<{}>; - deleteSubscriber( - paramsOrFirst: { topicId: string, subscriberId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { topicId: string, subscriberId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; - } else { - params = { - topicId: paramsOrFirst as string, - subscriberId: rest[0] as string - }; - } - - const topicId = params.topicId; - const subscriberId = params.subscriberId; - - if (typeof topicId === 'undefined') { - throw new AppwriteException('Missing required parameter: "topicId"'); - } - if (typeof subscriberId === 'undefined') { - throw new AppwriteException('Missing required parameter: "subscriberId"'); - } - - const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/presences.ts b/src/services/presences.ts deleted file mode 100644 index 80cfb5b3..00000000 --- a/src/services/presences.ts +++ /dev/null @@ -1,383 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Presences { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List presence logs. Expired entries are filtered out automatically. - * - * - * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.PresenceList<Presence>>} - */ - list<Presence extends Models.Presence = Models.DefaultPresence>(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise<Models.PresenceList<Presence>>; - /** - * List presence logs. Expired entries are filtered out automatically. - * - * - * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.PresenceList<Presence>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list<Presence extends Models.Presence = Models.DefaultPresence>(queries?: string[], total?: boolean, ttl?: number): Promise<Models.PresenceList<Presence>>; - list<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], - ...rest: [(boolean)?, (number)?] - ): Promise<Models.PresenceList<Presence>> { - let params: { queries?: string[], total?: boolean, ttl?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean, ttl?: number }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean, - ttl: rest[1] as number - }; - } - - const queries = params.queries; - const total = params.total; - const ttl = params.ttl; - - - const apiPath = '/presences'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. - * - * - * @param {string} params.presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise<Presence>} - */ - get<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string }): Promise<Presence>; - /** - * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. - * - * - * @param {string} presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise<Presence>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string): Promise<Presence>; - get<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string } | string - ): Promise<Presence> { - let params: { presenceId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string }; - } else { - params = { - presenceId: paramsOrFirst as string - }; - } - - const presenceId = params.presenceId; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create or update a presence log by its user ID. - * - * - * @param {string} params.presenceId - Presence unique ID. - * @param {string} params.userId - User ID. - * @param {string} params.status - Presence status. - * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.expiresAt - Presence expiry datetime. - * @param {object} params.metadata - Presence metadata object. - * @throws {AppwriteException} - * @returns {Promise<Presence>} - */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Presence>; - /** - * Create or update a presence log by its user ID. - * - * - * @param {string} presenceId - Presence unique ID. - * @param {string} userId - User ID. - * @param {string} status - Presence status. - * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} expiresAt - Presence expiry datetime. - * @param {object} metadata - Presence metadata object. - * @throws {AppwriteException} - * @returns {Promise<Presence>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; - upsert<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] - ): Promise<Presence> { - let params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; - } else { - params = { - presenceId: paramsOrFirst as string, - userId: rest[0] as string, - status: rest[1] as string, - permissions: rest[2] as string[], - expiresAt: rest[3] as string, - metadata: rest[4] as object - }; - } - - const presenceId = params.presenceId; - const userId = params.userId; - const status = params.status; - const permissions = params.permissions; - const expiresAt = params.expiresAt; - const metadata = params.metadata; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof expiresAt !== 'undefined') { - payload['expiresAt'] = expiresAt; - } - if (typeof metadata !== 'undefined') { - payload['metadata'] = metadata; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * - * @param {string} params.presenceId - Presence unique ID. - * @param {string} params.userId - User ID. - * @param {string} params.status - Presence status. - * @param {string} params.expiresAt - Presence expiry datetime. - * @param {object} params.metadata - Presence metadata object. - * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.purge - When true, purge cached responses used by list presences endpoint. - * @throws {AppwriteException} - * @returns {Promise<Presence>} - */ - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Presence>; - /** - * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * - * @param {string} presenceId - Presence unique ID. - * @param {string} userId - User ID. - * @param {string} status - Presence status. - * @param {string} expiresAt - Presence expiry datetime. - * @param {object} metadata - Presence metadata object. - * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} purge - When true, purge cached responses used by list presences endpoint. - * @throws {AppwriteException} - * @returns {Promise<Presence>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (object)?, (string[])?, (boolean)?] - ): Promise<Presence> { - let params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; - } else { - params = { - presenceId: paramsOrFirst as string, - userId: rest[0] as string, - status: rest[1] as string, - expiresAt: rest[2] as string, - metadata: rest[3] as object, - permissions: rest[4] as string[], - purge: rest[5] as boolean - }; - } - - const presenceId = params.presenceId; - const userId = params.userId; - const status = params.status; - const expiresAt = params.expiresAt; - const metadata = params.metadata; - const permissions = params.permissions; - const purge = params.purge; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof status !== 'undefined') { - payload['status'] = status; - } - if (typeof expiresAt !== 'undefined') { - payload['expiresAt'] = expiresAt; - } - if (typeof metadata !== 'undefined') { - payload['metadata'] = metadata; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof purge !== 'undefined') { - payload['purge'] = purge; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a presence log by its unique ID. - * - * - * @param {string} params.presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { presenceId: string }): Promise<{}>; - /** - * Delete a presence log by its unique ID. - * - * - * @param {string} presenceId - Presence unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(presenceId: string): Promise<{}>; - delete( - paramsOrFirst: { presenceId: string } | string - ): Promise<{}> { - let params: { presenceId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string }; - } else { - params = { - presenceId: paramsOrFirst as string - }; - } - - const presenceId = params.presenceId; - - if (typeof presenceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "presenceId"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/project.ts b/src/services/project.ts deleted file mode 100644 index 898b6973..00000000 --- a/src/services/project.ts +++ /dev/null @@ -1,6459 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { ProjectAuthMethodId } from '../enums/project-auth-method-id'; -import { ProjectKeyScopes } from '../enums/project-key-scopes'; -import { ProjectOAuth2GooglePrompt } from '../enums/project-o-auth-2-google-prompt'; -import { ProjectOAuthProviderId } from '../enums/project-o-auth-provider-id'; -import { ProjectPolicyId } from '../enums/project-policy-id'; -import { ProjectProtocolId } from '../enums/project-protocol-id'; -import { ProjectServiceId } from '../enums/project-service-id'; -import { ProjectSMTPSecure } from '../enums/project-smtp-secure'; -import { ProjectEmailTemplateId } from '../enums/project-email-template-id'; -import { ProjectEmailTemplateLocale } from '../enums/project-email-template-locale'; - -export class Project { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a project. - * - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - get(): Promise<Models.Project> { - - const apiPath = '/project'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a project. - * - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(): Promise<{}> { - - const apiPath = '/project'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. - * - * @param {ProjectAuthMethodId} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone - * @param {boolean} params.enabled - Auth method status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateAuthMethod(params: { methodId: ProjectAuthMethodId, enabled: boolean }): Promise<Models.Project>; - /** - * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. - * - * @param {ProjectAuthMethodId} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone - * @param {boolean} enabled - Auth method status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAuthMethod(methodId: ProjectAuthMethodId, enabled: boolean): Promise<Models.Project>; - updateAuthMethod( - paramsOrFirst: { methodId: ProjectAuthMethodId, enabled: boolean } | ProjectAuthMethodId, - ...rest: [(boolean)?] - ): Promise<Models.Project> { - let params: { methodId: ProjectAuthMethodId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { methodId: ProjectAuthMethodId, enabled: boolean }; - } else { - params = { - methodId: paramsOrFirst as ProjectAuthMethodId, - enabled: rest[0] as boolean - }; - } - - const methodId = params.methodId; - const enabled = params.enabled; - - if (typeof methodId === 'undefined') { - throw new AppwriteException('Missing required parameter: "methodId"'); - } - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', methodId); - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all API keys from the current project. - * - * @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: expire, accessedAt, name, scopes - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.KeyList>} - */ - listKeys(params?: { queries?: string[], total?: boolean }): Promise<Models.KeyList>; - /** - * Get a list of all API keys from the current project. - * - * @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: expire, accessedAt, name, scopes - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.KeyList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listKeys(queries?: string[], total?: boolean): Promise<Models.KeyList>; - listKeys( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.KeyList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/keys'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create an ephemeral API key if you need a short-lived key instead. - * - * @param {string} params.keyId - Key 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. - * @param {string} params.name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - */ - createKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }): Promise<Models.Key>; - /** - * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create an ephemeral API key if you need a short-lived key instead. - * - * @param {string} keyId - Key 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. - * @param {string} name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createKey(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise<Models.Key>; - createKey( - paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, - ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] - ): Promise<Models.Key> { - let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; - } else { - params = { - keyId: paramsOrFirst as string, - name: rest[0] as string, - scopes: rest[1] as ProjectKeyScopes[], - expire: rest[2] as string - }; - } - - const keyId = params.keyId; - const name = params.name; - const scopes = params.scopes; - const expire = params.expire; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - - const apiPath = '/project/keys'; - const payload: Payload = {}; - if (typeof keyId !== 'undefined') { - payload['keyId'] = keyId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create a standard API key if you need a longer-lived key instead. - * - * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {number} params.duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.EphemeralKey>} - */ - createEphemeralKey(params: { scopes: ProjectKeyScopes[], duration: number }): Promise<Models.EphemeralKey>; - /** - * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. - * - * You can also create a standard API key if you need a longer-lived key instead. - * - * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {number} duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.EphemeralKey>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEphemeralKey(scopes: ProjectKeyScopes[], duration: number): Promise<Models.EphemeralKey>; - createEphemeralKey( - paramsOrFirst: { scopes: ProjectKeyScopes[], duration: number } | ProjectKeyScopes[], - ...rest: [(number)?] - ): Promise<Models.EphemeralKey> { - let params: { scopes: ProjectKeyScopes[], duration: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { scopes: ProjectKeyScopes[], duration: number }; - } else { - params = { - scopes: paramsOrFirst as ProjectKeyScopes[], - duration: rest[0] as number - }; - } - - const scopes = params.scopes; - const duration = params.duration; - - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - if (typeof duration === 'undefined') { - throw new AppwriteException('Missing required parameter: "duration"'); - } - - const apiPath = '/project/keys/ephemeral'; - const payload: Payload = {}; - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a key by its unique ID. - * - * @param {string} params.keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - */ - getKey(params: { keyId: string }): Promise<Models.Key>; - /** - * Get a key by its unique ID. - * - * @param {string} keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getKey(keyId: string): Promise<Models.Key>; - getKey( - paramsOrFirst: { keyId: string } | string - ): Promise<Models.Key> { - let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string }; - } else { - params = { - keyId: paramsOrFirst as string - }; - } - - const keyId = params.keyId; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. - * - * @param {string} params.keyId - Key ID. - * @param {string} params.name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - */ - updateKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }): Promise<Models.Key>; - /** - * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. - * - * @param {string} keyId - Key ID. - * @param {string} name - Key name. Max length: 128 chars. - * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. - * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. - * @throws {AppwriteException} - * @returns {Promise<Models.Key>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateKey(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise<Models.Key>; - updateKey( - paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, - ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] - ): Promise<Models.Key> { - let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; - } else { - params = { - keyId: paramsOrFirst as string, - name: rest[0] as string, - scopes: rest[1] as ProjectKeyScopes[], - expire: rest[2] as string - }; - } - - const keyId = params.keyId; - const name = params.name; - const scopes = params.scopes; - const expire = params.expire; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof scopes === 'undefined') { - throw new AppwriteException('Missing required parameter: "scopes"'); - } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof scopes !== 'undefined') { - payload['scopes'] = scopes; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. - * - * @param {string} params.keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteKey(params: { keyId: string }): Promise<{}>; - /** - * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. - * - * @param {string} keyId - Key ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteKey(keyId: string): Promise<{}>; - deleteKey( - paramsOrFirst: { keyId: string } | string - ): Promise<{}> { - let params: { keyId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyId: string }; - } else { - params = { - keyId: paramsOrFirst as string - }; - } - - const keyId = params.keyId; - - if (typeof keyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "keyId"'); - } - - const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project labels. Labels can be used to easily filter projects in an organization. - * - * @param {string[]} params.labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateLabels(params: { labels: string[] }): Promise<Models.Project>; - /** - * Update the project labels. Labels can be used to easily filter projects in an organization. - * - * @param {string[]} labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLabels(labels: string[]): Promise<Models.Project>; - updateLabels( - paramsOrFirst: { labels: string[] } | string[] - ): Promise<Models.Project> { - let params: { labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { labels: string[] }; - } else { - params = { - labels: paramsOrFirst as string[] - }; - } - - const labels = params.labels; - - if (typeof labels === 'undefined') { - throw new AppwriteException('Missing required parameter: "labels"'); - } - - const apiPath = '/project/labels'; - const payload: Payload = {}; - if (typeof labels !== 'undefined') { - payload['labels'] = labels; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. - * - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumberList>} - */ - listMockPhones(params?: { queries?: string[], total?: boolean }): Promise<Models.MockNumberList>; - /** - * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. - * - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumberList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMockPhones(queries?: string[], total?: boolean): Promise<Models.MockNumberList>; - listMockPhones( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.MockNumberList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/mock-phones'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. - * - * @param {string} params.number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - */ - createMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; - /** - * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. - * - * @param {string} number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMockPhone(number: string, otp: string): Promise<Models.MockNumber>; - createMockPhone( - paramsOrFirst: { number: string, otp: string } | string, - ...rest: [(string)?] - ): Promise<Models.MockNumber> { - let params: { number: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string, otp: string }; - } else { - params = { - number: paramsOrFirst as string, - otp: rest[0] as string - }; - } - - const number = params.number; - const otp = params.otp; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/project/mock-phones'; - const payload: Payload = {}; - if (typeof number !== 'undefined') { - payload['number'] = number; - } - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. - * - * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - */ - getMockPhone(params: { number: string }): Promise<Models.MockNumber>; - /** - * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. - * - * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMockPhone(number: string): Promise<Models.MockNumber>; - getMockPhone( - paramsOrFirst: { number: string } | string - ): Promise<Models.MockNumber> { - let params: { number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string }; - } else { - params = { - number: paramsOrFirst as string - }; - } - - const number = params.number; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. - * - * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - */ - updateMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; - /** - * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. - * - * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. - * @throws {AppwriteException} - * @returns {Promise<Models.MockNumber>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMockPhone(number: string, otp: string): Promise<Models.MockNumber>; - updateMockPhone( - paramsOrFirst: { number: string, otp: string } | string, - ...rest: [(string)?] - ): Promise<Models.MockNumber> { - let params: { number: string, otp: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string, otp: string }; - } else { - params = { - number: paramsOrFirst as string, - otp: rest[0] as string - }; - } - - const number = params.number; - const otp = params.otp; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - if (typeof otp === 'undefined') { - throw new AppwriteException('Missing required parameter: "otp"'); - } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); - const payload: Payload = {}; - if (typeof otp !== 'undefined') { - payload['otp'] = otp; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. - * - * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteMockPhone(params: { number: string }): Promise<{}>; - /** - * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. - * - * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMockPhone(number: string): Promise<{}>; - deleteMockPhone( - paramsOrFirst: { number: string } | string - ): Promise<{}> { - let params: { number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { number: string }; - } else { - params = { - number: paramsOrFirst as string - }; - } - - const number = params.number; - - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - - const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. - * - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2ProviderList>} - */ - listOAuth2Providers(params?: { queries?: string[], total?: boolean }): Promise<Models.OAuth2ProviderList>; - /** - * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. - * - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2ProviderList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listOAuth2Providers(queries?: string[], total?: boolean): Promise<Models.OAuth2ProviderList>; - listOAuth2Providers( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.OAuth2ProviderList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/oauth2'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Amazon configuration. - * - * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Amazon>} - */ - updateOAuth2Amazon(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Amazon>; - /** - * Update the project OAuth2 Amazon configuration. - * - * @param {string} clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Amazon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Amazon(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Amazon>; - updateOAuth2Amazon( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Amazon> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/amazon'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Apple configuration. - * - * @param {string} params.serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web - * @param {string} params.keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 - * @param {string} params.teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 - * @param {string} params.p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Apple>} - */ - updateOAuth2Apple(params?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }): Promise<Models.OAuth2Apple>; - /** - * Update the project OAuth2 Apple configuration. - * - * @param {string} serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web - * @param {string} keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 - * @param {string} teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 - * @param {string} p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Apple>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Apple(serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean): Promise<Models.OAuth2Apple>; - updateOAuth2Apple( - paramsOrFirst?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Apple> { - let params: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; - } else { - params = { - serviceId: paramsOrFirst as string, - keyId: rest[0] as string, - teamId: rest[1] as string, - p8File: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const serviceId = params.serviceId; - const keyId = params.keyId; - const teamId = params.teamId; - const p8File = params.p8File; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/apple'; - const payload: Payload = {}; - if (typeof serviceId !== 'undefined') { - payload['serviceId'] = serviceId; - } - if (typeof keyId !== 'undefined') { - payload['keyId'] = keyId; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof p8File !== 'undefined') { - payload['p8File'] = p8File; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Auth0 configuration. - * - * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF - * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Auth0>} - */ - updateOAuth2Auth0(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Auth0>; - /** - * Update the project OAuth2 Auth0 configuration. - * - * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF - * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Auth0>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Auth0(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Auth0>; - updateOAuth2Auth0( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Auth0> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/auth0'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Authentik configuration. - * - * @param {string} params.clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK - * @param {string} params.endpoint - Domain of Authentik instance. For example: example.authentik.com - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Authentik>} - */ - updateOAuth2Authentik(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Authentik>; - /** - * Update the project OAuth2 Authentik configuration. - * - * @param {string} clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK - * @param {string} endpoint - Domain of Authentik instance. For example: example.authentik.com - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Authentik>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Authentik(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Authentik>; - updateOAuth2Authentik( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Authentik> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/authentik'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Autodesk configuration. - * - * @param {string} params.clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Autodesk>} - */ - updateOAuth2Autodesk(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Autodesk>; - /** - * Update the project OAuth2 Autodesk configuration. - * - * @param {string} clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Autodesk>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Autodesk(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Autodesk>; - updateOAuth2Autodesk( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Autodesk> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/autodesk'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Bitbucket configuration. - * - * @param {string} params.key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitbucket>} - */ - updateOAuth2Bitbucket(params?: { key?: string, secret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitbucket>; - /** - * Update the project OAuth2 Bitbucket configuration. - * - * @param {string} key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitbucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Bitbucket(key?: string, secret?: string, enabled?: boolean): Promise<Models.OAuth2Bitbucket>; - updateOAuth2Bitbucket( - paramsOrFirst?: { key?: string, secret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Bitbucket> { - let params: { key?: string, secret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { key?: string, secret?: string, enabled?: boolean }; - } else { - params = { - key: paramsOrFirst as string, - secret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const key = params.key; - const secret = params.secret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/bitbucket'; - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Bitly configuration. - * - * @param {string} params.clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitly>} - */ - updateOAuth2Bitly(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitly>; - /** - * Update the project OAuth2 Bitly configuration. - * - * @param {string} clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Bitly>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Bitly(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Bitly>; - updateOAuth2Bitly( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Bitly> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/bitly'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Box configuration. - * - * @param {string} params.clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Box>} - */ - updateOAuth2Box(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Box>; - /** - * Update the project OAuth2 Box configuration. - * - * @param {string} clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Box>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Box(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Box>; - updateOAuth2Box( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Box> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/box'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Dailymotion configuration. - * - * @param {string} params.apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dailymotion>} - */ - updateOAuth2Dailymotion(params?: { apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dailymotion>; - /** - * Update the project OAuth2 Dailymotion configuration. - * - * @param {string} apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dailymotion>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Dailymotion(apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dailymotion>; - updateOAuth2Dailymotion( - paramsOrFirst?: { apiKey?: string, apiSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Dailymotion> { - let params: { apiKey?: string, apiSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { apiKey?: string, apiSecret?: string, enabled?: boolean }; - } else { - params = { - apiKey: paramsOrFirst as string, - apiSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const apiKey = params.apiKey; - const apiSecret = params.apiSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/dailymotion'; - const payload: Payload = {}; - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; - } - if (typeof apiSecret !== 'undefined') { - payload['apiSecret'] = apiSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Discord configuration. - * - * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Discord>} - */ - updateOAuth2Discord(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Discord>; - /** - * Update the project OAuth2 Discord configuration. - * - * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Discord>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Discord(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Discord>; - updateOAuth2Discord( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Discord> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/discord'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Disqus configuration. - * - * @param {string} params.publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Disqus>} - */ - updateOAuth2Disqus(params?: { publicKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Disqus>; - /** - * Update the project OAuth2 Disqus configuration. - * - * @param {string} publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Disqus>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Disqus(publicKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Disqus>; - updateOAuth2Disqus( - paramsOrFirst?: { publicKey?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Disqus> { - let params: { publicKey?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { publicKey?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - publicKey: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const publicKey = params.publicKey; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/disqus'; - const payload: Payload = {}; - if (typeof publicKey !== 'undefined') { - payload['publicKey'] = publicKey; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Dropbox configuration. - * - * @param {string} params.appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dropbox>} - */ - updateOAuth2Dropbox(params?: { appKey?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dropbox>; - /** - * Update the project OAuth2 Dropbox configuration. - * - * @param {string} appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Dropbox>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Dropbox(appKey?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dropbox>; - updateOAuth2Dropbox( - paramsOrFirst?: { appKey?: string, appSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Dropbox> { - let params: { appKey?: string, appSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appKey?: string, appSecret?: string, enabled?: boolean }; - } else { - params = { - appKey: paramsOrFirst as string, - appSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const appKey = params.appKey; - const appSecret = params.appSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/dropbox'; - const payload: Payload = {}; - if (typeof appKey !== 'undefined') { - payload['appKey'] = appKey; - } - if (typeof appSecret !== 'undefined') { - payload['appSecret'] = appSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Etsy configuration. - * - * @param {string} params.keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Etsy>} - */ - updateOAuth2Etsy(params?: { keyString?: string, sharedSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Etsy>; - /** - * Update the project OAuth2 Etsy configuration. - * - * @param {string} keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Etsy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Etsy(keyString?: string, sharedSecret?: string, enabled?: boolean): Promise<Models.OAuth2Etsy>; - updateOAuth2Etsy( - paramsOrFirst?: { keyString?: string, sharedSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Etsy> { - let params: { keyString?: string, sharedSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { keyString?: string, sharedSecret?: string, enabled?: boolean }; - } else { - params = { - keyString: paramsOrFirst as string, - sharedSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const keyString = params.keyString; - const sharedSecret = params.sharedSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/etsy'; - const payload: Payload = {}; - if (typeof keyString !== 'undefined') { - payload['keyString'] = keyString; - } - if (typeof sharedSecret !== 'undefined') { - payload['sharedSecret'] = sharedSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Facebook configuration. - * - * @param {string} params.appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Facebook>} - */ - updateOAuth2Facebook(params?: { appId?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Facebook>; - /** - * Update the project OAuth2 Facebook configuration. - * - * @param {string} appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Facebook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Facebook(appId?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Facebook>; - updateOAuth2Facebook( - paramsOrFirst?: { appId?: string, appSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Facebook> { - let params: { appId?: string, appSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId?: string, appSecret?: string, enabled?: boolean }; - } else { - params = { - appId: paramsOrFirst as string, - appSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const appId = params.appId; - const appSecret = params.appSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/facebook'; - const payload: Payload = {}; - if (typeof appId !== 'undefined') { - payload['appId'] = appId; - } - if (typeof appSecret !== 'undefined') { - payload['appSecret'] = appSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Figma configuration. - * - * @param {string} params.clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Figma>} - */ - updateOAuth2Figma(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Figma>; - /** - * Update the project OAuth2 Figma configuration. - * - * @param {string} clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Figma>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Figma(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Figma>; - updateOAuth2Figma( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Figma> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/figma'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 FusionAuth configuration. - * - * @param {string} params.clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc - * @param {string} params.endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2FusionAuth>} - */ - updateOAuth2FusionAuth(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2FusionAuth>; - /** - * Update the project OAuth2 FusionAuth configuration. - * - * @param {string} clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc - * @param {string} endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2FusionAuth>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2FusionAuth(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2FusionAuth>; - updateOAuth2FusionAuth( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2FusionAuth> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/fusionauth'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 GitHub configuration. - * - * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github>} - */ - updateOAuth2GitHub(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Github>; - /** - * Update the project OAuth2 GitHub configuration. - * - * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2GitHub(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Github>; - updateOAuth2GitHub( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Github> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/github'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Gitlab configuration. - * - * @param {string} params.applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 - * @param {string} params.endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Gitlab>} - */ - updateOAuth2Gitlab(params?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Gitlab>; - /** - * Update the project OAuth2 Gitlab configuration. - * - * @param {string} applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 - * @param {string} endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Gitlab>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Gitlab(applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Gitlab>; - updateOAuth2Gitlab( - paramsOrFirst?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Gitlab> { - let params: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; - } else { - params = { - applicationId: paramsOrFirst as string, - secret: rest[0] as string, - endpoint: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const applicationId = params.applicationId; - const secret = params.secret; - const endpoint = params.endpoint; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/gitlab'; - const payload: Payload = {}; - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Google configuration. - * - * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret - * @param {ProjectOAuth2GooglePrompt[]} params.prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Google>} - */ - updateOAuth2Google(params?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }): Promise<Models.OAuth2Google>; - /** - * Update the project OAuth2 Google configuration. - * - * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret - * @param {ProjectOAuth2GooglePrompt[]} prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Google>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Google(clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean): Promise<Models.OAuth2Google>; - updateOAuth2Google( - paramsOrFirst?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean } | string, - ...rest: [(string)?, (ProjectOAuth2GooglePrompt[])?, (boolean)?] - ): Promise<Models.OAuth2Google> { - let params: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - prompt: rest[1] as ProjectOAuth2GooglePrompt[], - enabled: rest[2] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const prompt = params.prompt; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/google'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Keycloak configuration. - * - * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO - * @param {string} params.endpoint - Domain of Keycloak instance. For example: keycloak.example.com - * @param {string} params.realmName - Keycloak realm name. For example: appwrite-realm - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Keycloak>} - */ - updateOAuth2Keycloak(params?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }): Promise<Models.OAuth2Keycloak>; - /** - * Update the project OAuth2 Keycloak configuration. - * - * @param {string} clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO - * @param {string} endpoint - Domain of Keycloak instance. For example: keycloak.example.com - * @param {string} realmName - Keycloak realm name. For example: appwrite-realm - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Keycloak>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Keycloak(clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean): Promise<Models.OAuth2Keycloak>; - updateOAuth2Keycloak( - paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Keycloak> { - let params: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - endpoint: rest[1] as string, - realmName: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const endpoint = params.endpoint; - const realmName = params.realmName; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/keycloak'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof endpoint !== 'undefined') { - payload['endpoint'] = endpoint; - } - if (typeof realmName !== 'undefined') { - payload['realmName'] = realmName; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Kick configuration. - * - * @param {string} params.clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Kick>} - */ - updateOAuth2Kick(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Kick>; - /** - * Update the project OAuth2 Kick configuration. - * - * @param {string} clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Kick>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Kick(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Kick>; - updateOAuth2Kick( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Kick> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/kick'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Linkedin configuration. - * - * @param {string} params.clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Linkedin>} - */ - updateOAuth2Linkedin(params?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Linkedin>; - /** - * Update the project OAuth2 Linkedin configuration. - * - * @param {string} clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Linkedin>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Linkedin(clientId?: string, primaryClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Linkedin>; - updateOAuth2Linkedin( - paramsOrFirst?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Linkedin> { - let params: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - primaryClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const primaryClientSecret = params.primaryClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/linkedin'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof primaryClientSecret !== 'undefined') { - payload['primaryClientSecret'] = primaryClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Microsoft configuration. - * - * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u - * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Microsoft>} - */ - updateOAuth2Microsoft(params?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }): Promise<Models.OAuth2Microsoft>; - /** - * Update the project OAuth2 Microsoft configuration. - * - * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u - * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Microsoft>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Microsoft(applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean): Promise<Models.OAuth2Microsoft>; - updateOAuth2Microsoft( - paramsOrFirst?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Microsoft> { - let params: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; - } else { - params = { - applicationId: paramsOrFirst as string, - applicationSecret: rest[0] as string, - tenant: rest[1] as string, - enabled: rest[2] as boolean - }; - } - - const applicationId = params.applicationId; - const applicationSecret = params.applicationSecret; - const tenant = params.tenant; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/microsoft'; - const payload: Payload = {}; - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - if (typeof applicationSecret !== 'undefined') { - payload['applicationSecret'] = applicationSecret; - } - if (typeof tenant !== 'undefined') { - payload['tenant'] = tenant; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Notion configuration. - * - * @param {string} params.oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Notion>} - */ - updateOAuth2Notion(params?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Notion>; - /** - * Update the project OAuth2 Notion configuration. - * - * @param {string} oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Notion>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Notion(oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Notion>; - updateOAuth2Notion( - paramsOrFirst?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Notion> { - let params: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; - } else { - params = { - oauthClientId: paramsOrFirst as string, - oauthClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const oauthClientId = params.oauthClientId; - const oauthClientSecret = params.oauthClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/notion'; - const payload: Payload = {}; - if (typeof oauthClientId !== 'undefined') { - payload['oauthClientId'] = oauthClientId; - } - if (typeof oauthClientSecret !== 'undefined') { - payload['oauthClientSecret'] = oauthClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Oidc configuration. - * - * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV - * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration - * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} params.tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} params.userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Oidc>} - */ - updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }): Promise<Models.OAuth2Oidc>; - /** - * Update the project OAuth2 Oidc configuration. - * - * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV - * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration - * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize - * @param {string} tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token - * @param {string} userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Oidc>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean): Promise<Models.OAuth2Oidc>; - updateOAuth2Oidc( - paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Oidc> { - let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - wellKnownURL: rest[1] as string, - authorizationURL: rest[2] as string, - tokenURL: rest[3] as string, - userInfoURL: rest[4] as string, - enabled: rest[5] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const wellKnownURL = params.wellKnownURL; - const authorizationURL = params.authorizationURL; - const tokenURL = params.tokenURL; - const userInfoURL = params.userInfoURL; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/oidc'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof wellKnownURL !== 'undefined') { - payload['wellKnownURL'] = wellKnownURL; - } - if (typeof authorizationURL !== 'undefined') { - payload['authorizationURL'] = authorizationURL; - } - if (typeof tokenURL !== 'undefined') { - payload['tokenURL'] = tokenURL; - } - if (typeof userInfoURL !== 'undefined') { - payload['userInfoURL'] = userInfoURL; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Okta configuration. - * - * @param {string} params.clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV - * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ - * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Okta>} - */ - updateOAuth2Okta(params?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }): Promise<Models.OAuth2Okta>; - /** - * Update the project OAuth2 Okta configuration. - * - * @param {string} clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV - * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ - * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Okta>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Okta(clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean): Promise<Models.OAuth2Okta>; - updateOAuth2Okta( - paramsOrFirst?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.OAuth2Okta> { - let params: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - domain: rest[1] as string, - authorizationServerId: rest[2] as string, - enabled: rest[3] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const domain = params.domain; - const authorizationServerId = params.authorizationServerId; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/okta'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof authorizationServerId !== 'undefined') { - payload['authorizationServerId'] = authorizationServerId; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Paypal configuration. - * - * @param {string} params.clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - */ - updateOAuth2Paypal(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; - /** - * Update the project OAuth2 Paypal configuration. - * - * @param {string} clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Paypal(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; - updateOAuth2Paypal( - paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Paypal> { - let params: { clientId?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/paypal'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 PaypalSandbox configuration. - * - * @param {string} params.clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - */ - updateOAuth2PaypalSandbox(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; - /** - * Update the project OAuth2 PaypalSandbox configuration. - * - * @param {string} clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Paypal>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2PaypalSandbox(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; - updateOAuth2PaypalSandbox( - paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Paypal> { - let params: { clientId?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/paypalSandbox'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Podio configuration. - * - * @param {string} params.clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Podio>} - */ - updateOAuth2Podio(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Podio>; - /** - * Update the project OAuth2 Podio configuration. - * - * @param {string} clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Podio>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Podio(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Podio>; - updateOAuth2Podio( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Podio> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/podio'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Salesforce configuration. - * - * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Salesforce>} - */ - updateOAuth2Salesforce(params?: { customerKey?: string, customerSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Salesforce>; - /** - * Update the project OAuth2 Salesforce configuration. - * - * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Salesforce>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Salesforce(customerKey?: string, customerSecret?: string, enabled?: boolean): Promise<Models.OAuth2Salesforce>; - updateOAuth2Salesforce( - paramsOrFirst?: { customerKey?: string, customerSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Salesforce> { - let params: { customerKey?: string, customerSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { customerKey?: string, customerSecret?: string, enabled?: boolean }; - } else { - params = { - customerKey: paramsOrFirst as string, - customerSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const customerKey = params.customerKey; - const customerSecret = params.customerSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/salesforce'; - const payload: Payload = {}; - if (typeof customerKey !== 'undefined') { - payload['customerKey'] = customerKey; - } - if (typeof customerSecret !== 'undefined') { - payload['customerSecret'] = customerSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Slack configuration. - * - * @param {string} params.clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Slack>} - */ - updateOAuth2Slack(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Slack>; - /** - * Update the project OAuth2 Slack configuration. - * - * @param {string} clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Slack>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Slack(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Slack>; - updateOAuth2Slack( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Slack> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/slack'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Spotify configuration. - * - * @param {string} params.clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Spotify>} - */ - updateOAuth2Spotify(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Spotify>; - /** - * Update the project OAuth2 Spotify configuration. - * - * @param {string} clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Spotify>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Spotify(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Spotify>; - updateOAuth2Spotify( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Spotify> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/spotify'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Stripe configuration. - * - * @param {string} params.clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Stripe>} - */ - updateOAuth2Stripe(params?: { clientId?: string, apiSecretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Stripe>; - /** - * Update the project OAuth2 Stripe configuration. - * - * @param {string} clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Stripe>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Stripe(clientId?: string, apiSecretKey?: string, enabled?: boolean): Promise<Models.OAuth2Stripe>; - updateOAuth2Stripe( - paramsOrFirst?: { clientId?: string, apiSecretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Stripe> { - let params: { clientId?: string, apiSecretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, apiSecretKey?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - apiSecretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const apiSecretKey = params.apiSecretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/stripe'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof apiSecretKey !== 'undefined') { - payload['apiSecretKey'] = apiSecretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Tradeshift configuration. - * - * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - */ - updateOAuth2Tradeshift(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; - /** - * Update the project OAuth2 Tradeshift configuration. - * - * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Tradeshift(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; - updateOAuth2Tradeshift( - paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Tradeshift> { - let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - } else { - params = { - oauth2ClientId: paramsOrFirst as string, - oauth2ClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const oauth2ClientId = params.oauth2ClientId; - const oauth2ClientSecret = params.oauth2ClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/tradeshift'; - const payload: Payload = {}; - if (typeof oauth2ClientId !== 'undefined') { - payload['oauth2ClientId'] = oauth2ClientId; - } - if (typeof oauth2ClientSecret !== 'undefined') { - payload['oauth2ClientSecret'] = oauth2ClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Tradeshift Sandbox configuration. - * - * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - */ - updateOAuth2TradeshiftSandbox(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; - /** - * Update the project OAuth2 Tradeshift Sandbox configuration. - * - * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Tradeshift>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2TradeshiftSandbox(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; - updateOAuth2TradeshiftSandbox( - paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Tradeshift> { - let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; - } else { - params = { - oauth2ClientId: paramsOrFirst as string, - oauth2ClientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const oauth2ClientId = params.oauth2ClientId; - const oauth2ClientSecret = params.oauth2ClientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/tradeshiftBox'; - const payload: Payload = {}; - if (typeof oauth2ClientId !== 'undefined') { - payload['oauth2ClientId'] = oauth2ClientId; - } - if (typeof oauth2ClientSecret !== 'undefined') { - payload['oauth2ClientSecret'] = oauth2ClientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Twitch configuration. - * - * @param {string} params.clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Twitch>} - */ - updateOAuth2Twitch(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Twitch>; - /** - * Update the project OAuth2 Twitch configuration. - * - * @param {string} clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Twitch>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Twitch(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Twitch>; - updateOAuth2Twitch( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Twitch> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/twitch'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 WordPress configuration. - * - * @param {string} params.clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2WordPress>} - */ - updateOAuth2WordPress(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2WordPress>; - /** - * Update the project OAuth2 WordPress configuration. - * - * @param {string} clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2WordPress>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2WordPress(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2WordPress>; - updateOAuth2WordPress( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2WordPress> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/wordpress'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 X configuration. - * - * @param {string} params.customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2X>} - */ - updateOAuth2X(params?: { customerKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2X>; - /** - * Update the project OAuth2 X configuration. - * - * @param {string} customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2X>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2X(customerKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2X>; - updateOAuth2X( - paramsOrFirst?: { customerKey?: string, secretKey?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2X> { - let params: { customerKey?: string, secretKey?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { customerKey?: string, secretKey?: string, enabled?: boolean }; - } else { - params = { - customerKey: paramsOrFirst as string, - secretKey: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const customerKey = params.customerKey; - const secretKey = params.secretKey; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/x'; - const payload: Payload = {}; - if (typeof customerKey !== 'undefined') { - payload['customerKey'] = customerKey; - } - if (typeof secretKey !== 'undefined') { - payload['secretKey'] = secretKey; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Yahoo configuration. - * - * @param {string} params.clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yahoo>} - */ - updateOAuth2Yahoo(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yahoo>; - /** - * Update the project OAuth2 Yahoo configuration. - * - * @param {string} clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yahoo>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Yahoo(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yahoo>; - updateOAuth2Yahoo( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Yahoo> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/yahoo'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Yandex configuration. - * - * @param {string} params.clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yandex>} - */ - updateOAuth2Yandex(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yandex>; - /** - * Update the project OAuth2 Yandex configuration. - * - * @param {string} clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Yandex>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Yandex(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yandex>; - updateOAuth2Yandex( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Yandex> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/yandex'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Zoho configuration. - * - * @param {string} params.clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Zoho>} - */ - updateOAuth2Zoho(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoho>; - /** - * Update the project OAuth2 Zoho configuration. - * - * @param {string} clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Zoho>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Zoho(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoho>; - updateOAuth2Zoho( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Zoho> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/zoho'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the project OAuth2 Zoom configuration. - * - * @param {string} params.clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - * @param {string} params.clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON - * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Zoom>} - */ - updateOAuth2Zoom(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoom>; - /** - * Update the project OAuth2 Zoom configuration. - * - * @param {string} clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON - * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Zoom>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateOAuth2Zoom(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoom>; - updateOAuth2Zoom( - paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.OAuth2Zoom> { - let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; - } else { - params = { - clientId: paramsOrFirst as string, - clientSecret: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const clientId = params.clientId; - const clientSecret = params.clientSecret; - const enabled = params.enabled; - - - const apiPath = '/project/oauth2/zoom'; - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['clientId'] = clientId; - } - if (typeof clientSecret !== 'undefined') { - payload['clientSecret'] = clientSecret; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. - * - * @param {ProjectOAuthProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} - */ - getOAuth2Provider(params: { providerId: ProjectOAuthProviderId }): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; - /** - * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. - * - * @param {ProjectOAuthProviderId} providerId - OAuth2 provider key. For example: github, google, apple. - * @throws {AppwriteException} - * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getOAuth2Provider(providerId: ProjectOAuthProviderId): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; - getOAuth2Provider( - paramsOrFirst: { providerId: ProjectOAuthProviderId } | ProjectOAuthProviderId - ): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft> { - let params: { providerId: ProjectOAuthProviderId }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { providerId: ProjectOAuthProviderId }; - } else { - params = { - providerId: paramsOrFirst as ProjectOAuthProviderId - }; - } - - const providerId = params.providerId; - - if (typeof providerId === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerId"'); - } - - const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', providerId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. - * - * @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: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformList>} - */ - listPlatforms(params?: { queries?: string[], total?: boolean }): Promise<Models.PlatformList>; - /** - * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. - * - * @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: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listPlatforms(queries?: string[], total?: boolean): Promise<Models.PlatformList>; - listPlatforms( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.PlatformList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/platforms'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform 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. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - */ - createAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; - /** - * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform 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. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; - createAndroidPlatform( - paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformAndroid> { - let params: { platformId: string, name: string, applicationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - applicationId: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const applicationId = params.applicationId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof applicationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "applicationId"'); - } - - const apiPath = '/project/platforms/android'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - */ - updateAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; - /** - * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} applicationId - Android application ID. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformAndroid>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; - updateAndroidPlatform( - paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformAndroid> { - let params: { platformId: string, name: string, applicationId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - applicationId: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const applicationId = params.applicationId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof applicationId === 'undefined') { - throw new AppwriteException('Missing required parameter: "applicationId"'); - } - - const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof applicationId !== 'undefined') { - payload['applicationId'] = applicationId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform 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. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - */ - createApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; - /** - * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform 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. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; - createApplePlatform( - paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformApple> { - let params: { platformId: string, name: string, bundleIdentifier: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - bundleIdentifier: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const bundleIdentifier = params.bundleIdentifier; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof bundleIdentifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); - } - - const apiPath = '/project/platforms/apple'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof bundleIdentifier !== 'undefined') { - payload['bundleIdentifier'] = bundleIdentifier; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - */ - updateApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; - /** - * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformApple>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; - updateApplePlatform( - paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformApple> { - let params: { platformId: string, name: string, bundleIdentifier: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - bundleIdentifier: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const bundleIdentifier = params.bundleIdentifier; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof bundleIdentifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); - } - - const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof bundleIdentifier !== 'undefined') { - payload['bundleIdentifier'] = bundleIdentifier; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform 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. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - */ - createLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; - /** - * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform 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. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; - createLinuxPlatform( - paramsOrFirst: { platformId: string, name: string, packageName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformLinux> { - let params: { platformId: string, name: string, packageName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageName = params.packageName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageName"'); - } - - const apiPath = '/project/platforms/linux'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageName !== 'undefined') { - payload['packageName'] = packageName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - */ - updateLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; - /** - * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageName - Linux package name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformLinux>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; - updateLinuxPlatform( - paramsOrFirst: { platformId: string, name: string, packageName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformLinux> { - let params: { platformId: string, name: string, packageName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageName = params.packageName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageName"'); - } - - const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageName !== 'undefined') { - payload['packageName'] = packageName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform 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. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - */ - createWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; - /** - * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform 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. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; - createWebPlatform( - paramsOrFirst: { platformId: string, name: string, hostname: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWeb> { - let params: { platformId: string, name: string, hostname: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - hostname: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const hostname = params.hostname; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof hostname === 'undefined') { - throw new AppwriteException('Missing required parameter: "hostname"'); - } - - const apiPath = '/project/platforms/web'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - */ - updateWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; - /** - * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} hostname - Platform web hostname. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; - updateWebPlatform( - paramsOrFirst: { platformId: string, name: string, hostname: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWeb> { - let params: { platformId: string, name: string, hostname: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - hostname: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const hostname = params.hostname; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof hostname === 'undefined') { - throw new AppwriteException('Missing required parameter: "hostname"'); - } - - const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof hostname !== 'undefined') { - payload['hostname'] = hostname; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} params.platformId - Platform 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. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - */ - createWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; - /** - * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. - * - * @param {string} platformId - Platform 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. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; - createWindowsPlatform( - paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWindows> { - let params: { platformId: string, name: string, packageIdentifierName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageIdentifierName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageIdentifierName = params.packageIdentifierName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageIdentifierName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); - } - - const apiPath = '/project/platforms/windows'; - const payload: Payload = {}; - if (typeof platformId !== 'undefined') { - payload['platformId'] = platformId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageIdentifierName !== 'undefined') { - payload['packageIdentifierName'] = packageIdentifierName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. - * - * @param {string} params.platformId - Platform ID. - * @param {string} params.name - Platform name. Max length: 128 chars. - * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - */ - updateWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; - /** - * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. - * - * @param {string} platformId - Platform ID. - * @param {string} name - Platform name. Max length: 128 chars. - * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWindows>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; - updateWindowsPlatform( - paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.PlatformWindows> { - let params: { platformId: string, name: string, packageIdentifierName: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; - } else { - params = { - platformId: paramsOrFirst as string, - name: rest[0] as string, - packageIdentifierName: rest[1] as string - }; - } - - const platformId = params.platformId; - const name = params.name; - const packageIdentifierName = params.packageIdentifierName; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof packageIdentifierName === 'undefined') { - throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); - } - - const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof packageIdentifierName !== 'undefined') { - payload['packageIdentifierName'] = packageIdentifierName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. - * - * @param {string} params.platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} - */ - getPlatform(params: { platformId: string }): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; - /** - * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. - * - * @param {string} platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPlatform(platformId: string): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; - getPlatform( - paramsOrFirst: { platformId: string } | string - ): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux> { - let params: { platformId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string }; - } else { - params = { - platformId: paramsOrFirst as string - }; - } - - const platformId = params.platformId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. - * - * @param {string} params.platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deletePlatform(params: { platformId: string }): Promise<{}>; - /** - * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. - * - * @param {string} platformId - Platform ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deletePlatform(platformId: string): Promise<{}>; - deletePlatform( - paramsOrFirst: { platformId: string } | string - ): Promise<{}> { - let params: { platformId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { platformId: string }; - } else { - params = { - platformId: paramsOrFirst as string - }; - } - - const platformId = params.platformId; - - if (typeof platformId === 'undefined') { - throw new AppwriteException('Missing required parameter: "platformId"'); - } - - const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all project policies and their current configuration. - * - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyList>} - */ - listPolicies(params?: { queries?: string[], total?: boolean }): Promise<Models.PolicyList>; - /** - * Get a list of all project policies and their current configuration. - * - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listPolicies(queries?: string[], total?: boolean): Promise<Models.PolicyList>; - listPolicies( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.PolicyList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/policies'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. - * - * @param {boolean} params.enabled - Set whether or not to block aliased emails during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateDenyAliasedEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. - * - * @param {boolean} enabled - Set whether or not to block aliased emails during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDenyAliasedEmailPolicy(enabled: boolean): Promise<Models.Project>; - updateDenyAliasedEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean }; - } else { - params = { - enabled: paramsOrFirst as boolean - }; - } - - const enabled = params.enabled; - - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/policies/deny-aliased-email'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. - * - * @param {boolean} params.enabled - Set whether or not to block disposable email addresses during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateDenyDisposableEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. - * - * @param {boolean} enabled - Set whether or not to block disposable email addresses during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDenyDisposableEmailPolicy(enabled: boolean): Promise<Models.Project>; - updateDenyDisposableEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean }; - } else { - params = { - enabled: paramsOrFirst as boolean - }; - } - - const enabled = params.enabled; - - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/policies/deny-disposable-email'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. - * - * @param {boolean} params.enabled - Set whether or not to block free email addresses during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateDenyFreeEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. - * - * @param {boolean} enabled - Set whether or not to block free email addresses during signup and email updates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDenyFreeEmailPolicy(enabled: boolean): Promise<Models.Project>; - updateDenyFreeEmailPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean }; - } else { - params = { - enabled: paramsOrFirst as boolean - }; - } - - const enabled = params.enabled; - - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/policies/deny-free-email'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Updating this policy allows you to control if team members can see other members information. When enabled, all team members can see ID, name, email, phone number, and MFA status of other members.. - * - * @param {boolean} params.userId - Set to true if you want make user ID visible to all team members, or false to hide it. - * @param {boolean} params.userEmail - Set to true if you want make user email visible to all team members, or false to hide it. - * @param {boolean} params.userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. - * @param {boolean} params.userName - Set to true if you want make user name visible to all team members, or false to hide it. - * @param {boolean} params.userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateMembershipPrivacyPolicy(params?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if team members can see other members information. When enabled, all team members can see ID, name, email, phone number, and MFA status of other members.. - * - * @param {boolean} userId - Set to true if you want make user ID visible to all team members, or false to hide it. - * @param {boolean} userEmail - Set to true if you want make user email visible to all team members, or false to hide it. - * @param {boolean} userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. - * @param {boolean} userName - Set to true if you want make user name visible to all team members, or false to hide it. - * @param {boolean} userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMembershipPrivacyPolicy(userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean): Promise<Models.Project>; - updateMembershipPrivacyPolicy( - paramsOrFirst?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean } | boolean, - ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Project> { - let params: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; - } else { - params = { - userId: paramsOrFirst as boolean, - userEmail: rest[0] as boolean, - userPhone: rest[1] as boolean, - userName: rest[2] as boolean, - userMFA: rest[3] as boolean - }; - } - - const userId = params.userId; - const userEmail = params.userEmail; - const userPhone = params.userPhone; - const userName = params.userName; - const userMFA = params.userMFA; - - - const apiPath = '/project/policies/membership-privacy'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof userEmail !== 'undefined') { - payload['userEmail'] = userEmail; - } - if (typeof userPhone !== 'undefined') { - payload['userPhone'] = userPhone; - } - if (typeof userName !== 'undefined') { - payload['userName'] = userName; - } - if (typeof userMFA !== 'undefined') { - payload['userMFA'] = userMFA; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. - * - * @param {boolean} params.enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updatePasswordDictionaryPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. - * - * @param {boolean} enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePasswordDictionaryPolicy(enabled: boolean): Promise<Models.Project>; - updatePasswordDictionaryPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean }; - } else { - params = { - enabled: paramsOrFirst as boolean - }; - } - - const enabled = params.enabled; - - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/policies/password-dictionary'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. - * - * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. - * - * @param {number} params.total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updatePasswordHistoryPolicy(params: { total?: number }): Promise<Models.Project>; - /** - * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. - * - * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. - * - * @param {number} total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePasswordHistoryPolicy(total?: number): Promise<Models.Project>; - updatePasswordHistoryPolicy( - paramsOrFirst?: { total?: number } | number - ): Promise<Models.Project> { - let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { total?: number }; - } else { - params = { - total: paramsOrFirst as number - }; - } - - const total = params.total; - - if (typeof total === 'undefined') { - throw new AppwriteException('Missing required parameter: "total"'); - } - - const apiPath = '/project/policies/password-history'; - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. - * - * @param {boolean} params.enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updatePasswordPersonalDataPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. - * - * @param {boolean} enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePasswordPersonalDataPolicy(enabled: boolean): Promise<Models.Project>; - updatePasswordPersonalDataPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean }; - } else { - params = { - enabled: paramsOrFirst as boolean - }; - } - - const enabled = params.enabled; - - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/policies/password-personal-data'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. - * - * @param {boolean} params.enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionAlertPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. - * - * @param {boolean} enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionAlertPolicy(enabled: boolean): Promise<Models.Project>; - updateSessionAlertPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean }; - } else { - params = { - enabled: paramsOrFirst as boolean - }; - } - - const enabled = params.enabled; - - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/policies/session-alert'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update maximum duration how long sessions created within a project should stay active for. - * - * @param {number} params.duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionDurationPolicy(params: { duration: number }): Promise<Models.Project>; - /** - * Update maximum duration how long sessions created within a project should stay active for. - * - * @param {number} duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionDurationPolicy(duration: number): Promise<Models.Project>; - updateSessionDurationPolicy( - paramsOrFirst: { duration: number } | number - ): Promise<Models.Project> { - let params: { duration: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { duration: number }; - } else { - params = { - duration: paramsOrFirst as number - }; - } - - const duration = params.duration; - - if (typeof duration === 'undefined') { - throw new AppwriteException('Missing required parameter: "duration"'); - } - - const apiPath = '/project/policies/session-duration'; - const payload: Payload = {}; - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. - * - * @param {boolean} params.enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionInvalidationPolicy(params: { enabled: boolean }): Promise<Models.Project>; - /** - * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. - * - * @param {boolean} enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionInvalidationPolicy(enabled: boolean): Promise<Models.Project>; - updateSessionInvalidationPolicy( - paramsOrFirst: { enabled: boolean } | boolean - ): Promise<Models.Project> { - let params: { enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { enabled: boolean }; - } else { - params = { - enabled: paramsOrFirst as boolean - }; - } - - const enabled = params.enabled; - - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/policies/session-invalidation'; - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. - * - * @param {number} params.total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSessionLimitPolicy(params: { total?: number }): Promise<Models.Project>; - /** - * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. - * - * @param {number} total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSessionLimitPolicy(total?: number): Promise<Models.Project>; - updateSessionLimitPolicy( - paramsOrFirst?: { total?: number } | number - ): Promise<Models.Project> { - let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { total?: number }; - } else { - params = { - total: paramsOrFirst as number - }; - } - - const total = params.total; - - if (typeof total === 'undefined') { - throw new AppwriteException('Missing required parameter: "total"'); - } - - const apiPath = '/project/policies/session-limit'; - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. - * - * @param {number} params.total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateUserLimitPolicy(params: { total?: number }): Promise<Models.Project>; - /** - * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. - * - * @param {number} total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateUserLimitPolicy(total?: number): Promise<Models.Project>; - updateUserLimitPolicy( - paramsOrFirst?: { total?: number } | number - ): Promise<Models.Project> { - let params: { total?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { total?: number }; - } else { - params = { - total: paramsOrFirst as number - }; - } - - const total = params.total; - - if (typeof total === 'undefined') { - throw new AppwriteException('Missing required parameter: "total"'); - } - - const apiPath = '/project/policies/user-limit'; - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. - * - * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} - */ - getPolicy(params: { policyId: ProjectPolicyId }): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; - /** - * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. - * - * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. - * @throws {AppwriteException} - * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPolicy(policyId: ProjectPolicyId): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; - getPolicy( - paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId - ): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy> { - let params: { policyId: ProjectPolicyId }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { policyId: ProjectPolicyId }; - } else { - params = { - policyId: paramsOrFirst as ProjectPolicyId - }; - } - - const policyId = params.policyId; - - if (typeof policyId === 'undefined') { - throw new AppwriteException('Missing required parameter: "policyId"'); - } - - const apiPath = '/project/policies/{policyId}'.replace('{policyId}', policyId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. - * - * @param {ProjectProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket - * @param {boolean} params.enabled - Protocol status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateProtocol(params: { protocolId: ProjectProtocolId, enabled: boolean }): Promise<Models.Project>; - /** - * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. - * - * @param {ProjectProtocolId} protocolId - Protocol name. Can be one of: rest, graphql, websocket - * @param {boolean} enabled - Protocol status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateProtocol(protocolId: ProjectProtocolId, enabled: boolean): Promise<Models.Project>; - updateProtocol( - paramsOrFirst: { protocolId: ProjectProtocolId, enabled: boolean } | ProjectProtocolId, - ...rest: [(boolean)?] - ): Promise<Models.Project> { - let params: { protocolId: ProjectProtocolId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { protocolId: ProjectProtocolId, enabled: boolean }; - } else { - params = { - protocolId: paramsOrFirst as ProjectProtocolId, - enabled: rest[0] as boolean - }; - } - - const protocolId = params.protocolId; - const enabled = params.enabled; - - if (typeof protocolId === 'undefined') { - throw new AppwriteException('Missing required parameter: "protocolId"'); - } - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/protocols/{protocolId}'.replace('{protocolId}', protocolId); - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. - * - * @param {ProjectServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor - * @param {boolean} params.enabled - Service status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateService(params: { serviceId: ProjectServiceId, enabled: boolean }): Promise<Models.Project>; - /** - * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. - * - * @param {ProjectServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor - * @param {boolean} enabled - Service status. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateService(serviceId: ProjectServiceId, enabled: boolean): Promise<Models.Project>; - updateService( - paramsOrFirst: { serviceId: ProjectServiceId, enabled: boolean } | ProjectServiceId, - ...rest: [(boolean)?] - ): Promise<Models.Project> { - let params: { serviceId: ProjectServiceId, enabled: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { serviceId: ProjectServiceId, enabled: boolean }; - } else { - params = { - serviceId: paramsOrFirst as ProjectServiceId, - enabled: rest[0] as boolean - }; - } - - const serviceId = params.serviceId; - const enabled = params.enabled; - - if (typeof serviceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "serviceId"'); - } - if (typeof enabled === 'undefined') { - throw new AppwriteException('Missing required parameter: "enabled"'); - } - - const apiPath = '/project/services/{serviceId}'.replace('{serviceId}', serviceId); - const payload: Payload = {}; - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. - * - * @param {string} params.host - SMTP server hostname (domain) - * @param {number} params.port - SMTP server port - * @param {string} params.username - SMTP server username. Leave empty for no authorization. - * @param {string} params.password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). - * @param {string} params.senderEmail - Email address shown in inbox as the sender of the email. - * @param {string} params.senderName - Name shown in inbox as the sender of the email. - * @param {string} params.replyToEmail - Email used when user replies to the email. - * @param {string} params.replyToName - Name used when user replies to the email. - * @param {ProjectSMTPSecure} params.secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. - * @param {boolean} params.enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - */ - updateSMTP(params?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }): Promise<Models.Project>; - /** - * Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. - * - * @param {string} host - SMTP server hostname (domain) - * @param {number} port - SMTP server port - * @param {string} username - SMTP server username. Leave empty for no authorization. - * @param {string} password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). - * @param {string} senderEmail - Email address shown in inbox as the sender of the email. - * @param {string} senderName - Name shown in inbox as the sender of the email. - * @param {string} replyToEmail - Email used when user replies to the email. - * @param {string} replyToName - Name used when user replies to the email. - * @param {ProjectSMTPSecure} secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. - * @param {boolean} enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. - * @throws {AppwriteException} - * @returns {Promise<Models.Project>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSMTP(host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean): Promise<Models.Project>; - updateSMTP( - paramsOrFirst?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean } | string, - ...rest: [(number)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (ProjectSMTPSecure)?, (boolean)?] - ): Promise<Models.Project> { - let params: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; - } else { - params = { - host: paramsOrFirst as string, - port: rest[0] as number, - username: rest[1] as string, - password: rest[2] as string, - senderEmail: rest[3] as string, - senderName: rest[4] as string, - replyToEmail: rest[5] as string, - replyToName: rest[6] as string, - secure: rest[7] as ProjectSMTPSecure, - enabled: rest[8] as boolean - }; - } - - const host = params.host; - const port = params.port; - const username = params.username; - const password = params.password; - const senderEmail = params.senderEmail; - const senderName = params.senderName; - const replyToEmail = params.replyToEmail; - const replyToName = params.replyToName; - const secure = params.secure; - const enabled = params.enabled; - - - const apiPath = '/project/smtp'; - const payload: Payload = {}; - if (typeof host !== 'undefined') { - payload['host'] = host; - } - if (typeof port !== 'undefined') { - payload['port'] = port; - } - if (typeof username !== 'undefined') { - payload['username'] = username; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof senderEmail !== 'undefined') { - payload['senderEmail'] = senderEmail; - } - if (typeof senderName !== 'undefined') { - payload['senderName'] = senderName; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - if (typeof secure !== 'undefined') { - payload['secure'] = secure; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Send a test email to verify SMTP configuration. - * - * @param {string[]} params.emails - Array of emails to send test email to. Maximum of 10 emails are allowed. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - createSMTPTest(params: { emails: string[] }): Promise<{}>; - /** - * Send a test email to verify SMTP configuration. - * - * @param {string[]} emails - Array of emails to send test email to. Maximum of 10 emails are allowed. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSMTPTest(emails: string[]): Promise<{}>; - createSMTPTest( - paramsOrFirst: { emails: string[] } | string[] - ): Promise<{}> { - let params: { emails: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { emails: string[] }; - } else { - params = { - emails: paramsOrFirst as string[] - }; - } - - const emails = params.emails; - - if (typeof emails === 'undefined') { - throw new AppwriteException('Missing required parameter: "emails"'); - } - - const apiPath = '/project/smtp/tests'; - const payload: Payload = {}; - if (typeof emails !== 'undefined') { - payload['emails'] = emails; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. - * - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplateList>} - */ - listEmailTemplates(params?: { queries?: string[], total?: boolean }): Promise<Models.EmailTemplateList>; - /** - * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. - * - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplateList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listEmailTemplates(queries?: string[], total?: boolean): Promise<Models.EmailTemplateList>; - listEmailTemplates( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.EmailTemplateList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/templates/email'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. - * - * @param {ProjectEmailTemplateId} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {ProjectEmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. - * @param {string} params.subject - Subject of the email template. Can be up to 255 characters. - * @param {string} params.message - Plain or HTML body of the email template message. Can be up to 10MB of content. - * @param {string} params.senderName - Name of the email sender. - * @param {string} params.senderEmail - Email of the sender. - * @param {string} params.replyToEmail - Reply to email. - * @param {string} params.replyToName - Reply to name. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - */ - updateEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }): Promise<Models.EmailTemplate>; - /** - * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. - * - * @param {ProjectEmailTemplateId} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {ProjectEmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. - * @param {string} subject - Subject of the email template. Can be up to 255 characters. - * @param {string} message - Plain or HTML body of the email template message. Can be up to 10MB of content. - * @param {string} senderName - Name of the email sender. - * @param {string} senderEmail - Email of the sender. - * @param {string} replyToEmail - Reply to email. - * @param {string} replyToName - Reply to name. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string): Promise<Models.EmailTemplate>; - updateEmailTemplate( - paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string } | ProjectEmailTemplateId, - ...rest: [(ProjectEmailTemplateLocale)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.EmailTemplate> { - let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst || 'subject' in paramsOrFirst || 'message' in paramsOrFirst || 'senderName' in paramsOrFirst || 'senderEmail' in paramsOrFirst || 'replyToEmail' in paramsOrFirst || 'replyToName' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; - } else { - params = { - templateId: paramsOrFirst as ProjectEmailTemplateId, - locale: rest[0] as ProjectEmailTemplateLocale, - subject: rest[1] as string, - message: rest[2] as string, - senderName: rest[3] as string, - senderEmail: rest[4] as string, - replyToEmail: rest[5] as string, - replyToName: rest[6] as string - }; - } - - const templateId = params.templateId; - const locale = params.locale; - const subject = params.subject; - const message = params.message; - const senderName = params.senderName; - const senderEmail = params.senderEmail; - const replyToEmail = params.replyToEmail; - const replyToName = params.replyToName; - - if (typeof templateId === 'undefined') { - throw new AppwriteException('Missing required parameter: "templateId"'); - } - - const apiPath = '/project/templates/email'; - const payload: Payload = {}; - if (typeof templateId !== 'undefined') { - payload['templateId'] = templateId; - } - if (typeof locale !== 'undefined') { - payload['locale'] = locale; - } - if (typeof subject !== 'undefined') { - payload['subject'] = subject; - } - if (typeof message !== 'undefined') { - payload['message'] = message; - } - if (typeof senderName !== 'undefined') { - payload['senderName'] = senderName; - } - if (typeof senderEmail !== 'undefined') { - payload['senderEmail'] = senderEmail; - } - if (typeof replyToEmail !== 'undefined') { - payload['replyToEmail'] = replyToEmail; - } - if (typeof replyToName !== 'undefined') { - payload['replyToName'] = replyToName; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. - * - * @param {ProjectEmailTemplateId} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {ProjectEmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - */ - getEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }): Promise<Models.EmailTemplate>; - /** - * Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. - * - * @param {ProjectEmailTemplateId} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession - * @param {ProjectEmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. - * @throws {AppwriteException} - * @returns {Promise<Models.EmailTemplate>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale): Promise<Models.EmailTemplate>; - getEmailTemplate( - paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale } | ProjectEmailTemplateId, - ...rest: [(ProjectEmailTemplateLocale)?] - ): Promise<Models.EmailTemplate> { - let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; - } else { - params = { - templateId: paramsOrFirst as ProjectEmailTemplateId, - locale: rest[0] as ProjectEmailTemplateLocale - }; - } - - const templateId = params.templateId; - const locale = params.locale; - - if (typeof templateId === 'undefined') { - throw new AppwriteException('Missing required parameter: "templateId"'); - } - - const apiPath = '/project/templates/email/{templateId}'.replace('{templateId}', templateId); - const payload: Payload = {}; - if (typeof locale !== 'undefined') { - payload['locale'] = locale; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all project environment variables. - * - * @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: key, resourceType, resourceId, secret - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - */ - listVariables(params?: { queries?: string[], total?: boolean }): Promise<Models.VariableList>; - /** - * Get a list of all project environment variables. - * - * @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: key, resourceType, resourceId, secret - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listVariables(queries?: string[], total?: boolean): Promise<Models.VariableList>; - listVariables( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.VariableList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/project/variables'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. - * - * @param {string} params.variableId - Variable 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. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - createVariable(params: { variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. - * - * @param {string} variableId - Variable 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. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVariable(variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; - createVariable( - paramsOrFirst: { variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { variableId: string, key: string, value: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string, key: string, value: string, secret?: boolean }; - } else { - params = { - variableId: paramsOrFirst as string, - key: rest[0] as string, - value: rest[1] as string, - secret: rest[2] as boolean - }; - } - - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof value === 'undefined') { - throw new AppwriteException('Missing required parameter: "value"'); - } - - const apiPath = '/project/variables'; - const payload: Payload = {}; - if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a variable by its unique ID. - * - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - getVariable(params: { variableId: string }): Promise<Models.Variable>; - /** - * Get a variable by its unique ID. - * - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getVariable(variableId: string): Promise<Models.Variable>; - getVariable( - paramsOrFirst: { variableId: string } | string - ): Promise<Models.Variable> { - let params: { variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string }; - } else { - params = { - variableId: paramsOrFirst as string - }; - } - - const variableId = params.variableId; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update variable by its unique ID. - * - * @param {string} params.variableId - Variable unique ID. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - updateVariable(params: { variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Update variable by its unique ID. - * - * @param {string} variableId - Variable unique ID. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVariable(variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; - updateVariable( - paramsOrFirst: { variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { variableId: string, key?: string, value?: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string, key?: string, value?: string, secret?: boolean }; - } else { - params = { - variableId: paramsOrFirst as string, - key: rest[0] as string, - value: rest[1] as string, - secret: rest[2] as boolean - }; - } - - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a variable by its unique ID. - * - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteVariable(params: { variableId: string }): Promise<{}>; - /** - * Delete a variable by its unique ID. - * - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteVariable(variableId: string): Promise<{}>; - deleteVariable( - paramsOrFirst: { variableId: string } | string - ): Promise<{}> { - let params: { variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { variableId: string }; - } else { - params = { - variableId: paramsOrFirst as string - }; - } - - const variableId = params.variableId; - - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/proxy.ts b/src/services/proxy.ts deleted file mode 100644 index 83e4ecc8..00000000 --- a/src/services/proxy.ts +++ /dev/null @@ -1,541 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { StatusCode } from '../enums/status-code'; -import { ProxyResourceType } from '../enums/proxy-resource-type'; - -export class Proxy { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all the proxy rules. You can use the query params to filter your results. - * - * @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: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRuleList>} - */ - listRules(params?: { queries?: string[], total?: boolean }): Promise<Models.ProxyRuleList>; - /** - * Get a list of all the proxy rules. You can use the query params to filter your results. - * - * @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: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRuleList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listRules(queries?: string[], total?: boolean): Promise<Models.ProxyRuleList>; - listRules( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.ProxyRuleList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/proxy/rules'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new proxy rule for serving Appwrite's API on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createAPIRule(params: { domain: string }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for serving Appwrite's API on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createAPIRule(domain: string): Promise<Models.ProxyRule>; - createAPIRule( - paramsOrFirst: { domain: string } | string - ): Promise<Models.ProxyRule> { - let params: { domain: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string }; - } else { - params = { - domain: paramsOrFirst as string - }; - } - - const domain = params.domain; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - - const apiPath = '/proxy/rules/api'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new proxy rule for executing Appwrite Function on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @param {string} params.functionId - ID of function to be executed. - * @param {string} params.branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createFunctionRule(params: { domain: string, functionId: string, branch?: string }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for executing Appwrite Function on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @param {string} functionId - ID of function to be executed. - * @param {string} branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFunctionRule(domain: string, functionId: string, branch?: string): Promise<Models.ProxyRule>; - createFunctionRule( - paramsOrFirst: { domain: string, functionId: string, branch?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ProxyRule> { - let params: { domain: string, functionId: string, branch?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, functionId: string, branch?: string }; - } else { - params = { - domain: paramsOrFirst as string, - functionId: rest[0] as string, - branch: rest[1] as string - }; - } - - const domain = params.domain; - const functionId = params.functionId; - const branch = params.branch; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - if (typeof functionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "functionId"'); - } - - const apiPath = '/proxy/rules/function'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof functionId !== 'undefined') { - payload['functionId'] = functionId; - } - if (typeof branch !== 'undefined') { - payload['branch'] = branch; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new proxy rule for to redirect from custom domain to another domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @param {string} params.url - Target URL of redirection - * @param {StatusCode} params.statusCode - Status code of redirection - * @param {string} params.resourceId - ID of parent resource. - * @param {ProxyResourceType} params.resourceType - Type of parent resource. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createRedirectRule(params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for to redirect from custom domain to another domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @param {string} url - Target URL of redirection - * @param {StatusCode} statusCode - Status code of redirection - * @param {string} resourceId - ID of parent resource. - * @param {ProxyResourceType} resourceType - Type of parent resource. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRedirectRule(domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType): Promise<Models.ProxyRule>; - createRedirectRule( - paramsOrFirst: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType } | string, - ...rest: [(string)?, (StatusCode)?, (string)?, (ProxyResourceType)?] - ): Promise<Models.ProxyRule> { - let params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; - } else { - params = { - domain: paramsOrFirst as string, - url: rest[0] as string, - statusCode: rest[1] as StatusCode, - resourceId: rest[2] as string, - resourceType: rest[3] as ProxyResourceType - }; - } - - const domain = params.domain; - const url = params.url; - const statusCode = params.statusCode; - const resourceId = params.resourceId; - const resourceType = params.resourceType; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof statusCode === 'undefined') { - throw new AppwriteException('Missing required parameter: "statusCode"'); - } - if (typeof resourceId === 'undefined') { - throw new AppwriteException('Missing required parameter: "resourceId"'); - } - if (typeof resourceType === 'undefined') { - throw new AppwriteException('Missing required parameter: "resourceType"'); - } - - const apiPath = '/proxy/rules/redirect'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof statusCode !== 'undefined') { - payload['statusCode'] = statusCode; - } - if (typeof resourceId !== 'undefined') { - payload['resourceId'] = resourceId; - } - if (typeof resourceType !== 'undefined') { - payload['resourceType'] = resourceType; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new proxy rule for serving Appwrite Site on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} params.domain - Domain name. - * @param {string} params.siteId - ID of site to be executed. - * @param {string} params.branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - createSiteRule(params: { domain: string, siteId: string, branch?: string }): Promise<Models.ProxyRule>; - /** - * Create a new proxy rule for serving Appwrite Site on custom domain. - * - * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. - * - * @param {string} domain - Domain name. - * @param {string} siteId - ID of site to be executed. - * @param {string} branch - Name of VCS branch to deploy changes automatically - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSiteRule(domain: string, siteId: string, branch?: string): Promise<Models.ProxyRule>; - createSiteRule( - paramsOrFirst: { domain: string, siteId: string, branch?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ProxyRule> { - let params: { domain: string, siteId: string, branch?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { domain: string, siteId: string, branch?: string }; - } else { - params = { - domain: paramsOrFirst as string, - siteId: rest[0] as string, - branch: rest[1] as string - }; - } - - const domain = params.domain; - const siteId = params.siteId; - const branch = params.branch; - - if (typeof domain === 'undefined') { - throw new AppwriteException('Missing required parameter: "domain"'); - } - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/proxy/rules/site'; - const payload: Payload = {}; - if (typeof domain !== 'undefined') { - payload['domain'] = domain; - } - if (typeof siteId !== 'undefined') { - payload['siteId'] = siteId; - } - if (typeof branch !== 'undefined') { - payload['branch'] = branch; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a proxy rule by its unique ID. - * - * @param {string} params.ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - getRule(params: { ruleId: string }): Promise<Models.ProxyRule>; - /** - * Get a proxy rule by its unique ID. - * - * @param {string} ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getRule(ruleId: string): Promise<Models.ProxyRule>; - getRule( - paramsOrFirst: { ruleId: string } | string - ): Promise<Models.ProxyRule> { - let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ruleId: string }; - } else { - params = { - ruleId: paramsOrFirst as string - }; - } - - const ruleId = params.ruleId; - - if (typeof ruleId === 'undefined') { - throw new AppwriteException('Missing required parameter: "ruleId"'); - } - - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a proxy rule by its unique ID. - * - * @param {string} params.ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteRule(params: { ruleId: string }): Promise<{}>; - /** - * Delete a proxy rule by its unique ID. - * - * @param {string} ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteRule(ruleId: string): Promise<{}>; - deleteRule( - paramsOrFirst: { ruleId: string } | string - ): Promise<{}> { - let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ruleId: string }; - } else { - params = { - ruleId: paramsOrFirst as string - }; - } - - const ruleId = params.ruleId; - - if (typeof ruleId === 'undefined') { - throw new AppwriteException('Missing required parameter: "ruleId"'); - } - - const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. - * - * @param {string} params.ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - */ - updateRuleStatus(params: { ruleId: string }): Promise<Models.ProxyRule>; - /** - * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. - * - * @param {string} ruleId - Rule ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ProxyRule>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRuleStatus(ruleId: string): Promise<Models.ProxyRule>; - updateRuleStatus( - paramsOrFirst: { ruleId: string } | string - ): Promise<Models.ProxyRule> { - let params: { ruleId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ruleId: string }; - } else { - params = { - ruleId: paramsOrFirst as string - }; - } - - const ruleId = params.ruleId; - - if (typeof ruleId === 'undefined') { - throw new AppwriteException('Missing required parameter: "ruleId"'); - } - - const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', ruleId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/sites.ts b/src/services/sites.ts deleted file mode 100644 index a45f6478..00000000 --- a/src/services/sites.ts +++ /dev/null @@ -1,1917 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - -import { InputFile } from '../inputFile'; - -import { Framework } from '../enums/framework'; -import { BuildRuntime } from '../enums/build-runtime'; -import { Adapter } from '../enums/adapter'; -import { TemplateReferenceType } from '../enums/template-reference-type'; -import { VCSReferenceType } from '../enums/vcs-reference-type'; -import { DeploymentDownloadType } from '../enums/deployment-download-type'; - -export class Sites { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all the project's sites. You can use the query params to filter your results. - * - * @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: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SiteList>} - */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.SiteList>; - /** - * Get a list of all the project's sites. You can use the query params to filter your results. - * - * @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: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SiteList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.SiteList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.SiteList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/sites'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new site. - * - * @param {string} params.siteId - Site 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. - * @param {string} params.name - Site name. Max length: 128 chars. - * @param {Framework} params.framework - Sites framework. - * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. - * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} params.timeout - Maximum request time in seconds. - * @param {string} params.installCommand - Install Command. - * @param {string} params.buildCommand - Build Command. - * @param {string} params.startCommand - Custom start command. Leave empty to use default. - * @param {string} params.outputDirectory - Output Directory for site. - * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} params.fallbackFile - Fallback file for single page application sites. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} params.providerBranch - Production branch for the repo linked to the site. - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to site code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the site deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; - /** - * Create a new site. - * - * @param {string} siteId - Site 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. - * @param {string} name - Site name. Max length: 128 chars. - * @param {Framework} framework - Sites framework. - * @param {BuildRuntime} buildRuntime - Runtime to use during build step. - * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} timeout - Maximum request time in seconds. - * @param {string} installCommand - Install Command. - * @param {string} buildCommand - Build Command. - * @param {string} startCommand - Custom start command. Leave empty to use default. - * @param {string} outputDirectory - Output Directory for site. - * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} fallbackFile - Fallback file for single page application sites. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} providerBranch - Production branch for the repo linked to the site. - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to site code in the linked repo. - * @param {string} buildSpecification - Build specification for the site deployments. - * @param {string} runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; - create( - paramsOrFirst: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Site> { - let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - siteId: paramsOrFirst as string, - name: rest[0] as string, - framework: rest[1] as Framework, - buildRuntime: rest[2] as BuildRuntime, - enabled: rest[3] as boolean, - logging: rest[4] as boolean, - timeout: rest[5] as number, - installCommand: rest[6] as string, - buildCommand: rest[7] as string, - startCommand: rest[8] as string, - outputDirectory: rest[9] as string, - adapter: rest[10] as Adapter, - installationId: rest[11] as string, - fallbackFile: rest[12] as string, - providerRepositoryId: rest[13] as string, - providerBranch: rest[14] as string, - providerSilentMode: rest[15] as boolean, - providerRootDirectory: rest[16] as string, - buildSpecification: rest[17] as string, - runtimeSpecification: rest[18] as string, - deploymentRetention: rest[19] as number - }; - } - - const siteId = params.siteId; - const name = params.name; - const framework = params.framework; - const buildRuntime = params.buildRuntime; - const enabled = params.enabled; - const logging = params.logging; - const timeout = params.timeout; - const installCommand = params.installCommand; - const buildCommand = params.buildCommand; - const startCommand = params.startCommand; - const outputDirectory = params.outputDirectory; - const adapter = params.adapter; - const installationId = params.installationId; - const fallbackFile = params.fallbackFile; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof framework === 'undefined') { - throw new AppwriteException('Missing required parameter: "framework"'); - } - if (typeof buildRuntime === 'undefined') { - throw new AppwriteException('Missing required parameter: "buildRuntime"'); - } - - const apiPath = '/sites'; - const payload: Payload = {}; - if (typeof siteId !== 'undefined') { - payload['siteId'] = siteId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof framework !== 'undefined') { - payload['framework'] = framework; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; - } - if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; - } - if (typeof startCommand !== 'undefined') { - payload['startCommand'] = startCommand; - } - if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; - } - if (typeof buildRuntime !== 'undefined') { - payload['buildRuntime'] = buildRuntime; - } - if (typeof adapter !== 'undefined') { - payload['adapter'] = adapter; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof fallbackFile !== 'undefined') { - payload['fallbackFile'] = fallbackFile; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all frameworks that are currently available on the server instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.FrameworkList>} - */ - listFrameworks(): Promise<Models.FrameworkList> { - - const apiPath = '/sites/frameworks'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List allowed site specifications for this instance. - * - * @throws {AppwriteException} - * @returns {Promise<Models.SpecificationList>} - */ - listSpecifications(): Promise<Models.SpecificationList> { - - const apiPath = '/sites/specifications'; - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a site by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - get(params: { siteId: string }): Promise<Models.Site>; - /** - * Get a site by its unique ID. - * - * @param {string} siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(siteId: string): Promise<Models.Site>; - get( - paramsOrFirst: { siteId: string } | string - ): Promise<Models.Site> { - let params: { siteId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string }; - } else { - params = { - siteId: paramsOrFirst as string - }; - } - - const siteId = params.siteId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update site by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.name - Site name. Max length: 128 chars. - * @param {Framework} params.framework - Sites framework. - * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} params.timeout - Maximum request time in seconds. - * @param {string} params.installCommand - Install Command. - * @param {string} params.buildCommand - Build Command. - * @param {string} params.startCommand - Custom start command. Leave empty to use default. - * @param {string} params.outputDirectory - Output Directory for site. - * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. - * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} params.fallbackFile - Fallback file for single page application sites. - * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} params.providerBranch - Production branch for the repo linked to the site. - * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} params.providerRootDirectory - Path to site code in the linked repo. - * @param {string} params.buildSpecification - Build specification for the site deployments. - * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; - /** - * Update site by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} name - Site name. Max length: 128 chars. - * @param {Framework} framework - Sites framework. - * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. - * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. - * @param {number} timeout - Maximum request time in seconds. - * @param {string} installCommand - Install Command. - * @param {string} buildCommand - Build Command. - * @param {string} startCommand - Custom start command. Leave empty to use default. - * @param {string} outputDirectory - Output Directory for site. - * @param {BuildRuntime} buildRuntime - Runtime to use during build step. - * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr - * @param {string} fallbackFile - Fallback file for single page application sites. - * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. - * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. - * @param {string} providerBranch - Production branch for the repo linked to the site. - * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. - * @param {string} providerRootDirectory - Path to site code in the linked repo. - * @param {string} buildSpecification - Build specification for the site deployments. - * @param {string} runtimeSpecification - Runtime specification for the SSR executions. - * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; - update( - paramsOrFirst: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] - ): Promise<Models.Site> { - let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; - } else { - params = { - siteId: paramsOrFirst as string, - name: rest[0] as string, - framework: rest[1] as Framework, - enabled: rest[2] as boolean, - logging: rest[3] as boolean, - timeout: rest[4] as number, - installCommand: rest[5] as string, - buildCommand: rest[6] as string, - startCommand: rest[7] as string, - outputDirectory: rest[8] as string, - buildRuntime: rest[9] as BuildRuntime, - adapter: rest[10] as Adapter, - fallbackFile: rest[11] as string, - installationId: rest[12] as string, - providerRepositoryId: rest[13] as string, - providerBranch: rest[14] as string, - providerSilentMode: rest[15] as boolean, - providerRootDirectory: rest[16] as string, - buildSpecification: rest[17] as string, - runtimeSpecification: rest[18] as string, - deploymentRetention: rest[19] as number - }; - } - - const siteId = params.siteId; - const name = params.name; - const framework = params.framework; - const enabled = params.enabled; - const logging = params.logging; - const timeout = params.timeout; - const installCommand = params.installCommand; - const buildCommand = params.buildCommand; - const startCommand = params.startCommand; - const outputDirectory = params.outputDirectory; - const buildRuntime = params.buildRuntime; - const adapter = params.adapter; - const fallbackFile = params.fallbackFile; - const installationId = params.installationId; - const providerRepositoryId = params.providerRepositoryId; - const providerBranch = params.providerBranch; - const providerSilentMode = params.providerSilentMode; - const providerRootDirectory = params.providerRootDirectory; - const buildSpecification = params.buildSpecification; - const runtimeSpecification = params.runtimeSpecification; - const deploymentRetention = params.deploymentRetention; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof framework === 'undefined') { - throw new AppwriteException('Missing required parameter: "framework"'); - } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof framework !== 'undefined') { - payload['framework'] = framework; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof logging !== 'undefined') { - payload['logging'] = logging; - } - if (typeof timeout !== 'undefined') { - payload['timeout'] = timeout; - } - if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; - } - if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; - } - if (typeof startCommand !== 'undefined') { - payload['startCommand'] = startCommand; - } - if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; - } - if (typeof buildRuntime !== 'undefined') { - payload['buildRuntime'] = buildRuntime; - } - if (typeof adapter !== 'undefined') { - payload['adapter'] = adapter; - } - if (typeof fallbackFile !== 'undefined') { - payload['fallbackFile'] = fallbackFile; - } - if (typeof installationId !== 'undefined') { - payload['installationId'] = installationId; - } - if (typeof providerRepositoryId !== 'undefined') { - payload['providerRepositoryId'] = providerRepositoryId; - } - if (typeof providerBranch !== 'undefined') { - payload['providerBranch'] = providerBranch; - } - if (typeof providerSilentMode !== 'undefined') { - payload['providerSilentMode'] = providerSilentMode; - } - if (typeof providerRootDirectory !== 'undefined') { - payload['providerRootDirectory'] = providerRootDirectory; - } - if (typeof buildSpecification !== 'undefined') { - payload['buildSpecification'] = buildSpecification; - } - if (typeof runtimeSpecification !== 'undefined') { - payload['runtimeSpecification'] = runtimeSpecification; - } - if (typeof deploymentRetention !== 'undefined') { - payload['deploymentRetention'] = deploymentRetention; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a site by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { siteId: string }): Promise<{}>; - /** - * Delete a site by its unique ID. - * - * @param {string} siteId - Site ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(siteId: string): Promise<{}>; - delete( - paramsOrFirst: { siteId: string } | string - ): Promise<{}> { - let params: { siteId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string }; - } else { - params = { - siteId: paramsOrFirst as string - }; - } - - const siteId = params.siteId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - */ - updateSiteDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Site>; - /** - * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Site>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSiteDeployment(siteId: string, deploymentId: string): Promise<Models.Site>; - updateSiteDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Site> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all the site's code deployments. You can use the query params to filter your results. - * - * @param {string} params.siteId - Site ID. - * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - */ - listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; - /** - * Get a list of all the site's code deployments. You can use the query params to filter your results. - * - * @param {string} siteId - Site ID. - * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DeploymentList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; - listDeployments( - paramsOrFirst: { siteId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.DeploymentList> { - let params: { siteId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const siteId = params.siteId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. - * - * @param {string} params.siteId - Site ID. - * @param {File | InputFile} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {string} params.installCommand - Install Commands. - * @param {string} params.buildCommand - Build Commands. - * @param {string} params.outputDirectory - Output Directory. - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDeployment(params: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; - /** - * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. - * - * @param {string} siteId - Site ID. - * @param {File | InputFile} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. - * @param {string} installCommand - Install Commands. - * @param {string} buildCommand - Build Commands. - * @param {string} outputDirectory - Output Directory. - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDeployment(siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; - createDeployment( - paramsOrFirst: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File | InputFile)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; - let onProgress: ((progress: UploadProgress) => void); - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); - } else { - params = { - siteId: paramsOrFirst as string, - code: rest[0] as File | InputFile, - installCommand: rest[1] as string, - buildCommand: rest[2] as string, - outputDirectory: rest[3] as string, - activate: rest[4] as boolean - }; - onProgress = rest[5] as ((progress: UploadProgress) => void); - } - - const siteId = params.siteId; - const code = params.code; - const installCommand = params.installCommand; - const buildCommand = params.buildCommand; - const outputDirectory = params.outputDirectory; - const activate = params.activate; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof code === 'undefined') { - throw new AppwriteException('Missing required parameter: "code"'); - } - - const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof installCommand !== 'undefined') { - payload['installCommand'] = installCommand; - } - if (typeof buildCommand !== 'undefined') { - payload['buildCommand'] = buildCommand; - } - if (typeof outputDirectory !== 'undefined') { - payload['outputDirectory'] = outputDirectory; - } - if (typeof code !== 'undefined') { - payload['code'] = code; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'multipart/form-data', - } - - return this.client.chunkedUpload( - 'post', - uri, - apiHeaders, - payload, - onProgress - ); - } - - /** - * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createDuplicateDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDuplicateDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; - createDuplicateDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof deploymentId !== 'undefined') { - payload['deploymentId'] = deploymentId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.repository - Repository name of the template. - * @param {string} params.owner - The name of the owner of the template. - * @param {string} params.rootDirectory - Path to site code in the template repo. - * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createTemplateDeployment(params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment based on a template. - * - * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. - * - * @param {string} siteId - Site ID. - * @param {string} repository - Repository name of the template. - * @param {string} owner - The name of the owner of the template. - * @param {string} rootDirectory - Path to site code in the template repo. - * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag - * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTemplateDeployment(siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createTemplateDeployment( - paramsOrFirst: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - repository: rest[0] as string, - owner: rest[1] as string, - rootDirectory: rest[2] as string, - type: rest[3] as TemplateReferenceType, - reference: rest[4] as string, - activate: rest[5] as boolean - }; - } - - const siteId = params.siteId; - const repository = params.repository; - const owner = params.owner; - const rootDirectory = params.rootDirectory; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof repository === 'undefined') { - throw new AppwriteException('Missing required parameter: "repository"'); - } - if (typeof owner === 'undefined') { - throw new AppwriteException('Missing required parameter: "owner"'); - } - if (typeof rootDirectory === 'undefined') { - throw new AppwriteException('Missing required parameter: "rootDirectory"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof repository !== 'undefined') { - payload['repository'] = repository; - } - if (typeof owner !== 'undefined') { - payload['owner'] = owner; - } - if (typeof rootDirectory !== 'undefined') { - payload['rootDirectory'] = rootDirectory; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a deployment when a site is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} params.siteId - Site ID. - * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit - * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - createVcsDeployment(params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; - /** - * Create a deployment when a site is connected to VCS. - * - * This endpoint lets you create deployment from a branch, commit, or a tag. - * - * @param {string} siteId - Site ID. - * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit - * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash - * @param {boolean} activate - Automatically activate the deployment when it is finished building. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVcsDeployment(siteId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; - createVcsDeployment( - paramsOrFirst: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, - ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - type: rest[0] as VCSReferenceType, - reference: rest[1] as string, - activate: rest[2] as boolean - }; - } - - const siteId = params.siteId; - const type = params.type; - const reference = params.reference; - const activate = params.activate; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof reference === 'undefined') { - throw new AppwriteException('Missing required parameter: "reference"'); - } - - const apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof reference !== 'undefined') { - payload['reference'] = reference; - } - if (typeof activate !== 'undefined') { - payload['activate'] = activate; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a site deployment by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - getDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Get a site deployment by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; - getDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a site deployment by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteDeployment(params: { siteId: string, deploymentId: string }): Promise<{}>; - /** - * Delete a site deployment by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteDeployment(siteId: string, deploymentId: string): Promise<{}>; - deleteDeployment( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise<ArrayBuffer>; - /** - * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>; - getDeploymentDownload( - paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType } | string, - ...rest: [(string)?, (DeploymentDownloadType)?] - ): Promise<ArrayBuffer> { - let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string, - type: rest[1] as DeploymentDownloadType - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - const type = params.type; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - if (typeof type !== 'undefined') { - payload['type'] = type; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - */ - updateDeploymentStatus(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; - /** - * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. - * - * @param {string} siteId - Site ID. - * @param {string} deploymentId - Deployment ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Deployment>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDeploymentStatus(siteId: string, deploymentId: string): Promise<Models.Deployment>; - updateDeploymentStatus( - paramsOrFirst: { siteId: string, deploymentId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, deploymentId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - deploymentId: rest[0] as string - }; - } - - const siteId = params.siteId; - const deploymentId = params.deploymentId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof deploymentId === 'undefined') { - throw new AppwriteException('Missing required parameter: "deploymentId"'); - } - - const apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all site logs. You can use the query params to filter your results. - * - * @param {string} params.siteId - Site ID. - * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - */ - listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; - /** - * Get a list of all site logs. You can use the query params to filter your results. - * - * @param {string} siteId - Site ID. - * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listLogs(siteId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; - listLogs( - paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.ExecutionList> { - let params: { siteId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const siteId = params.siteId; - const queries = params.queries; - const total = params.total; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}/logs'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a site request log by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - */ - getLog(params: { siteId: string, logId: string }): Promise<Models.Execution>; - /** - * Get a site request log by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getLog(siteId: string, logId: string): Promise<Models.Execution>; - getLog( - paramsOrFirst: { siteId: string, logId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Execution> { - let params: { siteId: string, logId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, logId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - logId: rest[0] as string - }; - } - - const siteId = params.siteId; - const logId = params.logId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof logId === 'undefined') { - throw new AppwriteException('Missing required parameter: "logId"'); - } - - const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a site log by its unique ID. - * - * @param {string} params.siteId - Site ID. - * @param {string} params.logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteLog(params: { siteId: string, logId: string }): Promise<{}>; - /** - * Delete a site log by its unique ID. - * - * @param {string} siteId - Site ID. - * @param {string} logId - Log ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteLog(siteId: string, logId: string): Promise<{}>; - deleteLog( - paramsOrFirst: { siteId: string, logId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { siteId: string, logId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, logId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - logId: rest[0] as string - }; - } - - const siteId = params.siteId; - const logId = params.logId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof logId === 'undefined') { - throw new AppwriteException('Missing required parameter: "logId"'); - } - - const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all variables of a specific site. - * - * @param {string} params.siteId - Site unique ID. - * @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: key, resourceType, resourceId, secret - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - */ - listVariables(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; - /** - * Get a list of all variables of a specific site. - * - * @param {string} siteId - Site unique ID. - * @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: key, resourceType, resourceId, secret - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.VariableList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listVariables(siteId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; - listVariables( - paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.VariableList> { - let params: { siteId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const siteId = params.siteId; - const queries = params.queries; - const total = params.total; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - - const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable 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. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - createVariable(params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable 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. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVariable(siteId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; - createVariable( - paramsOrFirst: { siteId: string, variableId: string, key: string, value: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof value === 'undefined') { - throw new AppwriteException('Missing required parameter: "value"'); - } - - const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); - const payload: Payload = {}; - if (typeof variableId !== 'undefined') { - payload['variableId'] = variableId; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a variable by its unique ID. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - getVariable(params: { siteId: string, variableId: string }): Promise<Models.Variable>; - /** - * Get a variable by its unique ID. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getVariable(siteId: string, variableId: string): Promise<Models.Variable>; - getVariable( - paramsOrFirst: { siteId: string, variableId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Variable> { - let params: { siteId: string, variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update variable by its unique ID. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable unique ID. - * @param {string} params.key - Variable key. Max length: 255 chars. - * @param {string} params.value - Variable value. Max length: 8192 chars. - * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - */ - updateVariable(params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; - /** - * Update variable by its unique ID. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable unique ID. - * @param {string} key - Variable key. Max length: 255 chars. - * @param {string} value - Variable value. Max length: 8192 chars. - * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. - * @throws {AppwriteException} - * @returns {Promise<Models.Variable>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVariable(siteId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; - updateVariable( - paramsOrFirst: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, - ...rest: [(string)?, (string)?, (string)?, (boolean)?] - ): Promise<Models.Variable> { - let params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string, - key: rest[1] as string, - value: rest[2] as string, - secret: rest[3] as boolean - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - const key = params.key; - const value = params.value; - const secret = params.secret; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a variable by its unique ID. - * - * @param {string} params.siteId - Site unique ID. - * @param {string} params.variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteVariable(params: { siteId: string, variableId: string }): Promise<{}>; - /** - * Delete a variable by its unique ID. - * - * @param {string} siteId - Site unique ID. - * @param {string} variableId - Variable unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteVariable(siteId: string, variableId: string): Promise<{}>; - deleteVariable( - paramsOrFirst: { siteId: string, variableId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { siteId: string, variableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; - } else { - params = { - siteId: paramsOrFirst as string, - variableId: rest[0] as string - }; - } - - const siteId = params.siteId; - const variableId = params.variableId; - - if (typeof siteId === 'undefined') { - throw new AppwriteException('Missing required parameter: "siteId"'); - } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - - const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/storage.ts b/src/services/storage.ts deleted file mode 100644 index f38792b7..00000000 --- a/src/services/storage.ts +++ /dev/null @@ -1,1082 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - -import { InputFile } from '../inputFile'; - -import { Compression } from '../enums/compression'; -import { ImageGravity } from '../enums/image-gravity'; -import { ImageFormat } from '../enums/image-format'; - -export class Storage { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all the storage buckets. You can use the query params to filter your results. - * - * @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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.BucketList>} - */ - listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.BucketList>; - /** - * Get a list of all the storage buckets. You can use the query params to filter your results. - * - * @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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.BucketList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>; - listBuckets( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.BucketList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/storage/buckets'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new storage bucket. - * - * @param {string} params.bucketId - 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. - * @param {string} params.name - Bucket name - * @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} params.transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - */ - createBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; - /** - * Create a new storage bucket. - * - * @param {string} bucketId - 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. - * @param {string} name - Bucket name - * @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; - createBucket( - paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Bucket> { - let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - } else { - params = { - bucketId: paramsOrFirst as string, - name: rest[0] as string, - permissions: rest[1] as string[], - fileSecurity: rest[2] as boolean, - enabled: rest[3] as boolean, - maximumFileSize: rest[4] as number, - allowedFileExtensions: rest[5] as string[], - compression: rest[6] as Compression, - encryption: rest[7] as boolean, - antivirus: rest[8] as boolean, - transformations: rest[9] as boolean - }; - } - - const bucketId = params.bucketId; - const name = params.name; - const permissions = params.permissions; - const fileSecurity = params.fileSecurity; - const enabled = params.enabled; - const maximumFileSize = params.maximumFileSize; - const allowedFileExtensions = params.allowedFileExtensions; - const compression = params.compression; - const encryption = params.encryption; - const antivirus = params.antivirus; - const transformations = params.transformations; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/storage/buckets'; - const payload: Payload = {}; - if (typeof bucketId !== 'undefined') { - payload['bucketId'] = bucketId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof fileSecurity !== 'undefined') { - payload['fileSecurity'] = fileSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; - } - if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; - } - if (typeof compression !== 'undefined') { - payload['compression'] = compression; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; - } - if (typeof transformations !== 'undefined') { - payload['transformations'] = transformations; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. - * - * @param {string} params.bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - */ - getBucket(params: { bucketId: string }): Promise<Models.Bucket>; - /** - * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. - * - * @param {string} bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getBucket(bucketId: string): Promise<Models.Bucket>; - getBucket( - paramsOrFirst: { bucketId: string } | string - ): Promise<Models.Bucket> { - let params: { bucketId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string }; - } else { - params = { - bucketId: paramsOrFirst as string - }; - } - - const bucketId = params.bucketId; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a storage bucket by its unique ID. - * - * @param {string} params.bucketId - Bucket unique ID. - * @param {string} params.name - Bucket name - * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} params.transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - */ - updateBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; - /** - * Update a storage bucket by its unique ID. - * - * @param {string} bucketId - Bucket unique ID. - * @param {string} name - Bucket name - * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. - * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. - * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. - * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled - * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled - * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled - * @param {boolean} transformations - Are image transformations enabled? - * @throws {AppwriteException} - * @returns {Promise<Models.Bucket>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; - updateBucket( - paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Bucket> { - let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; - } else { - params = { - bucketId: paramsOrFirst as string, - name: rest[0] as string, - permissions: rest[1] as string[], - fileSecurity: rest[2] as boolean, - enabled: rest[3] as boolean, - maximumFileSize: rest[4] as number, - allowedFileExtensions: rest[5] as string[], - compression: rest[6] as Compression, - encryption: rest[7] as boolean, - antivirus: rest[8] as boolean, - transformations: rest[9] as boolean - }; - } - - const bucketId = params.bucketId; - const name = params.name; - const permissions = params.permissions; - const fileSecurity = params.fileSecurity; - const enabled = params.enabled; - const maximumFileSize = params.maximumFileSize; - const allowedFileExtensions = params.allowedFileExtensions; - const compression = params.compression; - const encryption = params.encryption; - const antivirus = params.antivirus; - const transformations = params.transformations; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof fileSecurity !== 'undefined') { - payload['fileSecurity'] = fileSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof maximumFileSize !== 'undefined') { - payload['maximumFileSize'] = maximumFileSize; - } - if (typeof allowedFileExtensions !== 'undefined') { - payload['allowedFileExtensions'] = allowedFileExtensions; - } - if (typeof compression !== 'undefined') { - payload['compression'] = compression; - } - if (typeof encryption !== 'undefined') { - payload['encryption'] = encryption; - } - if (typeof antivirus !== 'undefined') { - payload['antivirus'] = antivirus; - } - if (typeof transformations !== 'undefined') { - payload['transformations'] = transformations; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a storage bucket by its unique ID. - * - * @param {string} params.bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteBucket(params: { bucketId: string }): Promise<{}>; - /** - * Delete a storage bucket by its unique ID. - * - * @param {string} bucketId - Bucket unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteBucket(bucketId: string): Promise<{}>; - deleteBucket( - paramsOrFirst: { bucketId: string } | string - ): Promise<{}> { - let params: { bucketId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string }; - } else { - params = { - bucketId: paramsOrFirst as string - }; - } - - const bucketId = params.bucketId; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - - const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all the user files. You can use the query params to filter your results. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @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: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.FileList>} - */ - listFiles(params: { bucketId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.FileList>; - /** - * Get a list of all the user files. You can use the query params to filter your results. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @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: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.FileList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.FileList>; - listFiles( - paramsOrFirst: { bucketId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.FileList> { - let params: { bucketId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - bucketId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const bucketId = params.bucketId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. - * - * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. - * - * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. - * - * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - * - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File 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. - * @param {File | InputFile} params.file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). - * @param {string[]} params.permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @throws {AppwriteException} - * @returns {Promise<Models.File>} - */ - createFile(params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void }): Promise<Models.File>; - /** - * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. - * - * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. - * - * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. - * - * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. - * - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File 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. - * @param {File | InputFile} file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). - * @param {string[]} permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @throws {AppwriteException} - * @returns {Promise<Models.File>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFile(bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>; - createFile( - paramsOrFirst: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(string)?, (File | InputFile)?, (string[])?,((progress: UploadProgress) => void)?] - ): Promise<Models.File> { - let params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[] }; - let onProgress: ((progress: UploadProgress) => void); - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[] }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - file: rest[1] as File | InputFile, - permissions: rest[2] as string[] - }; - onProgress = rest[3] as ((progress: UploadProgress) => void); - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const file = params.file; - const permissions = params.permissions; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - if (typeof file === 'undefined') { - throw new AppwriteException('Missing required parameter: "file"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); - const payload: Payload = {}; - if (typeof fileId !== 'undefined') { - payload['fileId'] = fileId; - } - if (typeof file !== 'undefined') { - payload['file'] = file; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'multipart/form-data', - } - - return this.client.chunkedUpload( - 'post', - uri, - apiHeaders, - payload, - onProgress - ); - } - - /** - * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File ID. - * @throws {AppwriteException} - * @returns {Promise<Models.File>} - */ - getFile(params: { bucketId: string, fileId: string }): Promise<Models.File>; - /** - * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File ID. - * @throws {AppwriteException} - * @returns {Promise<Models.File>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFile(bucketId: string, fileId: string): Promise<Models.File>; - getFile( - paramsOrFirst: { bucketId: string, fileId: string } | string, - ...rest: [(string)?] - ): Promise<Models.File> { - let params: { bucketId: string, fileId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a file by its unique ID. Only users with write permissions have access to update this resource. - * - * @param {string} params.bucketId - Bucket unique ID. - * @param {string} params.fileId - File ID. - * @param {string} params.name - File name. - * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @throws {AppwriteException} - * @returns {Promise<Models.File>} - */ - updateFile(params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }): Promise<Models.File>; - /** - * Update a file by its unique ID. Only users with write permissions have access to update this resource. - * - * @param {string} bucketId - Bucket unique ID. - * @param {string} fileId - File ID. - * @param {string} name - File name. - * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @throws {AppwriteException} - * @returns {Promise<Models.File>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>; - updateFile( - paramsOrFirst: { bucketId: string, fileId: string, name?: string, permissions?: string[] } | string, - ...rest: [(string)?, (string)?, (string[])?] - ): Promise<Models.File> { - let params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, name?: string, permissions?: string[] }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[] - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const name = params.name; - const permissions = params.permissions; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteFile(params: { bucketId: string, fileId: string }): Promise<{}>; - /** - * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteFile(bucketId: string, fileId: string): Promise<{}>; - deleteFile( - paramsOrFirst: { bucketId: string, fileId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { bucketId: string, fileId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} params.bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File ID. - * @param {string} params.token - File token for accessing this file. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getFileDownload(params: { bucketId: string, fileId: string, token?: string }): Promise<ArrayBuffer>; - /** - * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. - * - * @param {string} bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File ID. - * @param {string} token - File token for accessing this file. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFileDownload(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>; - getFileDownload( - paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<ArrayBuffer> { - let params: { bucketId: string, fileId: string, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - token: rest[1] as string - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const token = params.token; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof token !== 'undefined') { - payload['token'] = token; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File ID - * @param {number} params.width - Resize preview image width, Pass an integer between 0 to 4000. - * @param {number} params.height - Resize preview image height, Pass an integer between 0 to 4000. - * @param {ImageGravity} params.gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right - * @param {number} params.quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @param {number} params.borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. - * @param {string} params.borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix. - * @param {number} params.borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000. - * @param {number} params.opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. - * @param {number} params.rotation - Preview image rotation in degrees. Pass an integer between -360 and 360. - * @param {string} params.background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. - * @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp). - * @param {string} params.token - File token for accessing this file. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getFilePreview(params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }): Promise<ArrayBuffer>; - /** - * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File ID - * @param {number} width - Resize preview image width, Pass an integer between 0 to 4000. - * @param {number} height - Resize preview image height, Pass an integer between 0 to 4000. - * @param {ImageGravity} gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right - * @param {number} quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. - * @param {number} borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. - * @param {string} borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix. - * @param {number} borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000. - * @param {number} opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. - * @param {number} rotation - Preview image rotation in degrees. Pass an integer between -360 and 360. - * @param {string} background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. - * @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp). - * @param {string} token - File token for accessing this file. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): Promise<ArrayBuffer>; - getFilePreview( - paramsOrFirst: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string } | string, - ...rest: [(string)?, (number)?, (number)?, (ImageGravity)?, (number)?, (number)?, (string)?, (number)?, (number)?, (number)?, (string)?, (ImageFormat)?, (string)?] - ): Promise<ArrayBuffer> { - let params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - width: rest[1] as number, - height: rest[2] as number, - gravity: rest[3] as ImageGravity, - quality: rest[4] as number, - borderWidth: rest[5] as number, - borderColor: rest[6] as string, - borderRadius: rest[7] as number, - opacity: rest[8] as number, - rotation: rest[9] as number, - background: rest[10] as string, - output: rest[11] as ImageFormat, - token: rest[12] as string - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const width = params.width; - const height = params.height; - const gravity = params.gravity; - const quality = params.quality; - const borderWidth = params.borderWidth; - const borderColor = params.borderColor; - const borderRadius = params.borderRadius; - const opacity = params.opacity; - const rotation = params.rotation; - const background = params.background; - const output = params.output; - const token = params.token; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof width !== 'undefined') { - payload['width'] = width; - } - if (typeof height !== 'undefined') { - payload['height'] = height; - } - if (typeof gravity !== 'undefined') { - payload['gravity'] = gravity; - } - if (typeof quality !== 'undefined') { - payload['quality'] = quality; - } - if (typeof borderWidth !== 'undefined') { - payload['borderWidth'] = borderWidth; - } - if (typeof borderColor !== 'undefined') { - payload['borderColor'] = borderColor; - } - if (typeof borderRadius !== 'undefined') { - payload['borderRadius'] = borderRadius; - } - if (typeof opacity !== 'undefined') { - payload['opacity'] = opacity; - } - if (typeof rotation !== 'undefined') { - payload['rotation'] = rotation; - } - if (typeof background !== 'undefined') { - payload['background'] = background; - } - if (typeof output !== 'undefined') { - payload['output'] = output; - } - if (typeof token !== 'undefined') { - payload['token'] = token; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } - - /** - * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File ID. - * @param {string} params.token - File token for accessing this file. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - */ - getFileView(params: { bucketId: string, fileId: string, token?: string }): Promise<ArrayBuffer>; - /** - * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File ID. - * @param {string} token - File token for accessing this file. - * @throws {AppwriteException} - * @returns {Promise<ArrayBuffer>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getFileView(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>; - getFileView( - paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<ArrayBuffer> { - let params: { bucketId: string, fileId: string, token?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - token: rest[1] as string - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const token = params.token; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof token !== 'undefined') { - payload['token'] = token; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - 'arrayBuffer' - ); - } -} diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts deleted file mode 100644 index 40766d5e..00000000 --- a/src/services/tables-db.ts +++ /dev/null @@ -1,6167 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { RelationshipType } from '../enums/relationship-type'; -import { RelationMutate } from '../enums/relation-mutate'; -import { TablesDBIndexType } from '../enums/tables-db-index-type'; -import { OrderBy } from '../enums/order-by'; - -export class TablesDB { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. - * - * @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 columns: name - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - */ - list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; - /** - * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. - * - * @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 columns: name - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.DatabaseList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; - list( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.DatabaseList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/tablesdb'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Database. - * - * - * @param {string} params.databaseId - 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. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - */ - create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Create a new Database. - * - * - * @param {string} databaseId - 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. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; - create( - paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/tablesdb'; - const payload: Payload = {}; - if (typeof databaseId !== 'undefined') { - payload['databaseId'] = databaseId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * List transactions across all databases. - * - * @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). - * @throws {AppwriteException} - * @returns {Promise<Models.TransactionList>} - */ - listTransactions(params?: { queries?: string[] }): Promise<Models.TransactionList>; - /** - * List transactions across all databases. - * - * @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). - * @throws {AppwriteException} - * @returns {Promise<Models.TransactionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTransactions(queries?: string[]): Promise<Models.TransactionList>; - listTransactions( - paramsOrFirst?: { queries?: string[] } | string[] - ): Promise<Models.TransactionList> { - let params: { queries?: string[] }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[] }; - } else { - params = { - queries: paramsOrFirst as string[] - }; - } - - const queries = params.queries; - - - const apiPath = '/tablesdb/transactions'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new transaction. - * - * @param {number} params.ttl - Seconds before the transaction expires. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - createTransaction(params?: { ttl?: number }): Promise<Models.Transaction>; - /** - * Create a new transaction. - * - * @param {number} ttl - Seconds before the transaction expires. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTransaction(ttl?: number): Promise<Models.Transaction>; - createTransaction( - paramsOrFirst?: { ttl?: number } | number - ): Promise<Models.Transaction> { - let params: { ttl?: number }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { ttl?: number }; - } else { - params = { - ttl: paramsOrFirst as number - }; - } - - const ttl = params.ttl; - - - const apiPath = '/tablesdb/transactions'; - const payload: Payload = {}; - if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a transaction by its unique ID. - * - * @param {string} params.transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - getTransaction(params: { transactionId: string }): Promise<Models.Transaction>; - /** - * Get a transaction by its unique ID. - * - * @param {string} transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTransaction(transactionId: string): Promise<Models.Transaction>; - getTransaction( - paramsOrFirst: { transactionId: string } | string - ): Promise<Models.Transaction> { - let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string }; - } else { - params = { - transactionId: paramsOrFirst as string - }; - } - - const transactionId = params.transactionId; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a transaction, to either commit or roll back its operations. - * - * @param {string} params.transactionId - Transaction ID. - * @param {boolean} params.commit - Commit transaction? - * @param {boolean} params.rollback - Rollback transaction? - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise<Models.Transaction>; - /** - * Update a transaction, to either commit or roll back its operations. - * - * @param {string} transactionId - Transaction ID. - * @param {boolean} commit - Commit transaction? - * @param {boolean} rollback - Rollback transaction? - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>; - updateTransaction( - paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, - ...rest: [(boolean)?, (boolean)?] - ): Promise<Models.Transaction> { - let params: { transactionId: string, commit?: boolean, rollback?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean }; - } else { - params = { - transactionId: paramsOrFirst as string, - commit: rest[0] as boolean, - rollback: rest[1] as boolean - }; - } - - const transactionId = params.transactionId; - const commit = params.commit; - const rollback = params.rollback; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - if (typeof commit !== 'undefined') { - payload['commit'] = commit; - } - if (typeof rollback !== 'undefined') { - payload['rollback'] = rollback; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a transaction by its unique ID. - * - * @param {string} params.transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTransaction(params: { transactionId: string }): Promise<{}>; - /** - * Delete a transaction by its unique ID. - * - * @param {string} transactionId - Transaction ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTransaction(transactionId: string): Promise<{}>; - deleteTransaction( - paramsOrFirst: { transactionId: string } | string - ): Promise<{}> { - let params: { transactionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string }; - } else { - params = { - transactionId: paramsOrFirst as string - }; - } - - const transactionId = params.transactionId; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create multiple operations in a single transaction. - * - * @param {string} params.transactionId - Transaction ID. - * @param {object[]} params.operations - Array of staged operations. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; - /** - * Create multiple operations in a single transaction. - * - * @param {string} transactionId - Transaction ID. - * @param {object[]} operations - Array of staged operations. - * @throws {AppwriteException} - * @returns {Promise<Models.Transaction>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>; - createOperations( - paramsOrFirst: { transactionId: string, operations?: object[] } | string, - ...rest: [(object[])?] - ): Promise<Models.Transaction> { - let params: { transactionId: string, operations?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; - } else { - params = { - transactionId: paramsOrFirst as string, - operations: rest[0] as object[] - }; - } - - const transactionId = params.transactionId; - const operations = params.operations; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); - } - - const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); - const payload: Payload = {}; - if (typeof operations !== 'undefined') { - payload['operations'] = operations; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - */ - get(params: { databaseId: string }): Promise<Models.Database>; - /** - * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(databaseId: string): Promise<Models.Database>; - get( - paramsOrFirst: { databaseId: string } | string - ): Promise<Models.Database> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a database by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.name - Database name. Max length: 128 chars. - * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - */ - update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; - /** - * Update a database by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} name - Database name. Max length: 128 chars. - * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. - * @throws {AppwriteException} - * @returns {Promise<Models.Database>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; - update( - paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, - ...rest: [(string)?, (boolean)?] - ): Promise<Models.Database> { - let params: { databaseId: string, name?: string, enabled?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean - }; - } - - const databaseId = params.databaseId; - const name = params.name; - const enabled = params.enabled; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} params.databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { databaseId: string }): Promise<{}>; - /** - * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. - * - * @param {string} databaseId - Database ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(databaseId: string): Promise<{}>; - delete( - paramsOrFirst: { databaseId: string } | string - ): Promise<{}> { - let params: { databaseId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string }; - } else { - params = { - databaseId: paramsOrFirst as string - }; - } - - const databaseId = params.databaseId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param {string} params.databaseId - Database ID. - * @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 columns: name, enabled, rowSecurity - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TableList>} - */ - listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.TableList>; - /** - * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. - * - * @param {string} databaseId - Database ID. - * @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 columns: name, enabled, rowSecurity - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TableList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTables(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.TableList>; - listTables( - paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.TableList> { - let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - 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. - * @param {string} params.name - Table name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {object[]} params.columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - */ - createTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise<Models.Table>; - /** - * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - 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. - * @param {string} name - Table name. Max length: 128 chars. - * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {object[]} columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. - * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTable(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[]): Promise<Models.Table>; - createTable( - paramsOrFirst: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] - ): Promise<Models.Table> { - let params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - rowSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - columns: rest[5] as object[], - indexes: rest[6] as object[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const name = params.name; - const permissions = params.permissions; - const rowSecurity = params.rowSecurity; - const enabled = params.enabled; - const columns = params.columns; - const indexes = params.indexes; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); - const payload: Payload = {}; - if (typeof tableId !== 'undefined') { - payload['tableId'] = tableId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof columns !== 'undefined') { - payload['columns'] = columns; - } - if (typeof indexes !== 'undefined') { - payload['indexes'] = indexes; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - */ - getTable(params: { databaseId: string, tableId: string }): Promise<Models.Table>; - /** - * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTable(databaseId: string, tableId: string): Promise<Models.Table>; - getTable( - paramsOrFirst: { databaseId: string, tableId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Table> { - let params: { databaseId: string, tableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a table by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.name - Table name. Max length: 128 chars. - * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {boolean} params.purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - */ - updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Table>; - /** - * Update a table by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} name - Table name. Max length: 128 chars. - * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. - * @param {boolean} purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. - * @throws {AppwriteException} - * @returns {Promise<Models.Table>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Table>; - updateTable( - paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.Table> { - let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - name: rest[1] as string, - permissions: rest[2] as string[], - rowSecurity: rest[3] as boolean, - enabled: rest[4] as boolean, - purge: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const name = params.name; - const permissions = params.permissions; - const rowSecurity = params.rowSecurity; - const enabled = params.enabled; - const purge = params.purge; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof rowSecurity !== 'undefined') { - payload['rowSecurity'] = rowSecurity; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof purge !== 'undefined') { - payload['purge'] = purge; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTable(params: { databaseId: string, tableId: string }): Promise<{}>; - /** - * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTable(databaseId: string, tableId: string): Promise<{}>; - deleteTable( - paramsOrFirst: { databaseId: string, tableId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { databaseId: string, tableId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * List columns in the table. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @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 columns: key, type, size, required, array, status, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnList>} - */ - listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnList>; - /** - * List columns in the table. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @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 columns: key, type, size, required, array, status, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listColumns(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnList>; - listColumns( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.ColumnList> { - let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a bigint column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - */ - createBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnBigint>; - /** - * Create a bigint column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnBigint>; - createBigIntColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.ColumnBigint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a bigint column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - */ - updateBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnBigint>; - /** - * Update a bigint column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBigint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnBigint>; - updateBigIntColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.ColumnBigint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a boolean column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - */ - createBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.ColumnBoolean>; - /** - * Create a boolean column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.ColumnBoolean>; - createBooleanColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnBoolean> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a boolean column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - */ - updateBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.ColumnBoolean>; - /** - * Update a boolean column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.ColumnBoolean>; - updateBooleanColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] - ): Promise<Models.ColumnBoolean> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as boolean, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a date time column according to the ISO 8601 standard. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - */ - createDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnDatetime>; - /** - * Create a date time column according to the ISO 8601 standard. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnDatetime>; - createDatetimeColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnDatetime> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a date time column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - */ - updateDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnDatetime>; - /** - * Update a date time column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnDatetime>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnDatetime>; - updateDatetimeColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnDatetime> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create an email column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - */ - createEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEmail>; - /** - * Create an email column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEmail>; - createEmailColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnEmail> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an email column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - */ - updateEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEmail>; - /** - * Update an email column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEmail>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEmail>; - updateEmailColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnEmail> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {string[]} params.elements - Array of enum values. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - */ - createEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEnum>; - /** - * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {string[]} elements - Array of enum values. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEnum>; - createEnumColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnEnum> { - let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an enum column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {string[]} params.elements - Updated list of enum values. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - */ - updateEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEnum>; - /** - * Update an enum column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {string[]} elements - Updated list of enum values. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnEnum>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEnum>; - updateEnumColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnEnum> { - let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - elements: rest[2] as string[], - required: rest[3] as boolean, - xdefault: rest[4] as string, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const elements = params.elements; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof elements === 'undefined') { - throw new AppwriteException('Missing required parameter: "elements"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof elements !== 'undefined') { - payload['elements'] = elements; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a float column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - */ - createFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.ColumnFloat>; - /** - * Create a float column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number} min - Minimum value - * @param {number} max - Maximum value - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.ColumnFloat>; - createFloatColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] - ): Promise<Models.ColumnFloat> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number, - max: rest[4] as number, - xdefault: rest[5] as number, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a float column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number} params.xdefault - Default value. Cannot be set when required. - * @param {number} params.min - Minimum value - * @param {number} params.max - Maximum value - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - */ - updateFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.ColumnFloat>; - /** - * Update a float column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number} xdefault - Default value. Cannot be set when required. - * @param {number} min - Minimum value - * @param {number} max - Maximum value - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnFloat>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.ColumnFloat>; - updateFloatColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] - ): Promise<Models.ColumnFloat> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number, - min: rest[4] as number, - max: rest[5] as number, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create an integer column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - */ - createIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnInteger>; - /** - * Create an integer column. Optionally, minimum and maximum values can be provided. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnInteger>; - createIntegerColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] - ): Promise<Models.ColumnInteger> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - min: rest[3] as number | bigint, - max: rest[4] as number | bigint, - xdefault: rest[5] as number | bigint, - array: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const min = params.min; - const max = params.max; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an integer column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} params.min - Minimum value - * @param {number | bigint} params.max - Maximum value - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - */ - updateIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnInteger>; - /** - * Update an integer column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. - * @param {number | bigint} min - Minimum value - * @param {number | bigint} max - Maximum value - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnInteger>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnInteger>; - updateIntegerColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] - ): Promise<Models.ColumnInteger> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as number | bigint, - min: rest[4] as number | bigint, - max: rest[5] as number | bigint, - newKey: rest[6] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const min = params.min; - const max = params.max; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create IP address column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - */ - createIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnIp>; - /** - * Create IP address column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnIp>; - createIpColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnIp> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an ip column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - */ - updateIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnIp>; - /** - * Update an ip column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIp>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnIp>; - updateIpColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnIp> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a geometric line column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - */ - createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnLine>; - /** - * Create a geometric line column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnLine>; - createLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.ColumnLine> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a line column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - */ - updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnLine>; - /** - * Update a line column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLine>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnLine>; - updateLineColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.ColumnLine> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a longtext column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - */ - createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnLongtext>; - /** - * Create a longtext column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnLongtext>; - createLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnLongtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a longtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - */ - updateLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnLongtext>; - /** - * Update a longtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnLongtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnLongtext>; - updateLongtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnLongtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a mediumtext column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - */ - createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnMediumtext>; - /** - * Create a mediumtext column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnMediumtext>; - createMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnMediumtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a mediumtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - */ - updateMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnMediumtext>; - /** - * Update a mediumtext column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnMediumtext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnMediumtext>; - updateMediumtextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnMediumtext> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a geometric point column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - */ - createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPoint>; - /** - * Create a geometric point column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPoint>; - createPointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.ColumnPoint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a point column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - */ - updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPoint>; - /** - * Update a point column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPoint>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPoint>; - updatePointColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.ColumnPoint> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a geometric polygon column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - */ - createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPolygon>; - /** - * Create a geometric polygon column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPolygon>; - createPolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?] - ): Promise<Models.ColumnPolygon> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a polygon column. Changing the `default` value will not update already existing rows. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - */ - updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPolygon>; - /** - * Update a polygon column. Changing the `default` value will not update already existing rows. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnPolygon>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPolygon>; - updatePolygonColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] - ): Promise<Models.ColumnPolygon> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as any[], - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.relatedTableId - Related Table ID. - * @param {RelationshipType} params.type - Relation type - * @param {boolean} params.twoWay - Is Two Way? - * @param {string} params.key - Column Key. - * @param {string} params.twoWayKey - Two Way Column Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - */ - createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.ColumnRelationship>; - /** - * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} relatedTableId - Related Table ID. - * @param {RelationshipType} type - Relation type - * @param {boolean} twoWay - Is Two Way? - * @param {string} key - Column Key. - * @param {string} twoWayKey - Two Way Column Key. - * @param {RelationMutate} onDelete - Constraints option - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.ColumnRelationship>; - createRelationshipColumn( - paramsOrFirst: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, - ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] - ): Promise<Models.ColumnRelationship> { - let params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - relatedTableId: rest[1] as string, - type: rest[2] as RelationshipType, - twoWay: rest[3] as boolean, - key: rest[4] as string, - twoWayKey: rest[5] as string, - onDelete: rest[6] as RelationMutate - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const relatedTableId = params.relatedTableId; - const type = params.type; - const twoWay = params.twoWay; - const key = params.key; - const twoWayKey = params.twoWayKey; - const onDelete = params.onDelete; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof relatedTableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "relatedTableId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof relatedTableId !== 'undefined') { - payload['relatedTableId'] = relatedTableId; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof twoWay !== 'undefined') { - payload['twoWay'] = twoWay; - } - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof twoWayKey !== 'undefined') { - payload['twoWayKey'] = twoWayKey; - } - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a string column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {number} params.size - Column size for text columns, in number of characters. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. - */ - createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnString>; - /** - * Create a string column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {number} size - Column size for text columns, in number of characters. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnString>; - createStringColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnString> { - let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a string column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} params.size - Maximum size of the string column. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. - */ - updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnString>; - /** - * Update a string column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} size - Maximum size of the string column. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnString>; - updateStringColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.ColumnString> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a text column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - */ - createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnText>; - /** - * Create a text column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnText>; - createTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnText> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean, - encrypt: rest[5] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a text column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - */ - updateTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnText>; - /** - * Update a text column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnText>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnText>; - updateTextColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnText> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a URL column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - */ - createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnUrl>; - /** - * Create a URL column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnUrl>; - createUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] - ): Promise<Models.ColumnUrl> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - array: rest[4] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update an url column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - */ - updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnUrl>; - /** - * Update an url column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnUrl>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnUrl>; - updateUrlColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.ColumnUrl> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - newKey: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a varchar column. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {number} params.size - Column size for varchar columns, in number of characters. Maximum size is 16381. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} params.array - Is column an array? - * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - */ - createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnVarchar>; - /** - * Create a varchar column. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {number} size - Column size for varchar columns, in number of characters. Maximum size is 16381. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {boolean} array - Is column an array? - * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnVarchar>; - createVarcharColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, - ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] - ): Promise<Models.ColumnVarchar> { - let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - size: rest[2] as number, - required: rest[3] as boolean, - xdefault: rest[4] as string, - array: rest[5] as boolean, - encrypt: rest[6] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const size = params.size; - const required = params.required; - const xdefault = params.xdefault; - const array = params.array; - const encrypt = params.encrypt; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof size === 'undefined') { - throw new AppwriteException('Missing required parameter: "size"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof array !== 'undefined') { - payload['array'] = array; - } - if (typeof encrypt !== 'undefined') { - payload['encrypt'] = encrypt; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a varchar column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Column Key. - * @param {boolean} params.required - Is column required? - * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} params.size - Maximum size of the varchar column. - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - */ - updateVarcharColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnVarchar>; - /** - * Update a varchar column. Changing the `default` value will not update already existing rows. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Column Key. - * @param {boolean} required - Is column required? - * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. - * @param {number} size - Maximum size of the varchar column. - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnVarchar>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateVarcharColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnVarchar>; - updateVarcharColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, - ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] - ): Promise<Models.ColumnVarchar> { - let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - required: rest[2] as boolean, - xdefault: rest[3] as string, - size: rest[4] as number, - newKey: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const required = params.required; - const xdefault = params.xdefault; - const size = params.size; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof required === 'undefined') { - throw new AppwriteException('Missing required parameter: "required"'); - } - if (typeof xdefault === 'undefined') { - throw new AppwriteException('Missing required parameter: "xdefault"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof required !== 'undefined') { - payload['required'] = required; - } - if (typeof xdefault !== 'undefined') { - payload['default'] = xdefault; - } - if (typeof size !== 'undefined') { - payload['size'] = size; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get column by ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} - */ - getColumn(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; - /** - * Get column by ID. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getColumn(databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; - getColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Deletes a column. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; - /** - * Deletes a column. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteColumn(databaseId: string, tableId: string, key: string): Promise<{}>; - deleteColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.key - Column Key. - * @param {RelationMutate} params.onDelete - Constraints option - * @param {string} params.newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - */ - updateRelationshipColumn(params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.ColumnRelationship>; - /** - * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} key - Column Key. - * @param {RelationMutate} onDelete - Constraints option - * @param {string} newKey - New Column Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnRelationship>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRelationshipColumn(databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.ColumnRelationship>; - updateRelationshipColumn( - paramsOrFirst: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, - ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] - ): Promise<Models.ColumnRelationship> { - let params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - onDelete: rest[2] as RelationMutate, - newKey: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const onDelete = params.onDelete; - const newKey = params.newKey; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - if (typeof onDelete !== 'undefined') { - payload['onDelete'] = onDelete; - } - if (typeof newKey !== 'undefined') { - payload['newKey'] = newKey; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * List indexes on the table. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @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 columns: key, type, status, attributes, error - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndexList>} - */ - listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnIndexList>; - /** - * List indexes on the table. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @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 columns: key, type, status, attributes, error - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndexList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listIndexes(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnIndexList>; - listIndexes( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.ColumnIndexList> { - let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const total = params.total; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. - * Type can be `key`, `fulltext`, or `unique`. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Index Key. - * @param {TablesDBIndexType} params.type - Index type. - * @param {string[]} params.columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} params.lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - */ - createIndex(params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>; - /** - * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. - * Type can be `key`, `fulltext`, or `unique`. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Index Key. - * @param {TablesDBIndexType} type - Index type. - * @param {string[]} columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. - * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. - * @param {number[]} lengths - Length of index. Maximum of 100 - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createIndex(databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>; - createIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string, - ...rest: [(string)?, (string)?, (TablesDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?] - ): Promise<Models.ColumnIndex> { - let params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string, - type: rest[2] as TablesDBIndexType, - columns: rest[3] as string[], - orders: rest[4] as OrderBy[], - lengths: rest[5] as number[] - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - const type = params.type; - const columns = params.columns; - const orders = params.orders; - const lengths = params.lengths; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - if (typeof columns === 'undefined') { - throw new AppwriteException('Missing required parameter: "columns"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof columns !== 'undefined') { - payload['columns'] = columns; - } - if (typeof orders !== 'undefined') { - payload['orders'] = orders; - } - if (typeof lengths !== 'undefined') { - payload['lengths'] = lengths; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get index by ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - */ - getIndex(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnIndex>; - /** - * Get index by ID. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<Models.ColumnIndex>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getIndex(databaseId: string, tableId: string, key: string): Promise<Models.ColumnIndex>; - getIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ColumnIndex> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an index. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteIndex(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; - /** - * Delete an index. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} key - Index Key. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteIndex(databaseId: string, tableId: string, key: string): Promise<{}>; - deleteIndex( - paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, tableId: string, key: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - key: rest[1] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const key = params.key; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof key === 'undefined') { - throw new AppwriteException('Missing required parameter: "key"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). - * @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. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - */ - listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.RowList<Row>>; - /** - * Get a list of all the user's rows in a given table. You can use the query params to filter your results. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). - * @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. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.RowList<Row>>; - listRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, - ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string, - total: rest[3] as boolean, - ttl: rest[4] as number - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const transactionId = params.transactionId; - const total = params.total; - const ttl = params.ttl; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - if (typeof ttl !== 'undefined') { - payload['ttl'] = ttl; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {string} params.rowId - Row 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. - * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON object. - * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - */ - createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }): Promise<Row>; - /** - * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {string} rowId - Row 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. - * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON object. - * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string): Promise<Row>; - createRow<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, - permissions: rest[3] as string[], - transactionId: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof data === 'undefined') { - throw new AppwriteException('Missing required parameter: "data"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof rowId !== 'undefined') { - payload['rowId'] = rowId; - } - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {object[]} params.rows - Array of rows data as JSON objects. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - */ - createRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; - /** - * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. - * @param {object[]} rows - Array of rows data as JSON objects. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; - createRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rows: rest[1] as object[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rows = params.rows; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rows === 'undefined') { - throw new AppwriteException('Missing required parameter: "rows"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof rows !== 'undefined') { - payload['rows'] = rows; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {object[]} params.rows - Array of row data as JSON objects. May contain partial rows. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; - /** - * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {object[]} rows - Array of row data as JSON objects. May contain partial rows. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; - upsertRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, - ...rest: [(string)?, (object[])?, (string)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rows: rest[1] as object[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rows = params.rows; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rows === 'undefined') { - throw new AppwriteException('Missing required parameter: "rows"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof rows !== 'undefined') { - payload['rows'] = rows; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {object} params.data - Row data as JSON object. Include only column and value pairs to be updated. - * @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. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - */ - updateRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; - /** - * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {object} data - Row data as JSON object. Include only column and value pairs to be updated. - * @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. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; - updateRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (object)?, (string[])?, (string)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - data: rest[1] as object, - queries: rest[2] as string[], - transactionId: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const data = params.data; - const queries = params.queries; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @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. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; - /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @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. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; - deleteRows<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string[])?, (string)?] - ): Promise<Models.RowList<Row>> { - let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - queries: rest[1] as string[], - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const queries = params.queries; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.rowId - Row ID. - * @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. - * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. - * @throws {AppwriteException} - * @returns {Promise<Row>} - */ - getRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }): Promise<Row>; - /** - * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} rowId - Row ID. - * @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. - * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. - * @throws {AppwriteException} - * @returns {Promise<Row>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string): Promise<Row>; - getRow<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - queries: rest[2] as string[], - transactionId: rest[3] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const queries = params.queries; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.rowId - Row ID. - * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} params.data - Row data as JSON object. Include all required columns of the row to be created or updated. - * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - */ - upsertRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }): Promise<Row>; - /** - * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} rowId - Row ID. - * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} data - Row data as JSON object. Include all required columns of the row to be created or updated. - * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - upsertRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string): Promise<Row>; - upsertRow<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, - permissions: rest[3] as string[], - transactionId: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.rowId - Row ID. - * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} params.data - Row data as JSON object. Include only columns and value pairs to be updated. - * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - */ - updateRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }): Promise<Row>; - /** - * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} rowId - Row ID. - * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} data - Row data as JSON object. Include only columns and value pairs to be updated. - * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string): Promise<Row>; - updateRow<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string } | string, - ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, - permissions: rest[3] as string[], - transactionId: rest[4] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const data = params.data; - const permissions = params.permissions; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - if (typeof data !== 'undefined') { - payload['data'] = data; - } - if (typeof permissions !== 'undefined') { - payload['permissions'] = permissions; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a row by its unique ID. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} params.rowId - Row ID. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteRow(params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }): Promise<{}>; - /** - * Delete a row by its unique ID. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). - * @param {string} rowId - Row ID. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteRow(databaseId: string, tableId: string, rowId: string, transactionId?: string): Promise<{}>; - deleteRow( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<{}> { - let params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - transactionId: rest[2] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); - const payload: Payload = {}; - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Decrement a specific column of a row by a given value. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.rowId - Row ID. - * @param {string} params.column - Column key. - * @param {number} params.value - Value to increment the column by. The value must be a number. - * @param {number} params.min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - */ - decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }): Promise<Row>; - /** - * Decrement a specific column of a row by a given value. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} rowId - Row ID. - * @param {string} column - Column key. - * @param {number} value - Value to increment the column by. The value must be a number. - * @param {number} min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string): Promise<Row>; - decrementRowColumn<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - column: rest[2] as string, - value: rest[3] as number, - min: rest[4] as number, - transactionId: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const column = params.column; - const value = params.value; - const min = params.min; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof column === 'undefined') { - throw new AppwriteException('Missing required parameter: "column"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); - const payload: Payload = {}; - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof min !== 'undefined') { - payload['min'] = min; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Increment a specific column of a row by a given value. - * - * @param {string} params.databaseId - Database ID. - * @param {string} params.tableId - Table ID. - * @param {string} params.rowId - Row ID. - * @param {string} params.column - Column key. - * @param {number} params.value - Value to increment the column by. The value must be a number. - * @param {number} params.max - Maximum value for the column. If the current value is greater than this value, an error will be thrown. - * @param {string} params.transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - */ - incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }): Promise<Row>; - /** - * Increment a specific column of a row by a given value. - * - * @param {string} databaseId - Database ID. - * @param {string} tableId - Table ID. - * @param {string} rowId - Row ID. - * @param {string} column - Column key. - * @param {number} value - Value to increment the column by. The value must be a number. - * @param {number} max - Maximum value for the column. If the current value is greater than this value, an error will be thrown. - * @param {string} transactionId - Transaction ID for staging the operation. - * @throws {AppwriteException} - * @returns {Promise<Row>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string): Promise<Row>; - incrementRowColumn<Row extends Models.Row = Models.DefaultRow>( - paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] - ): Promise<Row> { - let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }; - } else { - params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rowId: rest[1] as string, - column: rest[2] as string, - value: rest[3] as number, - max: rest[4] as number, - transactionId: rest[5] as string - }; - } - - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const column = params.column; - const value = params.value; - const max = params.max; - const transactionId = params.transactionId; - - if (typeof databaseId === 'undefined') { - throw new AppwriteException('Missing required parameter: "databaseId"'); - } - if (typeof tableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tableId"'); - } - if (typeof rowId === 'undefined') { - throw new AppwriteException('Missing required parameter: "rowId"'); - } - if (typeof column === 'undefined') { - throw new AppwriteException('Missing required parameter: "column"'); - } - - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); - const payload: Payload = {}; - if (typeof value !== 'undefined') { - payload['value'] = value; - } - if (typeof max !== 'undefined') { - payload['max'] = max; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/teams.ts b/src/services/teams.ts deleted file mode 100644 index 21e81152..00000000 --- a/src/services/teams.ts +++ /dev/null @@ -1,893 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Teams { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. - * - * @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: name, total, billingPlan - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TeamList<Preferences>>} - */ - list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TeamList<Preferences>>; - /** - * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. - * - * @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: name, total, billingPlan - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TeamList<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.TeamList<Preferences>>; - list<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.TeamList<Preferences>> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/teams'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. - * - * @param {string} params.teamId - Team 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. - * @param {string} params.name - Team name. Max length: 128 chars. - * @param {string[]} params.roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Team<Preferences>>} - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, name: string, roles?: string[] }): Promise<Models.Team<Preferences>>; - /** - * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. - * - * @param {string} teamId - Team 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. - * @param {string} name - Team name. Max length: 128 chars. - * @param {string[]} roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Team<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>; - create<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { teamId: string, name: string, roles?: string[] } | string, - ...rest: [(string)?, (string[])?] - ): Promise<Models.Team<Preferences>> { - let params: { teamId: string, name: string, roles?: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, name: string, roles?: string[] }; - } else { - params = { - teamId: paramsOrFirst as string, - name: rest[0] as string, - roles: rest[1] as string[] - }; - } - - const teamId = params.teamId; - const name = params.name; - const roles = params.roles; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/teams'; - const payload: Payload = {}; - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof roles !== 'undefined') { - payload['roles'] = roles; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a team by its ID. All team members have read access for this resource. - * - * @param {string} params.teamId - Team ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Team<Preferences>>} - */ - get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string }): Promise<Models.Team<Preferences>>; - /** - * Get a team by its ID. All team members have read access for this resource. - * - * @param {string} teamId - Team ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Team<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Models.Team<Preferences>>; - get<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { teamId: string } | string - ): Promise<Models.Team<Preferences>> { - let params: { teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string }; - } else { - params = { - teamId: paramsOrFirst as string - }; - } - - const teamId = params.teamId; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - - const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the team's name by its unique ID. - * - * @param {string} params.teamId - Team ID. - * @param {string} params.name - New team name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Team<Preferences>>} - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, name: string }): Promise<Models.Team<Preferences>>; - /** - * Update the team's name by its unique ID. - * - * @param {string} teamId - Team ID. - * @param {string} name - New team name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Team<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>; - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { teamId: string, name: string } | string, - ...rest: [(string)?] - ): Promise<Models.Team<Preferences>> { - let params: { teamId: string, name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, name: string }; - } else { - params = { - teamId: paramsOrFirst as string, - name: rest[0] as string - }; - } - - const teamId = params.teamId; - const name = params.name; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a team using its ID. Only team members with the owner role can delete the team. - * - * @param {string} params.teamId - Team ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { teamId: string }): Promise<{}>; - /** - * Delete a team using its ID. Only team members with the owner role can delete the team. - * - * @param {string} teamId - Team ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(teamId: string): Promise<{}>; - delete( - paramsOrFirst: { teamId: string } | string - ): Promise<{}> { - let params: { teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string }; - } else { - params = { - teamId: paramsOrFirst as string - }; - } - - const teamId = params.teamId; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - - const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. - * - * @param {string} params.teamId - Team ID. - * @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, teamId, invited, joined, confirm, roles - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MembershipList>} - */ - listMemberships(params: { teamId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.MembershipList>; - /** - * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. - * - * @param {string} teamId - Team ID. - * @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, teamId, invited, joined, confirm, roles - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MembershipList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMemberships(teamId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>; - listMemberships( - paramsOrFirst: { teamId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.MembershipList> { - let params: { teamId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - teamId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const teamId = params.teamId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - - const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. - * - * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. - * - * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. - * - * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - * - * - * @param {string} params.teamId - Team ID. - * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. - * @param {string} params.email - Email of the new team member. - * @param {string} params.userId - ID of the user to be added to a team. - * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. 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. - * @param {string} params.name - Name of the new team member. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - */ - createMembership(params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise<Models.Membership>; - /** - * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. - * - * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. - * - * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. - * - * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. - * - * - * @param {string} teamId - Team ID. - * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. - * @param {string} email - Email of the new team member. - * @param {string} userId - ID of the user to be added to a team. - * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. 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. - * @param {string} name - Name of the new team member. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>; - createMembership( - paramsOrFirst: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string, - ...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Membership> { - let params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; - } else { - params = { - teamId: paramsOrFirst as string, - roles: rest[0] as string[], - email: rest[1] as string, - userId: rest[2] as string, - phone: rest[3] as string, - url: rest[4] as string, - name: rest[5] as string - }; - } - - const teamId = params.teamId; - const roles = params.roles; - const email = params.email; - const userId = params.userId; - const phone = params.phone; - const url = params.url; - const name = params.name; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof roles === 'undefined') { - throw new AppwriteException('Missing required parameter: "roles"'); - } - - const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); - const payload: Payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof phone !== 'undefined') { - payload['phone'] = phone; - } - if (typeof roles !== 'undefined') { - payload['roles'] = roles; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. - * - * @param {string} params.teamId - Team ID. - * @param {string} params.membershipId - Membership ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - */ - getMembership(params: { teamId: string, membershipId: string }): Promise<Models.Membership>; - /** - * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. - * - * @param {string} teamId - Team ID. - * @param {string} membershipId - Membership ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMembership(teamId: string, membershipId: string): Promise<Models.Membership>; - getMembership( - paramsOrFirst: { teamId: string, membershipId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Membership> { - let params: { teamId: string, membershipId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string }; - } else { - params = { - teamId: paramsOrFirst as string, - membershipId: rest[0] as string - }; - } - - const teamId = params.teamId; - const membershipId = params.membershipId; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - * - * - * @param {string} params.teamId - Team ID. - * @param {string} params.membershipId - Membership ID. - * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - */ - updateMembership(params: { teamId: string, membershipId: string, roles: string[] }): Promise<Models.Membership>; - /** - * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). - * - * - * @param {string} teamId - Team ID. - * @param {string} membershipId - Membership ID. - * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>; - updateMembership( - paramsOrFirst: { teamId: string, membershipId: string, roles: string[] } | string, - ...rest: [(string)?, (string[])?] - ): Promise<Models.Membership> { - let params: { teamId: string, membershipId: string, roles: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: string[] }; - } else { - params = { - teamId: paramsOrFirst as string, - membershipId: rest[0] as string, - roles: rest[1] as string[] - }; - } - - const teamId = params.teamId; - const membershipId = params.membershipId; - const roles = params.roles; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - if (typeof roles === 'undefined') { - throw new AppwriteException('Missing required parameter: "roles"'); - } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - const payload: Payload = {}; - if (typeof roles !== 'undefined') { - payload['roles'] = roles; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. - * - * @param {string} params.teamId - Team ID. - * @param {string} params.membershipId - Membership ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteMembership(params: { teamId: string, membershipId: string }): Promise<{}>; - /** - * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. - * - * @param {string} teamId - Team ID. - * @param {string} membershipId - Membership ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMembership(teamId: string, membershipId: string): Promise<{}>; - deleteMembership( - paramsOrFirst: { teamId: string, membershipId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { teamId: string, membershipId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string }; - } else { - params = { - teamId: paramsOrFirst as string, - membershipId: rest[0] as string - }; - } - - const teamId = params.teamId; - const membershipId = params.membershipId; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. - * - * If the request is successful, a session for the user is automatically created. - * - * - * @param {string} params.teamId - Team ID. - * @param {string} params.membershipId - Membership ID. - * @param {string} params.userId - User ID. - * @param {string} params.secret - Secret key. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - */ - updateMembershipStatus(params: { teamId: string, membershipId: string, userId: string, secret: string }): Promise<Models.Membership>; - /** - * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. - * - * If the request is successful, a session for the user is automatically created. - * - * - * @param {string} teamId - Team ID. - * @param {string} membershipId - Membership ID. - * @param {string} userId - User ID. - * @param {string} secret - Secret key. - * @throws {AppwriteException} - * @returns {Promise<Models.Membership>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership>; - updateMembershipStatus( - paramsOrFirst: { teamId: string, membershipId: string, userId: string, secret: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.Membership> { - let params: { teamId: string, membershipId: string, userId: string, secret: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, userId: string, secret: string }; - } else { - params = { - teamId: paramsOrFirst as string, - membershipId: rest[0] as string, - userId: rest[1] as string, - secret: rest[2] as string - }; - } - - const teamId = params.teamId; - const membershipId = params.membershipId; - const userId = params.userId; - const secret = params.secret; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof membershipId === 'undefined') { - throw new AppwriteException('Missing required parameter: "membershipId"'); - } - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof secret === 'undefined') { - throw new AppwriteException('Missing required parameter: "secret"'); - } - - const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). - * - * @param {string} params.teamId - Team ID. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - */ - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string }): Promise<Preferences>; - /** - * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). - * - * @param {string} teamId - Team ID. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Preferences>; - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { teamId: string } | string - ): Promise<Preferences> { - let params: { teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string }; - } else { - params = { - teamId: paramsOrFirst as string - }; - } - - const teamId = params.teamId; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - - const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. - * - * @param {string} params.teamId - Team ID. - * @param {object} params.prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, prefs: object }): Promise<Preferences>; - /** - * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. - * - * @param {string} teamId - Team ID. - * @param {object} prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, prefs: object): Promise<Preferences>; - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { teamId: string, prefs: object } | string, - ...rest: [(object)?] - ): Promise<Preferences> { - let params: { teamId: string, prefs: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { teamId: string, prefs: object }; - } else { - params = { - teamId: paramsOrFirst as string, - prefs: rest[0] as object - }; - } - - const teamId = params.teamId; - const prefs = params.prefs; - - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - if (typeof prefs === 'undefined') { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - - const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); - const payload: Payload = {}; - if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/tokens.ts b/src/services/tokens.ts deleted file mode 100644 index 1e453a72..00000000 --- a/src/services/tokens.ts +++ /dev/null @@ -1,315 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Tokens { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File unique ID. - * @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: expire - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceTokenList>} - */ - list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise<Models.ResourceTokenList>; - /** - * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File unique ID. - * @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: expire - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceTokenList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise<Models.ResourceTokenList>; - list( - paramsOrFirst: { bucketId: string, fileId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string)?, (string[])?, (boolean)?] - ): Promise<Models.ResourceTokenList> { - let params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[], total?: boolean }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - queries: rest[1] as string[], - total: rest[2] as boolean - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const queries = params.queries; - const total = params.total; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. - * - * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} params.fileId - File unique ID. - * @param {string} params.expire - Token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - */ - createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise<Models.ResourceToken>; - /** - * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. - * - * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). - * @param {string} fileId - File unique ID. - * @param {string} expire - Token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>; - createFileToken( - paramsOrFirst: { bucketId: string, fileId: string, expire?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.ResourceToken> { - let params: { bucketId: string, fileId: string, expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, expire?: string }; - } else { - params = { - bucketId: paramsOrFirst as string, - fileId: rest[0] as string, - expire: rest[1] as string - }; - } - - const bucketId = params.bucketId; - const fileId = params.fileId; - const expire = params.expire; - - if (typeof bucketId === 'undefined') { - throw new AppwriteException('Missing required parameter: "bucketId"'); - } - if (typeof fileId === 'undefined') { - throw new AppwriteException('Missing required parameter: "fileId"'); - } - - const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); - const payload: Payload = {}; - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a token by its unique ID. - * - * @param {string} params.tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - */ - get(params: { tokenId: string }): Promise<Models.ResourceToken>; - /** - * Get a token by its unique ID. - * - * @param {string} tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(tokenId: string): Promise<Models.ResourceToken>; - get( - paramsOrFirst: { tokenId: string } | string - ): Promise<Models.ResourceToken> { - let params: { tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { tokenId: string }; - } else { - params = { - tokenId: paramsOrFirst as string - }; - } - - const tokenId = params.tokenId; - - if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a token by its unique ID. Use this endpoint to update a token's expiry date. - * - * @param {string} params.tokenId - Token unique ID. - * @param {string} params.expire - File token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - */ - update(params: { tokenId: string, expire?: string }): Promise<Models.ResourceToken>; - /** - * Update a token by its unique ID. Use this endpoint to update a token's expiry date. - * - * @param {string} tokenId - Token unique ID. - * @param {string} expire - File token expiry date - * @throws {AppwriteException} - * @returns {Promise<Models.ResourceToken>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(tokenId: string, expire?: string): Promise<Models.ResourceToken>; - update( - paramsOrFirst: { tokenId: string, expire?: string } | string, - ...rest: [(string)?] - ): Promise<Models.ResourceToken> { - let params: { tokenId: string, expire?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { tokenId: string, expire?: string }; - } else { - params = { - tokenId: paramsOrFirst as string, - expire: rest[0] as string - }; - } - - const tokenId = params.tokenId; - const expire = params.expire; - - if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); - const payload: Payload = {}; - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a token by its unique ID. - * - * @param {string} params.tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { tokenId: string }): Promise<{}>; - /** - * Delete a token by its unique ID. - * - * @param {string} tokenId - Token ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(tokenId: string): Promise<{}>; - delete( - paramsOrFirst: { tokenId: string } | string - ): Promise<{}> { - let params: { tokenId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { tokenId: string }; - } else { - params = { - tokenId: paramsOrFirst as string - }; - } - - const tokenId = params.tokenId; - - if (typeof tokenId === 'undefined') { - throw new AppwriteException('Missing required parameter: "tokenId"'); - } - - const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/usage.ts b/src/services/usage.ts deleted file mode 100644 index 84c654ab..00000000 --- a/src/services/usage.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Usage { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UsageEventList>} - */ - listEvents(params?: { queries?: string[], total?: boolean }): Promise<Models.UsageEventList>; - /** - * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UsageEventList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listEvents(queries?: string[], total?: boolean): Promise<Models.UsageEventList>; - listEvents( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.UsageEventList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/usage/events'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UsageGaugeList>} - */ - listGauges(params?: { queries?: string[], total?: boolean }): Promise<Models.UsageGaugeList>; - /** - * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. - * - * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UsageGaugeList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listGauges(queries?: string[], total?: boolean): Promise<Models.UsageGaugeList>; - listGauges( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.UsageGaugeList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/usage/gauges'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/users.ts b/src/services/users.ts deleted file mode 100644 index 19faa4d1..00000000 --- a/src/services/users.ts +++ /dev/null @@ -1,3270 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -import { PasswordHash } from '../enums/password-hash'; -import { AuthenticatorType } from '../enums/authenticator-type'; -import { MessagingProviderType } from '../enums/messaging-provider-type'; - -export class Users { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all the project's users. You can use the query params to filter your results. - * - * @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: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UserList<Preferences>>} - */ - list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.UserList<Preferences>>; - /** - * Get a list of all the project's users. You can use the query params to filter your results. - * - * @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: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.UserList<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.UserList<Preferences>>; - list<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.UserList<Preferences>> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/users'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} params.password - Plain text user password. Must be at least 8 chars. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email?: string, phone?: string, password?: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. - * - * @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. - * @param {string} email - User email. - * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. - * @param {string} password - Plain text user password. Must be at least 8 chars. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>>; - create<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email?: string, phone?: string, password?: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email?: string, phone?: string, password?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email?: string, phone?: string, password?: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - phone: rest[1] as string, - password: rest[2] as string, - name: rest[3] as string - }; - } - - const userId = params.userId; - const email = params.email; - const phone = params.phone; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof phone !== 'undefined') { - payload['phone'] = phone; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.password - User password hashed using Argon2. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} email - User email. - * @param {string} password - User password hashed using Argon2. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/argon2'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.password - User password hashed using Bcrypt. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} email - User email. - * @param {string} password - User password hashed using Bcrypt. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/bcrypt'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get identities for all users. - * - * @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 - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IdentityList>} - */ - listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.IdentityList>; - /** - * Get identities for all users. - * - * @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 - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.IdentityList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listIdentities(queries?: string[], search?: string, total?: boolean): Promise<Models.IdentityList>; - listIdentities( - paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], - ...rest: [(string)?, (boolean)?] - ): Promise<Models.IdentityList> { - let params: { queries?: string[], search?: string, total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - search: rest[0] as string, - total: rest[1] as boolean - }; - } - - const queries = params.queries; - const search = params.search; - const total = params.total; - - - const apiPath = '/users/identities'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an identity by its unique ID. - * - * @param {string} params.identityId - Identity ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteIdentity(params: { identityId: string }): Promise<{}>; - /** - * Delete an identity by its unique ID. - * - * @param {string} identityId - Identity ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteIdentity(identityId: string): Promise<{}>; - deleteIdentity( - paramsOrFirst: { identityId: string } | string - ): Promise<{}> { - let params: { identityId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { identityId: string }; - } else { - params = { - identityId: paramsOrFirst as string - }; - } - - const identityId = params.identityId; - - if (typeof identityId === 'undefined') { - throw new AppwriteException('Missing required parameter: "identityId"'); - } - - const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.password - User password hashed using MD5. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} email - User email. - * @param {string} password - User password hashed using MD5. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/md5'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} params.userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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. - * @param {string} params.email - User email. - * @param {string} params.password - User password hashed using PHPass. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @param {string} userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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. - * @param {string} email - User email. - * @param {string} password - User password hashed using PHPass. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; - createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - name: rest[2] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/phpass'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.password - User password hashed using Scrypt. - * @param {string} params.passwordSalt - Optional salt used to hash password. - * @param {number} params.passwordCpu - Optional CPU cost used to hash password. - * @param {number} params.passwordMemory - Optional memory cost used to hash password. - * @param {number} params.passwordParallel - Optional parallelization cost used to hash password. - * @param {number} params.passwordLength - Optional hash length used to hash password. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} email - User email. - * @param {string} password - User password hashed using Scrypt. - * @param {string} passwordSalt - Optional salt used to hash password. - * @param {number} passwordCpu - Optional CPU cost used to hash password. - * @param {number} passwordMemory - Optional memory cost used to hash password. - * @param {number} passwordParallel - Optional parallelization cost used to hash password. - * @param {number} passwordLength - Optional hash length used to hash password. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>>; - createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (number)?, (number)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - passwordSalt: rest[2] as string, - passwordCpu: rest[3] as number, - passwordMemory: rest[4] as number, - passwordParallel: rest[5] as number, - passwordLength: rest[6] as number, - name: rest[7] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const passwordSalt = params.passwordSalt; - const passwordCpu = params.passwordCpu; - const passwordMemory = params.passwordMemory; - const passwordParallel = params.passwordParallel; - const passwordLength = params.passwordLength; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (typeof passwordSalt === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); - } - if (typeof passwordCpu === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordCpu"'); - } - if (typeof passwordMemory === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordMemory"'); - } - if (typeof passwordParallel === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordParallel"'); - } - if (typeof passwordLength === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordLength"'); - } - - const apiPath = '/users/scrypt'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof passwordSalt !== 'undefined') { - payload['passwordSalt'] = passwordSalt; - } - if (typeof passwordCpu !== 'undefined') { - payload['passwordCpu'] = passwordCpu; - } - if (typeof passwordMemory !== 'undefined') { - payload['passwordMemory'] = passwordMemory; - } - if (typeof passwordParallel !== 'undefined') { - payload['passwordParallel'] = passwordParallel; - } - if (typeof passwordLength !== 'undefined') { - payload['passwordLength'] = passwordLength; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.password - User password hashed using Scrypt Modified. - * @param {string} params.passwordSalt - Salt used to hash password. - * @param {string} params.passwordSaltSeparator - Salt separator used to hash password. - * @param {string} params.passwordSignerKey - Signer key used to hash password. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} email - User email. - * @param {string} password - User password hashed using Scrypt Modified. - * @param {string} passwordSalt - Salt used to hash password. - * @param {string} passwordSaltSeparator - Salt separator used to hash password. - * @param {string} passwordSignerKey - Signer key used to hash password. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>>; - createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - passwordSalt: rest[2] as string, - passwordSaltSeparator: rest[3] as string, - passwordSignerKey: rest[4] as string, - name: rest[5] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const passwordSalt = params.passwordSalt; - const passwordSaltSeparator = params.passwordSaltSeparator; - const passwordSignerKey = params.passwordSignerKey; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - if (typeof passwordSalt === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSalt"'); - } - if (typeof passwordSaltSeparator === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"'); - } - if (typeof passwordSignerKey === 'undefined') { - throw new AppwriteException('Missing required parameter: "passwordSignerKey"'); - } - - const apiPath = '/users/scrypt-modified'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof passwordSalt !== 'undefined') { - payload['passwordSalt'] = passwordSalt; - } - if (typeof passwordSaltSeparator !== 'undefined') { - payload['passwordSaltSeparator'] = passwordSaltSeparator; - } - if (typeof passwordSignerKey !== 'undefined') { - payload['passwordSignerKey'] = passwordSignerKey; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} params.email - User email. - * @param {string} params.password - User password hashed using SHA. - * @param {PasswordHash} params.passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }): Promise<Models.User<Preferences>>; - /** - * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. - * - * @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. - * @param {string} email - User email. - * @param {string} password - User password hashed using SHA. - * @param {PasswordHash} passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise<Models.User<Preferences>>; - createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string } | string, - ...rest: [(string)?, (string)?, (PasswordHash)?, (string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string, - password: rest[1] as string, - passwordVersion: rest[2] as PasswordHash, - name: rest[3] as string - }; - } - - const userId = params.userId; - const email = params.email; - const password = params.password; - const passwordVersion = params.passwordVersion; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/sha'; - const payload: Payload = {}; - if (typeof userId !== 'undefined') { - payload['userId'] = userId; - } - if (typeof email !== 'undefined') { - payload['email'] = email; - } - if (typeof password !== 'undefined') { - payload['password'] = password; - } - if (typeof passwordVersion !== 'undefined') { - payload['passwordVersion'] = passwordVersion; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a user by its unique ID. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Models.User<Preferences>>; - /** - * Get a user by its unique ID. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Models.User<Preferences>>; - get<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string } | string - ): Promise<Models.User<Preferences>> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { userId: string }): Promise<{}>; - /** - * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(userId: string): Promise<{}>; - delete( - paramsOrFirst: { userId: string } | string - ): Promise<{}> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user email by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.email - User email. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string }): Promise<Models.User<Preferences>>; - /** - * Update the user email by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} email - User email. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string): Promise<Models.User<Preferences>>; - updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, email: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, email: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, email: string }; - } else { - params = { - userId: paramsOrFirst as string, - email: rest[0] as string - }; - } - - const userId = params.userId; - const email = params.email; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof email === 'undefined') { - throw new AppwriteException('Missing required parameter: "email"'); - } - - const apiPath = '/users/{userId}/email'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof email !== 'undefined') { - payload['email'] = email; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. - * - * - * @param {string} params.userId - User ID. - * @param {boolean} params.impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, impersonator: boolean }): Promise<Models.User<Preferences>>; - /** - * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. - * - * - * @param {string} userId - User ID. - * @param {boolean} impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, impersonator: boolean): Promise<Models.User<Preferences>>; - updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, impersonator: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, impersonator: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, impersonator: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - impersonator: rest[0] as boolean - }; - } - - const userId = params.userId; - const impersonator = params.impersonator; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof impersonator === 'undefined') { - throw new AppwriteException('Missing required parameter: "impersonator"'); - } - - const apiPath = '/users/{userId}/impersonator'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof impersonator !== 'undefined') { - payload['impersonator'] = impersonator; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. - * - * @param {string} params.userId - User ID. - * @param {string} params.sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. - * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Jwt>} - */ - createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise<Models.Jwt>; - /** - * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. - * - * @param {string} userId - User ID. - * @param {string} sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. - * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. - * @throws {AppwriteException} - * @returns {Promise<Models.Jwt>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createJWT(userId: string, sessionId?: string, duration?: number): Promise<Models.Jwt>; - createJWT( - paramsOrFirst: { userId: string, sessionId?: string, duration?: number } | string, - ...rest: [(string)?, (number)?] - ): Promise<Models.Jwt> { - let params: { userId: string, sessionId?: string, duration?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, sessionId?: string, duration?: number }; - } else { - params = { - userId: paramsOrFirst as string, - sessionId: rest[0] as string, - duration: rest[1] as number - }; - } - - const userId = params.userId; - const sessionId = params.sessionId; - const duration = params.duration; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/jwts'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof sessionId !== 'undefined') { - payload['sessionId'] = sessionId; - } - if (typeof duration !== 'undefined') { - payload['duration'] = duration; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user labels by its unique ID. - * - * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. - * - * @param {string} params.userId - User ID. - * @param {string[]} params.labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, labels: string[] }): Promise<Models.User<Preferences>>; - /** - * Update the user labels by its unique ID. - * - * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. - * - * @param {string} userId - User ID. - * @param {string[]} labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, labels: string[]): Promise<Models.User<Preferences>>; - updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, labels: string[] } | string, - ...rest: [(string[])?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, labels: string[] }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, labels: string[] }; - } else { - params = { - userId: paramsOrFirst as string, - labels: rest[0] as string[] - }; - } - - const userId = params.userId; - const labels = params.labels; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof labels === 'undefined') { - throw new AppwriteException('Missing required parameter: "labels"'); - } - - const apiPath = '/users/{userId}/labels'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof labels !== 'undefined') { - payload['labels'] = labels; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the user activity logs list by its unique ID. - * - * @param {string} params.userId - User ID. - * @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 - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - */ - listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; - /** - * Get the user activity logs list by its unique ID. - * - * @param {string} userId - User ID. - * @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 - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.LogList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listLogs(userId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; - listLogs( - paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.LogList> { - let params: { userId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const userId = params.userId; - const queries = params.queries; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/logs'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the user membership list by its unique ID. - * - * @param {string} params.userId - User ID. - * @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, teamId, invited, joined, confirm, roles - * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MembershipList>} - */ - listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.MembershipList>; - /** - * Get the user membership list by its unique ID. - * - * @param {string} userId - User ID. - * @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, teamId, invited, joined, confirm, roles - * @param {string} search - Search term to filter your list results. Max length: 256 chars. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.MembershipList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMemberships(userId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>; - listMemberships( - paramsOrFirst: { userId: string, queries?: string[], search?: string, total?: boolean } | string, - ...rest: [(string[])?, (string)?, (boolean)?] - ): Promise<Models.MembershipList> { - let params: { userId: string, queries?: string[], search?: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[], search?: string, total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean - }; - } - - const userId = params.userId; - const queries = params.queries; - const search = params.search; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof search !== 'undefined') { - payload['search'] = search; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Enable or disable MFA on a user account. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead. - */ - updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; - /** - * Enable or disable MFA on a user account. - * - * @param {string} userId - User ID. - * @param {boolean} mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; - updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, mfa: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - mfa: rest[0] as boolean - }; - } - - const userId = params.userId; - const mfa = params.mfa; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof mfa === 'undefined') { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - - const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Enable or disable MFA on a user account. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; - /** - * Enable or disable MFA on a user account. - * - * @param {string} userId - User ID. - * @param {boolean} mfa - Enable or disable MFA. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; - updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, mfa: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, mfa: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - mfa: rest[0] as boolean - }; - } - - const userId = params.userId; - const mfa = params.mfa; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof mfa === 'undefined') { - throw new AppwriteException('Missing required parameter: "mfa"'); - } - - const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof mfa !== 'undefined') { - payload['mfa'] = mfa; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an authenticator app. - * - * @param {string} params.userId - User ID. - * @param {AuthenticatorType} params.type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead. - */ - deleteMfaAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; - /** - * Delete an authenticator app. - * - * @param {string} userId - User ID. - * @param {AuthenticatorType} type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; - deleteMfaAuthenticator( - paramsOrFirst: { userId: string, type: AuthenticatorType } | string, - ...rest: [(AuthenticatorType)?] - ): Promise<{}> { - let params: { userId: string, type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; - } else { - params = { - userId: paramsOrFirst as string, - type: rest[0] as AuthenticatorType - }; - } - - const userId = params.userId; - const type = params.type; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete an authenticator app. - * - * @param {string} params.userId - User ID. - * @param {AuthenticatorType} params.type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteMFAAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; - /** - * Delete an authenticator app. - * - * @param {string} userId - User ID. - * @param {AuthenticatorType} type - Type of authenticator. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteMFAAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; - deleteMFAAuthenticator( - paramsOrFirst: { userId: string, type: AuthenticatorType } | string, - ...rest: [(AuthenticatorType)?] - ): Promise<{}> { - let params: { userId: string, type: AuthenticatorType }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; - } else { - params = { - userId: paramsOrFirst as string, - type: rest[0] as AuthenticatorType - }; - } - - const userId = params.userId; - const type = params.type; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof type === 'undefined') { - throw new AppwriteException('Missing required parameter: "type"'); - } - - const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * List the factors available on the account to be used as a MFA challange. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead. - */ - listMfaFactors(params: { userId: string }): Promise<Models.MfaFactors>; - /** - * List the factors available on the account to be used as a MFA challange. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMfaFactors(userId: string): Promise<Models.MfaFactors>; - listMfaFactors( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaFactors> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * List the factors available on the account to be used as a MFA challange. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - */ - listMFAFactors(params: { userId: string }): Promise<Models.MfaFactors>; - /** - * List the factors available on the account to be used as a MFA challange. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaFactors>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listMFAFactors(userId: string): Promise<Models.MfaFactors>; - listMFAFactors( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaFactors> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead. - */ - getMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - getMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - getMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - getMFARecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead. - */ - updateMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - updateMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - updateMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - updateMFARecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead. - */ - createMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - createMfaRecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - */ - createMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; - /** - * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Models.MfaRecoveryCodes>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; - createMFARecoveryCodes( - paramsOrFirst: { userId: string } | string - ): Promise<Models.MfaRecoveryCodes> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user name by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, name: string }): Promise<Models.User<Preferences>>; - /** - * Update the user name by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} name - User name. Max length: 128 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, name: string): Promise<Models.User<Preferences>>; - updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, name: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, name: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, name: string }; - } else { - params = { - userId: paramsOrFirst as string, - name: rest[0] as string - }; - } - - const userId = params.userId; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/users/{userId}/name'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user password by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.password - New user password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, password: string }): Promise<Models.User<Preferences>>; - /** - * Update the user password by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} password - New user password. Must be at least 8 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, password: string): Promise<Models.User<Preferences>>; - updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, password: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, password: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, password: string }; - } else { - params = { - userId: paramsOrFirst as string, - password: rest[0] as string - }; - } - - const userId = params.userId; - const password = params.password; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof password === 'undefined') { - throw new AppwriteException('Missing required parameter: "password"'); - } - - const apiPath = '/users/{userId}/password'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof password !== 'undefined') { - payload['password'] = password; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user phone by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.number - User phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, number: string }): Promise<Models.User<Preferences>>; - /** - * Update the user phone by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} number - User phone number. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, number: string): Promise<Models.User<Preferences>>; - updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, number: string } | string, - ...rest: [(string)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, number: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, number: string }; - } else { - params = { - userId: paramsOrFirst as string, - number: rest[0] as string - }; - } - - const userId = params.userId; - const number = params.number; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof number === 'undefined') { - throw new AppwriteException('Missing required parameter: "number"'); - } - - const apiPath = '/users/{userId}/phone'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof number !== 'undefined') { - payload['number'] = number; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the user preferences by its unique ID. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - */ - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Preferences>; - /** - * Get the user preferences by its unique ID. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Preferences>; - getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string } | string - ): Promise<Preferences> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. - * - * @param {string} params.userId - User ID. - * @param {object} params.prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, prefs: object }): Promise<Preferences>; - /** - * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. - * - * @param {string} userId - User ID. - * @param {object} prefs - Prefs key-value JSON object. - * @throws {AppwriteException} - * @returns {Promise<Preferences>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, prefs: object): Promise<Preferences>; - updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, prefs: object } | string, - ...rest: [(object)?] - ): Promise<Preferences> { - let params: { userId: string, prefs: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, prefs: object }; - } else { - params = { - userId: paramsOrFirst as string, - prefs: rest[0] as object - }; - } - - const userId = params.userId; - const prefs = params.prefs; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof prefs === 'undefined') { - throw new AppwriteException('Missing required parameter: "prefs"'); - } - - const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof prefs !== 'undefined') { - payload['prefs'] = prefs; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get the user sessions list by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SessionList>} - */ - listSessions(params: { userId: string, total?: boolean }): Promise<Models.SessionList>; - /** - * Get the user sessions list by its unique ID. - * - * @param {string} userId - User ID. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.SessionList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSessions(userId: string, total?: boolean): Promise<Models.SessionList>; - listSessions( - paramsOrFirst: { userId: string, total?: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.SessionList> { - let params: { userId: string, total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - total: rest[0] as boolean - }; - } - - const userId = params.userId; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Creates a session for a user. Returns an immediately usable session object. - * - * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - */ - createSession(params: { userId: string }): Promise<Models.Session>; - /** - * Creates a session for a user. Returns an immediately usable session object. - * - * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. - * - * @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. - * @throws {AppwriteException} - * @returns {Promise<Models.Session>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSession(userId: string): Promise<Models.Session>; - createSession( - paramsOrFirst: { userId: string } | string - ): Promise<Models.Session> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete all user's sessions by using the user's unique ID. - * - * @param {string} params.userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSessions(params: { userId: string }): Promise<{}>; - /** - * Delete all user's sessions by using the user's unique ID. - * - * @param {string} userId - User ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteSessions(userId: string): Promise<{}>; - deleteSessions( - paramsOrFirst: { userId: string } | string - ): Promise<{}> { - let params: { userId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string }; - } else { - params = { - userId: paramsOrFirst as string - }; - } - - const userId = params.userId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a user sessions by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.sessionId - Session ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSession(params: { userId: string, sessionId: string }): Promise<{}>; - /** - * Delete a user sessions by its unique ID. - * - * @param {string} userId - User ID. - * @param {string} sessionId - Session ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteSession(userId: string, sessionId: string): Promise<{}>; - deleteSession( - paramsOrFirst: { userId: string, sessionId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { userId: string, sessionId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, sessionId: string }; - } else { - params = { - userId: paramsOrFirst as string, - sessionId: rest[0] as string - }; - } - - const userId = params.userId; - const sessionId = params.sessionId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof sessionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "sessionId"'); - } - - const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.status - User Status. To activate the user pass `true` and to block the user pass `false`. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, status: boolean }): Promise<Models.User<Preferences>>; - /** - * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. - * - * @param {string} userId - User ID. - * @param {boolean} status - User Status. To activate the user pass `true` and to block the user pass `false`. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, status: boolean): Promise<Models.User<Preferences>>; - updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, status: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, status: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, status: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - status: rest[0] as boolean - }; - } - - const userId = params.userId; - const status = params.status; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/users/{userId}/status'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof status !== 'undefined') { - payload['status'] = status; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * List the messaging targets that are associated with a user. - * - * @param {string} params.userId - User ID. - * @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, providerId, identifier, providerType - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - */ - listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; - /** - * List the messaging targets that are associated with a user. - * - * @param {string} userId - User ID. - * @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, providerId, identifier, providerType - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.TargetList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listTargets(userId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; - listTargets( - paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.TargetList> { - let params: { userId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const userId = params.userId; - const queries = params.queries; - const total = params.total; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a messaging target. - * - * @param {string} params.userId - User ID. - * @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. - * @param {MessagingProviderType} params.providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. - * @param {string} params.identifier - The target identifier (token, email, phone etc.) - * @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. - * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - createTarget(params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }): Promise<Models.Target>; - /** - * Create a messaging target. - * - * @param {string} userId - User ID. - * @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. - * @param {MessagingProviderType} providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. - * @param {string} identifier - The target identifier (token, email, phone etc.) - * @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. - * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createTarget(userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string): Promise<Models.Target>; - createTarget( - paramsOrFirst: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string } | string, - ...rest: [(string)?, (MessagingProviderType)?, (string)?, (string)?, (string)?] - ): Promise<Models.Target> { - let params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string, - providerType: rest[1] as MessagingProviderType, - identifier: rest[2] as string, - providerId: rest[3] as string, - name: rest[4] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - const providerType = params.providerType; - const identifier = params.identifier; - const providerId = params.providerId; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - if (typeof providerType === 'undefined') { - throw new AppwriteException('Missing required parameter: "providerType"'); - } - if (typeof identifier === 'undefined') { - throw new AppwriteException('Missing required parameter: "identifier"'); - } - - const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof targetId !== 'undefined') { - payload['targetId'] = targetId; - } - if (typeof providerType !== 'undefined') { - payload['providerType'] = providerType; - } - if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; - } - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a user's push notification target by ID. - * - * @param {string} params.userId - User ID. - * @param {string} params.targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - getTarget(params: { userId: string, targetId: string }): Promise<Models.Target>; - /** - * Get a user's push notification target by ID. - * - * @param {string} userId - User ID. - * @param {string} targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getTarget(userId: string, targetId: string): Promise<Models.Target>; - getTarget( - paramsOrFirst: { userId: string, targetId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Target> { - let params: { userId: string, targetId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a messaging target. - * - * @param {string} params.userId - User ID. - * @param {string} params.targetId - Target ID. - * @param {string} params.identifier - The target identifier (token, email, phone etc.) - * @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. - * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - */ - updateTarget(params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }): Promise<Models.Target>; - /** - * Update a messaging target. - * - * @param {string} userId - User ID. - * @param {string} targetId - Target ID. - * @param {string} identifier - The target identifier (token, email, phone etc.) - * @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. - * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. - * @throws {AppwriteException} - * @returns {Promise<Models.Target>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise<Models.Target>; - updateTarget( - paramsOrFirst: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?] - ): Promise<Models.Target> { - let params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string, - identifier: rest[1] as string, - providerId: rest[2] as string, - name: rest[3] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - const identifier = params.identifier; - const providerId = params.providerId; - const name = params.name; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); - const payload: Payload = {}; - if (typeof identifier !== 'undefined') { - payload['identifier'] = identifier; - } - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a messaging target. - * - * @param {string} params.userId - User ID. - * @param {string} params.targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTarget(params: { userId: string, targetId: string }): Promise<{}>; - /** - * Delete a messaging target. - * - * @param {string} userId - User ID. - * @param {string} targetId - Target ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTarget(userId: string, targetId: string): Promise<{}>; - deleteTarget( - paramsOrFirst: { userId: string, targetId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { userId: string, targetId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, targetId: string }; - } else { - params = { - userId: paramsOrFirst as string, - targetId: rest[0] as string - }; - } - - const userId = params.userId; - const targetId = params.targetId; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof targetId === 'undefined') { - throw new AppwriteException('Missing required parameter: "targetId"'); - } - - const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - * - * - * @param {string} params.userId - User ID. - * @param {number} params.length - Token length in characters. The default length is 6 characters - * @param {number} params.expire - Token expiration period in seconds. The default expiration is 15 minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - */ - createToken(params: { userId: string, length?: number, expire?: number }): Promise<Models.Token>; - /** - * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. - * - * - * @param {string} userId - User ID. - * @param {number} length - Token length in characters. The default length is 6 characters - * @param {number} expire - Token expiration period in seconds. The default expiration is 15 minutes. - * @throws {AppwriteException} - * @returns {Promise<Models.Token>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createToken(userId: string, length?: number, expire?: number): Promise<Models.Token>; - createToken( - paramsOrFirst: { userId: string, length?: number, expire?: number } | string, - ...rest: [(number)?, (number)?] - ): Promise<Models.Token> { - let params: { userId: string, length?: number, expire?: number }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, length?: number, expire?: number }; - } else { - params = { - userId: paramsOrFirst as string, - length: rest[0] as number, - expire: rest[1] as number - }; - } - - const userId = params.userId; - const length = params.length; - const expire = params.expire; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - - const apiPath = '/users/{userId}/tokens'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof length !== 'undefined') { - payload['length'] = length; - } - if (typeof expire !== 'undefined') { - payload['expire'] = expire; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user email verification status by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.emailVerification - User email verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, emailVerification: boolean }): Promise<Models.User<Preferences>>; - /** - * Update the user email verification status by its unique ID. - * - * @param {string} userId - User ID. - * @param {boolean} emailVerification - User email verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>; - updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, emailVerification: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, emailVerification: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, emailVerification: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - emailVerification: rest[0] as boolean - }; - } - - const userId = params.userId; - const emailVerification = params.emailVerification; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof emailVerification === 'undefined') { - throw new AppwriteException('Missing required parameter: "emailVerification"'); - } - - const apiPath = '/users/{userId}/verification'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof emailVerification !== 'undefined') { - payload['emailVerification'] = emailVerification; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the user phone verification status by its unique ID. - * - * @param {string} params.userId - User ID. - * @param {boolean} params.phoneVerification - User phone verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - */ - updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, phoneVerification: boolean }): Promise<Models.User<Preferences>>; - /** - * Update the user phone verification status by its unique ID. - * - * @param {string} userId - User ID. - * @param {boolean} phoneVerification - User phone verification status. - * @throws {AppwriteException} - * @returns {Promise<Models.User<Preferences>>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>>; - updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( - paramsOrFirst: { userId: string, phoneVerification: boolean } | string, - ...rest: [(boolean)?] - ): Promise<Models.User<Preferences>> { - let params: { userId: string, phoneVerification: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { userId: string, phoneVerification: boolean }; - } else { - params = { - userId: paramsOrFirst as string, - phoneVerification: rest[0] as boolean - }; - } - - const userId = params.userId; - const phoneVerification = params.phoneVerification; - - if (typeof userId === 'undefined') { - throw new AppwriteException('Missing required parameter: "userId"'); - } - if (typeof phoneVerification === 'undefined') { - throw new AppwriteException('Missing required parameter: "phoneVerification"'); - } - - const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId); - const payload: Payload = {}; - if (typeof phoneVerification !== 'undefined') { - payload['phoneVerification'] = phoneVerification; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts deleted file mode 100644 index 796cc425..00000000 --- a/src/services/webhooks.ts +++ /dev/null @@ -1,466 +0,0 @@ -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - - -export class Webhooks { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. - * - * @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: name, url, authUsername, tls, events, enabled, logs, attempts - * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.WebhookList>} - */ - list(params?: { queries?: string[], total?: boolean }): Promise<Models.WebhookList>; - /** - * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. - * - * @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: name, url, authUsername, tls, events, enabled, logs, attempts - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.WebhookList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], total?: boolean): Promise<Models.WebhookList>; - list( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.WebhookList> { - let params: { queries?: string[], total?: boolean }; - - if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; - } else { - params = { - queries: paramsOrFirst as string[], - total: rest[0] as boolean - }; - } - - const queries = params.queries; - const total = params.total; - - - const apiPath = '/webhooks'; - const payload: Payload = {}; - if (typeof queries !== 'undefined') { - payload['queries'] = queries; - } - if (typeof total !== 'undefined') { - payload['total'] = total; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. - * - * @param {string} params.webhookId - Webhook 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. - * @param {string} params.url - Webhook URL. - * @param {string} params.name - Webhook name. Max length: 128 chars. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. - * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. - * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }): Promise<Models.Webhook>; - /** - * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. - * - * @param {string} webhookId - Webhook 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. - * @param {string} url - Webhook URL. - * @param {string} name - Webhook name. Max length: 128 chars. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {boolean} enabled - Enable or disable a webhook. - * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. - * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. - * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string): Promise<Models.Webhook>; - create( - paramsOrFirst: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?] - ): Promise<Models.Webhook> { - let params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; - } else { - params = { - webhookId: paramsOrFirst as string, - url: rest[0] as string, - name: rest[1] as string, - events: rest[2] as string[], - enabled: rest[3] as boolean, - tls: rest[4] as boolean, - authUsername: rest[5] as string, - authPassword: rest[6] as string, - secret: rest[7] as string - }; - } - - const webhookId = params.webhookId; - const url = params.url; - const name = params.name; - const events = params.events; - const enabled = params.enabled; - const tls = params.tls; - const authUsername = params.authUsername; - const authPassword = params.authPassword; - const secret = params.secret; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof events === 'undefined') { - throw new AppwriteException('Missing required parameter: "events"'); - } - - const apiPath = '/webhooks'; - const payload: Payload = {}; - if (typeof webhookId !== 'undefined') { - payload['webhookId'] = webhookId; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof tls !== 'undefined') { - payload['tls'] = tls; - } - if (typeof authUsername !== 'undefined') { - payload['authUsername'] = authUsername; - } - if (typeof authPassword !== 'undefined') { - payload['authPassword'] = authPassword; - } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload, - ); - } - - /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. - * - * @param {string} params.webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - get(params: { webhookId: string }): Promise<Models.Webhook>; - /** - * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. - * - * @param {string} webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(webhookId: string): Promise<Models.Webhook>; - get( - paramsOrFirst: { webhookId: string } | string - ): Promise<Models.Webhook> { - let params: { webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string }; - } else { - params = { - webhookId: paramsOrFirst as string - }; - } - - const webhookId = params.webhookId; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. - * - * @param {string} params.webhookId - Webhook ID. - * @param {string} params.name - Webhook name. Max length: 128 chars. - * @param {string} params.url - Webhook URL. - * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. - * @param {boolean} params.enabled - Enable or disable a webhook. - * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. - * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise<Models.Webhook>; - /** - * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. - * - * @param {string} webhookId - Webhook ID. - * @param {string} name - Webhook name. Max length: 128 chars. - * @param {string} url - Webhook URL. - * @param {string[]} events - Events list. Maximum of 100 events are allowed. - * @param {boolean} enabled - Enable or disable a webhook. - * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. - * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. - * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string): Promise<Models.Webhook>; - update( - paramsOrFirst: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string } | string, - ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] - ): Promise<Models.Webhook> { - let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; - } else { - params = { - webhookId: paramsOrFirst as string, - name: rest[0] as string, - url: rest[1] as string, - events: rest[2] as string[], - enabled: rest[3] as boolean, - tls: rest[4] as boolean, - authUsername: rest[5] as string, - authPassword: rest[6] as string - }; - } - - const webhookId = params.webhookId; - const name = params.name; - const url = params.url; - const events = params.events; - const enabled = params.enabled; - const tls = params.tls; - const authUsername = params.authUsername; - const authPassword = params.authPassword; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof url === 'undefined') { - throw new AppwriteException('Missing required parameter: "url"'); - } - if (typeof events === 'undefined') { - throw new AppwriteException('Missing required parameter: "events"'); - } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof url !== 'undefined') { - payload['url'] = url; - } - if (typeof events !== 'undefined') { - payload['events'] = events; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof tls !== 'undefined') { - payload['tls'] = tls; - } - if (typeof authUsername !== 'undefined') { - payload['authUsername'] = authUsername; - } - if (typeof authPassword !== 'undefined') { - payload['authPassword'] = authPassword; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload, - ); - } - - /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. - * - * @param {string} params.webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { webhookId: string }): Promise<{}>; - /** - * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. - * - * @param {string} webhookId - Webhook ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(webhookId: string): Promise<{}>; - delete( - paramsOrFirst: { webhookId: string } | string - ): Promise<{}> { - let params: { webhookId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string }; - } else { - params = { - webhookId: paramsOrFirst as string - }; - } - - const webhookId = params.webhookId; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload, - ); - } - - /** - * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. - * - * @param {string} params.webhookId - Webhook ID. - * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - */ - updateSecret(params: { webhookId: string, secret?: string }): Promise<Models.Webhook>; - /** - * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. - * - * @param {string} webhookId - Webhook ID. - * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. - * @throws {AppwriteException} - * @returns {Promise<Models.Webhook>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateSecret(webhookId: string, secret?: string): Promise<Models.Webhook>; - updateSecret( - paramsOrFirst: { webhookId: string, secret?: string } | string, - ...rest: [(string)?] - ): Promise<Models.Webhook> { - let params: { webhookId: string, secret?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { webhookId: string, secret?: string }; - } else { - params = { - webhookId: paramsOrFirst as string, - secret: rest[0] as string - }; - } - - const webhookId = params.webhookId; - const secret = params.secret; - - if (typeof webhookId === 'undefined') { - throw new AppwriteException('Missing required parameter: "webhookId"'); - } - - const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', webhookId); - const payload: Payload = {}; - if (typeof secret !== 'undefined') { - payload['secret'] = secret; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload, - ); - } -} diff --git a/test/id.test.js b/test/id.test.js deleted file mode 100644 index 0a648bc1..00000000 --- a/test/id.test.js +++ /dev/null @@ -1,6 +0,0 @@ -const { ID } = require("../dist/id"); - -describe("ID", () => { - test('unique', () => expect(ID.unique()).toHaveLength(20)); - test('custom', () => expect(ID.custom('custom')).toEqual('custom')); -}); diff --git a/test/operator.test.js b/test/operator.test.js deleted file mode 100644 index a14910cd..00000000 --- a/test/operator.test.js +++ /dev/null @@ -1,99 +0,0 @@ -const { Condition, Operator } = require("../dist/operator"); - -describe('Operator', () => { - test('returns increment', () => { - expect(Operator.increment(1)).toEqual(`{"method":"increment","values":[1]}`); - }); - - test('returns increment with max', () => { - expect(Operator.increment(5, 100)).toEqual(`{"method":"increment","values":[5,100]}`); - }); - - test('returns decrement', () => { - expect(Operator.decrement(1)).toEqual(`{"method":"decrement","values":[1]}`); - }); - - test('returns decrement with min', () => { - expect(Operator.decrement(3, 0)).toEqual(`{"method":"decrement","values":[3,0]}`); - }); - - test('returns multiply', () => { - expect(Operator.multiply(2)).toEqual(`{"method":"multiply","values":[2]}`); - }); - - test('returns multiply with max', () => { - expect(Operator.multiply(3, 1000)).toEqual(`{"method":"multiply","values":[3,1000]}`); - }); - - test('returns divide', () => { - expect(Operator.divide(2)).toEqual(`{"method":"divide","values":[2]}`); - }); - - test('returns divide with min', () => { - expect(Operator.divide(4, 1)).toEqual(`{"method":"divide","values":[4,1]}`); - }); - - test('returns modulo', () => { - expect(Operator.modulo(5)).toEqual(`{"method":"modulo","values":[5]}`); - }); - - test('returns power', () => { - expect(Operator.power(2)).toEqual(`{"method":"power","values":[2]}`); - }); - - test('returns arrayAppend', () => { - expect(Operator.arrayAppend(['item1', 'item2'])).toEqual('{"method":"arrayAppend","values":["item1","item2"]}'); - }); - - test('returns arrayPrepend', () => { - expect(Operator.arrayPrepend(['first', 'second'])).toEqual('{"method":"arrayPrepend","values":["first","second"]}'); - }); - - test('returns arrayInsert', () => { - expect(Operator.arrayInsert(0, 'newItem')).toEqual('{"method":"arrayInsert","values":[0,"newItem"]}'); - }); - - test('returns arrayRemove', () => { - expect(Operator.arrayRemove('oldItem')).toEqual('{"method":"arrayRemove","values":["oldItem"]}'); - }); - - test('returns arrayUnique', () => { - expect(Operator.arrayUnique()).toEqual('{"method":"arrayUnique","values":[]}'); - }); - - test('returns arrayIntersect', () => { - expect(Operator.arrayIntersect(['a', 'b', 'c'])).toEqual('{"method":"arrayIntersect","values":["a","b","c"]}'); - }); - - test('returns arrayDiff', () => { - expect(Operator.arrayDiff(['x', 'y'])).toEqual('{"method":"arrayDiff","values":["x","y"]}'); - }); - - test('returns arrayFilter', () => { - expect(Operator.arrayFilter(Condition.Equal, 'test')).toEqual('{"method":"arrayFilter","values":["equal","test"]}'); - }); - - test('returns stringConcat', () => { - expect(Operator.stringConcat('suffix')).toEqual('{"method":"stringConcat","values":["suffix"]}'); - }); - - test('returns stringReplace', () => { - expect(Operator.stringReplace('old', 'new')).toEqual('{"method":"stringReplace","values":["old","new"]}'); - }); - - test('returns toggle', () => { - expect(Operator.toggle()).toEqual('{"method":"toggle","values":[]}'); - }); - - test('returns dateAddDays', () => { - expect(Operator.dateAddDays(7)).toEqual('{"method":"dateAddDays","values":[7]}'); - }); - - test('returns dateSubDays', () => { - expect(Operator.dateSubDays(7)).toEqual('{"method":"dateSubDays","values":[7]}'); - }); - - test('returns dateSetNow', () => { - expect(Operator.dateSetNow()).toEqual('{"method":"dateSetNow","values":[]}'); - }); -}); diff --git a/test/permission.test.js b/test/permission.test.js deleted file mode 100644 index 7f972d3b..00000000 --- a/test/permission.test.js +++ /dev/null @@ -1,10 +0,0 @@ -const { Permission } = require("../dist/permission"); -const { Role } = require("../dist/role"); - -describe('Permission', () => { - test('read', () => expect(Permission.read(Role.any())).toEqual('read("any")')); - test('write', () => expect(Permission.write(Role.any())).toEqual('write("any")')); - test('create', () => expect(Permission.create(Role.any())).toEqual('create("any")')); - test('update', () => expect(Permission.update(Role.any())).toEqual('update("any")')); - test('delete', () => expect(Permission.delete(Role.any())).toEqual('delete("any")')); -}) diff --git a/test/query.test.js b/test/query.test.js deleted file mode 100644 index e539a1f6..00000000 --- a/test/query.test.js +++ /dev/null @@ -1,155 +0,0 @@ -const { Query } = require("../dist/query"); - -const tests = [ - { - description: 'with a string', - value: 's', - expectedValues: '["s"]' - }, - { - description: 'with a integer', - value: 1, - expectedValues: '[1]' - }, - { - description: 'with a double', - value: 1.2, - expectedValues: '[1.2]' - }, - { - description: 'with a whole number double', - value: 1.0, - expectedValues: '[1]' - }, - { - description: 'with a bool', - value: false, - expectedValues: '[false]' - }, - { - description: 'with a list', - value: ['a', 'b', 'c'], - expectedValues: '["a","b","c"]' - } -]; - -describe('Query', () => { - describe('basic filter equal', () => { - for (const t of tests) { - test(t.description, () => - expect(Query.equal("attr", t.value)) - .toEqual(`{"method":"equal","attribute":"attr","values":${t.expectedValues}}`) - ) - } - }) - - describe('basic filter notEqual', () => { - for (const t of tests) { - test(t.description, () => - expect(Query.notEqual("attr", t.value)) - .toEqual(`{"method":"notEqual","attribute":"attr","values":${t.expectedValues}}`) - ) - } - }); - - describe('basic filter lessThan', () => { - for (const t of tests) { - test(t.description, () => - expect(Query.lessThan("attr", t.value)) - .toEqual(`{"method":"lessThan","attribute":"attr","values":${t.expectedValues}}`) - ) - } - }); - - describe('basic filter lessThanEqual', () => { - for (const t of tests) { - test(t.description, () => - expect(Query.lessThanEqual("attr", t.value)) - .toEqual(`{"method":"lessThanEqual","attribute":"attr","values":${t.expectedValues}}`) - ) - } - }); - - describe('basic filter greaterThan', () => { - for (const t of tests) { - test(t.description, () => - expect(Query.greaterThan("attr", t.value)) - .toEqual(`{"method":"greaterThan","attribute":"attr","values":${t.expectedValues}}`) - ) - } - }); - - describe('basic filter greaterThanEqual', () => { - for (const t of tests) { - test(t.description, () => - expect(Query.greaterThanEqual("attr", t.value)) - .toEqual(`{"method":"greaterThanEqual","attribute":"attr","values":${t.expectedValues}}`) - ) - } - }); - - test('search', () => - expect(Query.search('attr', 'keyword1 keyword2')) - .toEqual(`{"method":"search","attribute":"attr","values":["keyword1 keyword2"]}`) - ); - - test('isNull', () => - expect(Query.isNull('attr')) - .toEqual(`{"method":"isNull","attribute":"attr"}`) - ); - - test('isNotNull', () => - expect(Query.isNotNull('attr')) - .toEqual(`{"method":"isNotNull","attribute":"attr"}`) - ); - - describe('between', () => { - test('with integers', () => - expect(Query.between('attr', 1, 2)) - .toEqual(`{"method":"between","attribute":"attr","values":[1,2]}`) - ); - test('with doubles', () => - expect(Query.between('attr', 1.2, 2.2)) - .toEqual(`{"method":"between","attribute":"attr","values":[1.2,2.2]}`) - ); - test('with strings', () => - expect(Query.between('attr',"a","z")) - .toEqual(`{"method":"between","attribute":"attr","values":["a","z"]}`) - ); - }); - - test('select', () => - expect(Query.select(['attr1', 'attr2'])) - .toEqual(`{"method":"select","values":["attr1","attr2"]}`) - ); - - test('orderAsc', () => - expect(Query.orderAsc('attr')) - .toEqual(`{"method":"orderAsc","attribute":"attr"}`) - ); - - test('orderDesc', () => - expect(Query.orderDesc('attr')) - .toEqual(`{"method":"orderDesc","attribute":"attr"}`) - ); - - test('cursorBefore', () => - expect(Query.cursorBefore('attr')) - .toEqual('{"method":"cursorBefore","values":["attr"]}') - ); - - test('cursorAfter', () => - expect(Query.cursorAfter('attr')) - .toEqual('{"method":"cursorAfter","values":["attr"]}') - ); - - test('limit', () => - expect(Query.limit(1)) - .toEqual('{"method":"limit","values":[1]}') - ); - - test('offset', () => - expect(Query.offset(1)) - .toEqual('{"method":"offset","values":[1]}') - ); -}) diff --git a/test/role.test.js b/test/role.test.js deleted file mode 100644 index 8f7420bd..00000000 --- a/test/role.test.js +++ /dev/null @@ -1,14 +0,0 @@ -const { Role } = require("../dist/role"); - -describe('Role', () => { - test('any', () => expect(Role.any()).toEqual('any')); - test('user without status', () => expect(Role.user('custom')).toEqual('user:custom')); - test('user with status', () => expect(Role.user('custom', 'verified')).toEqual('user:custom/verified')); - test('users without status', () => expect(Role.users()).toEqual('users')); - test('users with status', () => expect(Role.users('verified')).toEqual('users/verified')); - test('guests', () => expect(Role.guests()).toEqual('guests')); - test('team without role', () => expect(Role.team('custom')).toEqual('team:custom')) - test('team with role', () => expect(Role.team('custom', 'owner')).toEqual('team:custom/owner')) - test('member', () => expect(Role.member('custom')).toEqual('member:custom')) - test('label', () => expect(Role.label('admin')).toEqual('label:admin')) -}) diff --git a/test/services/account.test.js b/test/services/account.test.js deleted file mode 100644 index a9bbd59a..00000000 --- a/test/services/account.test.js +++ /dev/null @@ -1,1307 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Account } = require("../../dist/services/account"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Account', () => { - const client = new Client(); - const account = new Account(client); - - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.get( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.create( - '<USER_ID>', - 'email@example.com', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateEmail( - 'email@example.com', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listIdentities()', async () => { - const data = { - 'total': 5, - 'identities': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listIdentities( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteIdentity()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteIdentity( - '<IDENTITY_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createJWT()', async () => { - const data = { - 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createJWT( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listLogs( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMFA()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMFA( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMfaAuthenticator()', async () => { - const data = { - 'secret': '[SHARED_SECRET]', - 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMfaAuthenticator( - 'totp', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMFAAuthenticator()', async () => { - const data = { - 'secret': '[SHARED_SECRET]', - 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMFAAuthenticator( - 'totp', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMfaAuthenticator()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMfaAuthenticator( - 'totp', - '<OTP>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMFAAuthenticator()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMFAAuthenticator( - 'totp', - '<OTP>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteMfaAuthenticator()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteMfaAuthenticator( - 'totp', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteMFAAuthenticator()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteMFAAuthenticator( - 'totp', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMfaChallenge()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMfaChallenge( - 'email', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMFAChallenge()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'expire': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMFAChallenge( - 'email', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMfaChallenge()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMfaChallenge( - '<CHALLENGE_ID>', - '<OTP>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMFAChallenge()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMFAChallenge( - '<CHALLENGE_ID>', - '<OTP>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMfaFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listMfaFactors( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMFAFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listMFAFactors( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getMfaRecoveryCodes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getMFARecoveryCodes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMfaRecoveryCodes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMFARecoveryCodes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMfaRecoveryCodes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMFARecoveryCodes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateName()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateName( - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePassword()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePassword( - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePhone()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePhone( - '+12065550100', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPrefs()', async () => { - const data = {}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getPrefs( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePrefs()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePrefs( - {}, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createRecovery()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createRecovery( - 'email@example.com', - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateRecovery()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateRecovery( - '<USER_ID>', - '<SECRET>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listSessions()', async () => { - const data = { - 'total': 5, - 'sessions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.listSessions( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteSessions()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteSessions( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createAnonymousSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createAnonymousSession( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEmailPasswordSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createEmailPasswordSession( - 'email@example.com', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMagicURLSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateMagicURLSession( - '<USER_ID>', - '<SECRET>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePhoneSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePhoneSession( - '<USER_ID>', - '<SECRET>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createSession( - '<USER_ID>', - '<SECRET>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.getSession( - '<SESSION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateSession( - '<SESSION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteSession()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.deleteSession( - '<SESSION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateStatus( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEmailToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createEmailToken( - '<USER_ID>', - 'email@example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMagicURLToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createMagicURLToken( - '<USER_ID>', - 'email@example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createOAuth2Token()', async () => { - const data = 'https://example.com/'; - mockedFetch.mockImplementation(() => Response.redirect(data)); - - const response = await account.createOAuth2Token( - 'amazon', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPhoneToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createPhoneToken( - '<USER_ID>', - '+12065550100', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEmailVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createEmailVerification( - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createVerification( - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmailVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateEmailVerification( - '<USER_ID>', - '<SECRET>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updateVerification( - '<USER_ID>', - '<SECRET>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPhoneVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.createPhoneVerification( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePhoneVerification()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await account.updatePhoneVerification( - '<USER_ID>', - '<SECRET>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/activities.test.js b/test/services/activities.test.js deleted file mode 100644 index 667ecc56..00000000 --- a/test/services/activities.test.js +++ /dev/null @@ -1,73 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Activities } = require("../../dist/services/activities"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Activities', () => { - const client = new Client(); - const activities = new Activities(client); - - - test('test method listEvents()', async () => { - const data = { - 'total': 5, - 'events': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await activities.listEvents( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getEvent()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'userType': 'user', - 'userId': '610fc2f985ee0', - 'userEmail': 'john@appwrite.io', - 'userName': 'John Doe', - 'resourceParent': 'database/ID', - 'resourceType': 'collection', - 'resourceId': '610fc2f985ee0', - 'resource': 'collections/610fc2f985ee0', - 'event': 'account.sessions.create', - 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', - 'ip': '127.0.0.1', - 'mode': 'admin', - 'country': 'US', - 'time': '2020-10-15T06:38:00.000+00:00', - 'projectId': '610fc2f985ee0', - 'teamId': '610fc2f985ee0', - 'hostname': 'appwrite.io', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await activities.getEvent( - '<EVENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/advisor.test.js b/test/services/advisor.test.js deleted file mode 100644 index 5160f13e..00000000 --- a/test/services/advisor.test.js +++ /dev/null @@ -1,111 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Advisor } = require("../../dist/services/advisor"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Advisor', () => { - const client = new Client(); - const advisor = new Advisor(client); - - - test('test method listReports()', async () => { - const data = { - 'total': 5, - 'reports': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.listReports( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getReport()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'appId': '5e5ea5c16897e', - 'type': 'lighthouse', - 'title': 'Lighthouse audit for https://appwrite.io/', - 'summary': 'Performance score 78. 4 opportunities found.', - 'targetType': 'urls', - 'target': 'https://appwrite.io/', - 'categories': [], - 'insights': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.getReport( - '<REPORT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteReport()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.deleteReport( - '<REPORT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listInsights()', async () => { - const data = { - 'total': 5, - 'insights': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.listInsights( - '<REPORT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getInsight()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'reportId': '5e5ea5c16897e', - 'type': 'tablesDBIndex', - 'severity': 'warning', - 'status': 'active', - 'resourceType': 'databases', - 'resourceId': 'main', - 'parentResourceType': 'tables', - 'parentResourceId': 'orders', - 'title': 'Missing index on collection orders', - 'summary': 'Queries against `orders.status` are scanning the full collection.', - 'ctas': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await advisor.getInsight( - '<REPORT_ID>', - '<INSIGHT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/avatars.test.js b/test/services/avatars.test.js deleted file mode 100644 index ea4f3798..00000000 --- a/test/services/avatars.test.js +++ /dev/null @@ -1,123 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Avatars } = require("../../dist/services/avatars"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Avatars', () => { - const client = new Client(); - const avatars = new Avatars(client); - - - test('test method getBrowser()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getBrowser( - 'aa', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getCreditCard()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getCreditCard( - 'amex', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFavicon()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getFavicon( - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFlag()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getFlag( - 'af', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getImage()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getImage( - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getInitials()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getInitials( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQR()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getQR( - '<TEXT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getScreenshot()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await avatars.getScreenshot( - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/backups.test.js b/test/services/backups.test.js deleted file mode 100644 index c888402e..00000000 --- a/test/services/backups.test.js +++ /dev/null @@ -1,256 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Backups } = require("../../dist/services/backups"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Backups', () => { - const client = new Client(); - const backups = new Backups(client); - - - test('test method listArchives()', async () => { - const data = { - 'total': 5, - 'archives': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.listArchives( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createArchive()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.createArchive( - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getArchive()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'policyId': 'did8jx6ws45jana098ab7', - 'size': 100000, - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.getArchive( - '<ARCHIVE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteArchive()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.deleteArchive( - '<ARCHIVE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listPolicies()', async () => { - const data = { - 'total': 5, - 'policies': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.listPolicies( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.createPolicy( - '<POLICY_ID>', - [], - 1, - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.getPolicy( - '<POLICY_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'Hourly backups', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'services': [], - 'resources': [], - 'retention': 7, - 'schedule': '0 * * * *', - 'enabled': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.updatePolicy( - '<POLICY_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deletePolicy()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.deletePolicy( - '<POLICY_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createRestoration()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.createRestoration( - '<ARCHIVE_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listRestorations()', async () => { - const data = { - 'total': 5, - 'restorations': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.listRestorations( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getRestoration()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'archiveId': 'did8jx6ws45jana098ab7', - 'policyId': 'did8jx6ws45jana098ab7', - 'status': 'completed', - 'startedAt': '2020-10-15T06:38:00.000+00:00', - 'migrationId': 'did8jx6ws45jana098ab7', - 'services': [], - 'resources': [], - 'options': '{databases.database[{oldId, newId, newName}]}',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await backups.getRestoration( - '<RESTORATION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/databases.test.js b/test/services/databases.test.js deleted file mode 100644 index 241f44f8..00000000 --- a/test/services/databases.test.js +++ /dev/null @@ -1,1624 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Databases } = require("../../dist/services/databases"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Databases', () => { - const client = new Client(); - const databases = new Databases(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'databases': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.create( - '<DATABASE_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listTransactions()', async () => { - const data = { - 'total': 5, - 'transactions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.listTransactions( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createTransaction( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.getTransaction( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateTransaction( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteTransaction()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.deleteTransaction( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createOperations()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createOperations( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.get( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.update( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.delete( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listCollections()', async () => { - const data = { - 'total': 5, - 'collections': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.listCollections( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createCollection()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createCollection( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getCollection()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.getCollection( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateCollection()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Collection', - 'enabled': true, - 'documentSecurity': true, - 'attributes': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateCollection( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteCollection()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.deleteCollection( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listAttributes()', async () => { - const data = { - 'total': 5, - 'attributes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.listAttributes( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createBigIntAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createBigIntAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateBigIntAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateBigIntAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createBooleanAttribute()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createBooleanAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateBooleanAttribute()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateBooleanAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDatetimeAttribute()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createDatetimeAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDatetimeAttribute()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateDatetimeAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - '2020-10-15T06:38:00.000+00:00', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEmailAttribute()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createEmailAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmailAttribute()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateEmailAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - 'email@example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEnumAttribute()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createEnumAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - [], - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEnumAttribute()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateEnumAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - [], - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createFloatAttribute()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createFloatAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateFloatAttribute()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateFloatAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - 1.0, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createIntegerAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createIntegerAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateIntegerAttribute()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateIntegerAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createIpAttribute()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createIpAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateIpAttribute()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateIpAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createLineAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createLineAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateLineAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateLineAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createLongtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createLongtextAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateLongtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateLongtextAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMediumtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createMediumtextAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMediumtextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateMediumtextAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPointAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createPointAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePointAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updatePointAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPolygonAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createPolygonAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePolygonAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updatePolygonAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createRelationshipAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createRelationshipAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<RELATED_COLLECTION_ID>', - 'oneToOne', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateRelationshipAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedCollection': 'collection', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateRelationshipAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createStringAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createStringAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - 1, - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateStringAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateStringAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createTextAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTextAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateTextAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createUrlAttribute()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createUrlAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateUrlAttribute()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateUrlAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVarcharAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createVarcharAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - 1, - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateVarcharAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateVarcharAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getAttribute()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.getAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteAttribute()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.deleteAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.listDocuments( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createDocument( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<DOCUMENT_ID>', - {}, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createDocuments( - '<DATABASE_ID>', - '<COLLECTION_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method upsertDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.upsertDocuments( - '<DATABASE_ID>', - '<COLLECTION_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateDocuments( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteDocuments()', async () => { - const data = { - 'total': 5, - 'documents': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.deleteDocuments( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.getDocument( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<DOCUMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method upsertDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.upsertDocument( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<DOCUMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDocument()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.updateDocument( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<DOCUMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteDocument()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.deleteDocument( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<DOCUMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method decrementDocumentAttribute()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.decrementDocumentAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<DOCUMENT_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method incrementDocumentAttribute()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$collectionId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.incrementDocumentAttribute( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '<DOCUMENT_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listIndexes()', async () => { - const data = { - 'total': 5, - 'indexes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.listIndexes( - '<DATABASE_ID>', - '<COLLECTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.createIndex( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - 'key', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'attributes': [], - 'lengths': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.getIndex( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteIndex()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await databases.deleteIndex( - '<DATABASE_ID>', - '<COLLECTION_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/functions.test.js b/test/services/functions.test.js deleted file mode 100644 index f5e19c8d..00000000 --- a/test/services/functions.test.js +++ /dev/null @@ -1,751 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Functions } = require("../../dist/services/functions"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Functions', () => { - const client = new Client(); - const functions = new Functions(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'functions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.create( - '<FUNCTION_ID>', - '<NAME>', - 'node-14.5', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listRuntimes()', async () => { - const data = { - 'total': 5, - 'runtimes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listRuntimes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listSpecifications()', async () => { - const data = { - 'total': 5, - 'specifications': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listSpecifications( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.get( - '<FUNCTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.update( - '<FUNCTION_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.delete( - '<FUNCTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateFunctionDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'execute': [], - 'name': 'My Function', - 'enabled': true, - 'live': true, - 'logging': true, - 'runtime': 'python-3.8', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'scopes': [], - 'vars': [], - 'events': [], - 'schedule': '5 4 * * *', - 'timeout': 300, - 'entrypoint': 'index.js', - 'commands': 'npm install', - 'version': 'v2', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'functions/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.updateFunctionDeployment( - '<FUNCTION_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listDeployments()', async () => { - const data = { - 'total': 5, - 'deployments': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listDeployments( - '<FUNCTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.createDeployment( - '<FUNCTION_ID>', - InputFile.fromBuffer(new Uint8Array(0), 'image.png'), - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDuplicateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.createDuplicateDeployment( - '<FUNCTION_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTemplateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.createTemplateDeployment( - '<FUNCTION_ID>', - '<REPOSITORY>', - '<OWNER>', - '<ROOT_DIRECTORY>', - 'commit', - '<REFERENCE>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVcsDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.createVcsDeployment( - '<FUNCTION_ID>', - 'branch', - '<REFERENCE>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.getDeployment( - '<FUNCTION_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteDeployment()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.deleteDeployment( - '<FUNCTION_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getDeploymentDownload()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await functions.getDeploymentDownload( - '<FUNCTION_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDeploymentStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.updateDeploymentStatus( - '<FUNCTION_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listExecutions()', async () => { - const data = { - 'total': 5, - 'executions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listExecutions( - '<FUNCTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createExecution()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.createExecution( - '<FUNCTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getExecution()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.getExecution( - '<FUNCTION_ID>', - '<EXECUTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteExecution()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.deleteExecution( - '<FUNCTION_ID>', - '<EXECUTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listVariables()', async () => { - const data = { - 'total': 5, - 'variables': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.listVariables( - '<FUNCTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.createVariable( - '<FUNCTION_ID>', - '<VARIABLE_ID>', - '<KEY>', - '<VALUE>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.getVariable( - '<FUNCTION_ID>', - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.updateVariable( - '<FUNCTION_ID>', - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteVariable()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await functions.deleteVariable( - '<FUNCTION_ID>', - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/graphql.test.js b/test/services/graphql.test.js deleted file mode 100644 index da7e49bf..00000000 --- a/test/services/graphql.test.js +++ /dev/null @@ -1,40 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Graphql } = require("../../dist/services/graphql"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Graphql', () => { - const client = new Client(); - const graphql = new Graphql(client); - - - test('test method query()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await graphql.query( - {}, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method mutation()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await graphql.mutation( - {}, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/health.test.js b/test/services/health.test.js deleted file mode 100644 index 17f087e2..00000000 --- a/test/services/health.test.js +++ /dev/null @@ -1,368 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Health } = require("../../dist/services/health"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Health', () => { - const client = new Client(); - const health = new Health(client); - - - test('test method get()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.get( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getAntivirus()', async () => { - const data = { - 'version': '1.0.0', - 'status': 'online',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getAntivirus( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getCache()', async () => { - const data = { - 'total': 5, - 'statuses': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getCache( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getCertificate()', async () => { - const data = { - 'name': '/CN=www.google.com', - 'subjectSN': '', - 'issuerOrganisation': '', - 'validFrom': '1704200998', - 'validTo': '1711458597', - 'signatureTypeSN': 'RSA-SHA256',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getCertificate( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getConsolePausing()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getConsolePausing( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getDB()', async () => { - const data = { - 'total': 5, - 'statuses': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getDB( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPubSub()', async () => { - const data = { - 'total': 5, - 'statuses': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getPubSub( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueAudits()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueAudits( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueBuilds()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueBuilds( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueCertificates()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueCertificates( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueDatabases()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueDatabases( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueDeletes()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueDeletes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFailedJobs()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getFailedJobs( - 'v1-database', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueFunctions()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueFunctions( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueLogs()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueLogs( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueMails()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueMails( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueMessaging()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueMessaging( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueMigrations()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueMigrations( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueStatsResources()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueStatsResources( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueUsage()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueUsage( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getQueueWebhooks()', async () => { - const data = { - 'size': 8,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getQueueWebhooks( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getStorage()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getStorage( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getStorageLocal()', async () => { - const data = { - 'name': 'database', - 'ping': 128, - 'status': 'pass',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getStorageLocal( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getTime()', async () => { - const data = { - 'remoteTime': 1639490751, - 'localTime': 1639490844, - 'diff': 93,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await health.getTime( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/locale.test.js b/test/services/locale.test.js deleted file mode 100644 index 51ef111e..00000000 --- a/test/services/locale.test.js +++ /dev/null @@ -1,137 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Locale } = require("../../dist/services/locale"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Locale', () => { - const client = new Client(); - const locale = new Locale(client); - - - test('test method get()', async () => { - const data = { - 'ip': '127.0.0.1', - 'countryCode': 'US', - 'country': 'United States', - 'continentCode': 'NA', - 'continent': 'North America', - 'eu': true, - 'currency': 'USD',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.get( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listCodes()', async () => { - const data = { - 'total': 5, - 'localeCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCodes( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listContinents()', async () => { - const data = { - 'total': 5, - 'continents': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listContinents( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listCountries()', async () => { - const data = { - 'total': 5, - 'countries': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCountries( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listCountriesEU()', async () => { - const data = { - 'total': 5, - 'countries': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCountriesEU( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listCountriesPhones()', async () => { - const data = { - 'total': 5, - 'phones': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCountriesPhones( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listCurrencies()', async () => { - const data = { - 'total': 5, - 'currencies': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listCurrencies( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listLanguages()', async () => { - const data = { - 'total': 5, - 'languages': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await locale.listLanguages( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/messaging.test.js b/test/services/messaging.test.js deleted file mode 100644 index f327a32d..00000000 --- a/test/services/messaging.test.js +++ /dev/null @@ -1,1200 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Messaging } = require("../../dist/services/messaging"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Messaging', () => { - const client = new Client(); - const messaging = new Messaging(client); - - - test('test method listMessages()', async () => { - const data = { - 'total': 5, - 'messages': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listMessages( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createEmail( - '<MESSAGE_ID>', - '<SUBJECT>', - '<CONTENT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateEmail( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPush()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createPush( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePush()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updatePush( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSms()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSms( - '<MESSAGE_ID>', - '<CONTENT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSMS()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSMS( - '<MESSAGE_ID>', - '<CONTENT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSms()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSms( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSMS()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSMS( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getMessage()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'providerType': 'email', - 'topics': [], - 'users': [], - 'targets': [], - 'deliveredTotal': 1, - 'data': {}, - 'status': 'processing',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.getMessage( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.delete( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMessageLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listMessageLogs( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listTargets()', async () => { - const data = { - 'total': 5, - 'targets': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listTargets( - '<MESSAGE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listProviders()', async () => { - const data = { - 'total': 5, - 'providers': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listProviders( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createApnsProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createApnsProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createAPNSProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createAPNSProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateApnsProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateApnsProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateAPNSProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateAPNSProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createFcmProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createFcmProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createFCMProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createFCMProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateFcmProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateFcmProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateFCMProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateFCMProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMailgunProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createMailgunProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMailgunProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateMailgunProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMsg91Provider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createMsg91Provider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMsg91Provider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateMsg91Provider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createResendProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createResendProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateResendProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateResendProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSendgridProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSendgridProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSendgridProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSendgridProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSmtpProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSmtpProvider( - '<PROVIDER_ID>', - '<NAME>', - '<HOST>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSMTPProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSMTPProvider( - '<PROVIDER_ID>', - '<NAME>', - '<HOST>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSmtpProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSmtpProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSMTPProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateSMTPProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTelesignProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createTelesignProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTelesignProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTelesignProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTextmagicProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createTextmagicProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTextmagicProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTextmagicProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTwilioProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createTwilioProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTwilioProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTwilioProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVonageProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createVonageProvider( - '<PROVIDER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateVonageProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateVonageProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getProvider()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Mailgun', - 'provider': 'mailgun', - 'enabled': true, - 'type': 'sms', - 'credentials': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.getProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteProvider()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.deleteProvider( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listProviderLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listProviderLogs( - '<PROVIDER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listSubscriberLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listSubscriberLogs( - '<SUBSCRIBER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listTopics()', async () => { - const data = { - 'total': 5, - 'topics': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listTopics( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTopic()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createTopic( - '<TOPIC_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getTopic()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.getTopic( - '<TOPIC_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTopic()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'events', - 'emailTotal': 100, - 'smsTotal': 100, - 'pushTotal': 100, - 'subscribe': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.updateTopic( - '<TOPIC_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteTopic()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.deleteTopic( - '<TOPIC_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listTopicLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listTopicLogs( - '<TOPIC_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listSubscribers()', async () => { - const data = { - 'total': 5, - 'subscribers': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.listSubscribers( - '<TOPIC_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSubscriber()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': {}, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.createSubscriber( - '<TOPIC_ID>', - '<SUBSCRIBER_ID>', - '<TARGET_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getSubscriber()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'targetId': '259125845563242502', - 'target': {}, - 'userId': '5e5ea5c16897e', - 'userName': 'Aegon Targaryen', - 'topicId': '259125845563242502', - 'providerType': 'email',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.getSubscriber( - '<TOPIC_ID>', - '<SUBSCRIBER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteSubscriber()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await messaging.deleteSubscriber( - '<TOPIC_ID>', - '<SUBSCRIBER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/presences.test.js b/test/services/presences.test.js deleted file mode 100644 index 2b43154c..00000000 --- a/test/services/presences.test.js +++ /dev/null @@ -1,104 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Presences } = require("../../dist/services/presences"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Presences', () => { - const client = new Client(); - const presences = new Presences(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'presences': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.get( - '<PRESENCE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method upsert()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.upsert( - '<PRESENCE_ID>', - '<USER_ID>', - '<STATUS>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePresence()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'userId': '674af8f3e12a5f9ac0be', - 'source': 'HTTP',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.updatePresence( - '<PRESENCE_ID>', - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await presences.delete( - '<PRESENCE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/project.test.js b/test/services/project.test.js deleted file mode 100644 index 7a18b7e7..00000000 --- a/test/services/project.test.js +++ /dev/null @@ -1,2194 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Project } = require("../../dist/services/project"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Project', () => { - const client = new Client(); - const project = new Project(client); - - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.get( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.delete( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateAuthMethod()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateAuthMethod( - 'email-password', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listKeys()', async () => { - const data = { - 'total': 5, - 'keys': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listKeys( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createKey( - '<KEY_ID>', - '<NAME>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEphemeralKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createEphemeralKey( - [], - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getKey( - '<KEY_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateKey()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My API Key', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'scopes': [], - 'secret': '919c2d18fb5d4...a2ae413da83346ad2', - 'accessedAt': '2020-10-15T06:38:00.000+00:00', - 'sdks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateKey( - '<KEY_ID>', - '<NAME>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteKey()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deleteKey( - '<KEY_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateLabels()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateLabels( - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMockPhones()', async () => { - const data = { - 'total': 5, - 'mockNumbers': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listMockPhones( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMockPhone()', async () => { - const data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createMockPhone( - '+12065550100', - '<OTP>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getMockPhone()', async () => { - const data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getMockPhone( - '+12065550100', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMockPhone()', async () => { - const data = { - 'number': '+1612842323', - 'otp': '123456', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateMockPhone( - '+12065550100', - '<OTP>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteMockPhone()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deleteMockPhone( - '+12065550100', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listOAuth2Providers()', async () => { - const data = { - 'total': 5, - 'providers': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listOAuth2Providers( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Amazon()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', - 'clientSecret': '79ffe4000000000000000000000000000000000000000000000000000002de55',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Amazon( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Apple()', async () => { - const data = { - '\$id': 'apple', - 'enabled': true, - 'serviceId': 'ip.appwrite.app.web', - 'keyId': 'P4000000N8', - 'teamId': 'D4000000R6', - 'p8File': '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Apple( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Auth0()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'OaOkIA000000000000000000005KLSYq', - 'clientSecret': 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', - 'endpoint': 'example.us.auth0.com',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Auth0( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Authentik()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', - 'clientSecret': 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', - 'endpoint': 'example.authentik.com',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Authentik( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Autodesk()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '5zw90v00000000000000000000kVYXN7', - 'clientSecret': '7I000000000000MW',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Autodesk( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Bitbucket()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'key': 'Knt70000000000ByRc', - 'secret': 'NMfLZJ00000000000000000000TLQdDx',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Bitbucket( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Bitly()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'd95151000000000000000000000000000067af9b', - 'clientSecret': 'a13e250000000000000000000000000000d73095',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Bitly( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Box()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'deglcs00000000000000000000x2og6y', - 'clientSecret': 'OKM1f100000000000000000000eshEif',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Box( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Dailymotion()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'apiKey': '07a9000000000000067f', - 'apiSecret': 'a399a90000000000000000000000000000d90639',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Dailymotion( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Discord()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '950722000000343754', - 'clientSecret': 'YmPXnM000000000000000000002zFg5D',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Discord( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Disqus()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'publicKey': 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', - 'secretKey': 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Disqus( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Dropbox()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'appKey': 'jl000000000009t', - 'appSecret': 'g200000000000vw',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Dropbox( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Etsy()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'keyString': 'nsgzxh0000000000008j85a2', - 'sharedSecret': 'tp000000ru',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Etsy( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Facebook()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'appId': '260600000007694', - 'appSecret': '2d0b2800000000000000000000d38af4',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Facebook( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Figma()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'byay5H0000000000VtiI40', - 'clientSecret': 'yEpOYn0000000000000000004iIsU5',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Figma( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2FusionAuth()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'b2222c00-0000-0000-0000-000000862097', - 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', - 'endpoint': 'example.fusionauth.io',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2FusionAuth( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2GitHub()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'e4d87900000000540733', - 'clientSecret': '5e07c00000000000000000000000000000198bcc',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2GitHub( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Gitlab()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', - 'secret': 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', - 'endpoint': 'https://gitlab.com',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Gitlab( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Google()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', - 'clientSecret': 'example-google-client-secret', - 'prompt': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Google( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Keycloak()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'appwrite-o0000000st-app', - 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', - 'endpoint': 'keycloak.example.com', - 'realmName': 'appwrite-realm',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Keycloak( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Kick()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '01KQ7C00000000000001MFHS32', - 'clientSecret': '34ac5600000000000000000000000000000000000000000000000000e830c8b',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Kick( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Linkedin()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '770000000000dv', - 'primaryClientSecret': 'example-linkedin-client-secret',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Linkedin( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Microsoft()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', - 'tenant': 'common',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Microsoft( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Notion()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', - 'oauthClientSecret': 'secret_dLUr4b000000000000000000000000000000lFHAa9',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Notion( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Oidc()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', - 'clientSecret': 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', - 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', - 'authorizationURL': 'https://myoauth.com/oauth2/authorize', - 'tokenURL': 'https://myoauth.com/oauth2/token', - 'userInfoURL': 'https://myoauth.com/oauth2/userinfo',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Oidc( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Okta()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '0oa00000000000000698', - 'clientSecret': 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', - 'domain': 'trial-6400025.okta.com', - 'authorizationServerId': 'aus000000000000000h7z',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Okta( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Paypal()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Paypal( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2PaypalSandbox()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2PaypalSandbox( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Podio()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'appwrite-oauth-test-app', - 'clientSecret': 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Podio( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Salesforce()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'customerKey': '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', - 'customerSecret': '3w000000000000e2',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Salesforce( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Slack()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '23000000089.15000000000023', - 'clientSecret': '81656000000000000000000000f3d2fd',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Slack( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Spotify()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '6ec271000000000000000000009beace', - 'clientSecret': 'db068a000000000000000000008b5b9f',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Spotify( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Stripe()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'ca_UKibXX0000000000000000000006byvR', - 'apiSecretKey': 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Stripe( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Tradeshift()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Tradeshift( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2TradeshiftSandbox()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2TradeshiftSandbox( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Twitch()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'vvi0in000000000000000000ikmt9p', - 'clientSecret': 'pmapue000000000000000000zylw3v',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Twitch( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2WordPress()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '130005', - 'clientSecret': 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2WordPress( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2X()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'customerKey': 'slzZV0000000000000NFLaWT', - 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2X( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Yahoo()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', - 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Yahoo( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Yandex()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '6a8a6a0000000000000000000091483c', - 'clientSecret': 'bbf98500000000000000000000c75a63',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Yandex( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Zoho()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': '1000.83C178000000000000000000RPNX0B', - 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Zoho( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateOAuth2Zoom()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'clientId': 'QMAC00000000000000w0AQ', - 'clientSecret': 'GAWsG4000000000000000000007U01ON',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateOAuth2Zoom( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getOAuth2Provider()', async () => { - const data = { - '\$id': 'github', - 'enabled': true, - 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', - 'tenant': 'common',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getOAuth2Provider( - 'amazon', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listPlatforms()', async () => { - const data = { - 'total': 5, - 'platforms': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listPlatforms( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createAndroidPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createAndroidPlatform( - '<PLATFORM_ID>', - '<NAME>', - '<APPLICATION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateAndroidPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'applicationId': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateAndroidPlatform( - '<PLATFORM_ID>', - '<NAME>', - '<APPLICATION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createApplePlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createApplePlatform( - '<PLATFORM_ID>', - '<NAME>', - '<BUNDLE_IDENTIFIER>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateApplePlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'bundleIdentifier': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateApplePlatform( - '<PLATFORM_ID>', - '<NAME>', - '<BUNDLE_IDENTIFIER>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createLinuxPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createLinuxPlatform( - '<PLATFORM_ID>', - '<NAME>', - '<PACKAGE_NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateLinuxPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateLinuxPlatform( - '<PLATFORM_ID>', - '<NAME>', - '<PACKAGE_NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createWebPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createWebPlatform( - '<PLATFORM_ID>', - '<NAME>', - 'app.example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateWebPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'hostname': 'app.example.com',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateWebPlatform( - '<PLATFORM_ID>', - '<NAME>', - 'app.example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createWindowsPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createWindowsPlatform( - '<PLATFORM_ID>', - '<NAME>', - '<PACKAGE_IDENTIFIER_NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateWindowsPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageIdentifierName': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateWindowsPlatform( - '<PLATFORM_ID>', - '<NAME>', - '<PACKAGE_IDENTIFIER_NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPlatform()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Web App', - 'type': 'web', - 'packageName': 'com.company.appname',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getPlatform( - '<PLATFORM_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deletePlatform()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deletePlatform( - '<PLATFORM_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listPolicies()', async () => { - const data = { - 'total': 9, - 'policies': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listPolicies( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDenyAliasedEmailPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateDenyAliasedEmailPolicy( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDenyDisposableEmailPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateDenyDisposableEmailPolicy( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDenyFreeEmailPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateDenyFreeEmailPolicy( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMembershipPrivacyPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateMembershipPrivacyPolicy( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePasswordDictionaryPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updatePasswordDictionaryPolicy( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePasswordHistoryPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updatePasswordHistoryPolicy( - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePasswordPersonalDataPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updatePasswordPersonalDataPolicy( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSessionAlertPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionAlertPolicy( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSessionDurationPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionDurationPolicy( - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSessionInvalidationPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionInvalidationPolicy( - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSessionLimitPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSessionLimitPolicy( - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateUserLimitPolicy()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateUserLimitPolicy( - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPolicy()', async () => { - const data = { - '\$id': 'password-dictionary', - 'userId': true, - 'userEmail': true, - 'userPhone': true, - 'userName': true, - 'userMFA': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getPolicy( - 'password-dictionary', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateProtocol()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateProtocol( - 'rest', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateService()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateService( - 'account', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSMTP()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'New Project', - 'teamId': '1592981250', - 'devKeys': [], - 'smtpEnabled': true, - 'smtpSenderName': 'John Appwrite', - 'smtpSenderEmail': 'john@appwrite.io', - 'smtpReplyToName': 'Support Team', - 'smtpReplyToEmail': 'support@appwrite.io', - 'smtpHost': 'mail.appwrite.io', - 'smtpPort': 25, - 'smtpUsername': 'emailuser', - 'smtpPassword': '', - 'smtpSecure': 'tls', - 'pingCount': 1, - 'pingedAt': '2020-10-15T06:38:00.000+00:00', - 'labels': [], - 'status': 'active', - 'authMethods': [], - 'services': [], - 'protocols': [], - 'region': 'fra', - 'blocks': [], - 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateSMTP( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSMTPTest()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createSMTPTest( - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listEmailTemplates()', async () => { - const data = { - 'total': 5, - 'templates': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listEmailTemplates( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmailTemplate()', async () => { - const data = { - 'templateId': 'verification', - 'locale': 'en_us', - 'message': 'Click on the link to verify your account.', - 'senderName': 'My User', - 'senderEmail': 'mail@appwrite.io', - 'replyToEmail': 'emails@appwrite.io', - 'replyToName': 'Support Team', - 'subject': 'Please verify your email address',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateEmailTemplate( - 'verification', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getEmailTemplate()', async () => { - const data = { - 'templateId': 'verification', - 'locale': 'en_us', - 'message': 'Click on the link to verify your account.', - 'senderName': 'My User', - 'senderEmail': 'mail@appwrite.io', - 'replyToEmail': 'emails@appwrite.io', - 'replyToName': 'Support Team', - 'subject': 'Please verify your email address',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getEmailTemplate( - 'verification', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listVariables()', async () => { - const data = { - 'total': 5, - 'variables': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.listVariables( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.createVariable( - '<VARIABLE_ID>', - '<KEY>', - '<VALUE>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.getVariable( - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.updateVariable( - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteVariable()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await project.deleteVariable( - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/proxy.test.js b/test/services/proxy.test.js deleted file mode 100644 index 05a556ff..00000000 --- a/test/services/proxy.test.js +++ /dev/null @@ -1,215 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Proxy } = require("../../dist/services/proxy"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Proxy', () => { - const client = new Client(); - const proxy = new Proxy(client); - - - test('test method listRules()', async () => { - const data = { - 'total': 5, - 'rules': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.listRules( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createAPIRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.createAPIRule( - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createFunctionRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.createFunctionRule( - '', - '<FUNCTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createRedirectRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.createRedirectRule( - '', - 'https://example.com', - '301', - '<RESOURCE_ID>', - 'site', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSiteRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.createSiteRule( - '', - '<SITE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getRule()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.getRule( - '<RULE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteRule()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.deleteRule( - '<RULE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateRuleStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'domain': 'appwrite.company.com', - 'type': 'deployment', - 'trigger': 'manual', - 'redirectUrl': 'https://appwrite.io/docs', - 'redirectStatusCode': 301, - 'deploymentId': 'n3u9feiwmf', - 'deploymentResourceId': 'n3u9feiwmf', - 'deploymentVcsProviderBranch': 'main', - 'status': 'verified', - 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', - 'renewAt': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await proxy.updateRuleStatus( - '<RULE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/sites.test.js b/test/services/sites.test.js deleted file mode 100644 index 11e9f6da..00000000 --- a/test/services/sites.test.js +++ /dev/null @@ -1,729 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Sites } = require("../../dist/services/sites"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Sites', () => { - const client = new Client(); - const sites = new Sites(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'sites': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.create( - '<SITE_ID>', - '<NAME>', - 'analog', - 'node-14.5', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listFrameworks()', async () => { - const data = { - 'total': 5, - 'frameworks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listFrameworks( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listSpecifications()', async () => { - const data = { - 'total': 5, - 'specifications': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listSpecifications( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.get( - '<SITE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.update( - '<SITE_ID>', - '<NAME>', - 'analog', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.delete( - '<SITE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSiteDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Site', - 'enabled': true, - 'live': true, - 'logging': true, - 'framework': 'react', - 'deploymentRetention': 7, - 'deploymentId': '5e5ea5c16897e', - 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'deploymentScreenshotLight': '5e5ea5c16897e', - 'deploymentScreenshotDark': '5e5ea5c16897e', - 'latestDeploymentId': '5e5ea5c16897e', - 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', - 'latestDeploymentStatus': 'ready', - 'vars': [], - 'timeout': 300, - 'installCommand': 'npm install', - 'buildCommand': 'npm run build', - 'startCommand': 'node custom-server.mjs', - 'outputDirectory': 'build', - 'installationId': '6m40at4ejk5h2u9s1hboo', - 'providerRepositoryId': 'appwrite', - 'providerBranch': 'main', - 'providerRootDirectory': 'sites/helloWorld', - 'providerSilentMode': true, - 'buildSpecification': 's-1vcpu-512mb', - 'runtimeSpecification': 's-1vcpu-512mb', - 'buildRuntime': 'node-22', - 'adapter': 'static', - 'fallbackFile': 'index.html',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.updateSiteDeployment( - '<SITE_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listDeployments()', async () => { - const data = { - 'total': 5, - 'deployments': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listDeployments( - '<SITE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.createDeployment( - '<SITE_ID>', - InputFile.fromBuffer(new Uint8Array(0), 'image.png'), - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDuplicateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.createDuplicateDeployment( - '<SITE_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTemplateDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.createTemplateDeployment( - '<SITE_ID>', - '<REPOSITORY>', - '<OWNER>', - '<ROOT_DIRECTORY>', - 'branch', - '<REFERENCE>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVcsDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.createVcsDeployment( - '<SITE_ID>', - 'branch', - '<REFERENCE>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getDeployment()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.getDeployment( - '<SITE_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteDeployment()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.deleteDeployment( - '<SITE_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getDeploymentDownload()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await sites.getDeploymentDownload( - '<SITE_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDeploymentStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'type': 'vcs', - 'resourceId': '5e5ea6g16897e', - 'resourceType': 'functions', - 'entrypoint': 'index.js', - 'sourceSize': 128, - 'buildSize': 128, - 'totalSize': 128, - 'buildId': '5e5ea5c16897e', - 'activate': true, - 'screenshotLight': '5e5ea5c16897e', - 'screenshotDark': '5e5ea5c16897e', - 'status': 'ready', - 'buildLogs': 'Compiling source files...', - 'buildDuration': 128, - 'providerRepositoryName': 'database', - 'providerRepositoryOwner': 'utopia', - 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', - 'providerCommitHash': '7c3f25d', - 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', - 'providerCommitAuthor': 'Khushboo Verma', - 'providerCommitMessage': 'Update index.js', - 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', - 'providerBranch': '0.7.x', - 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.updateDeploymentStatus( - '<SITE_ID>', - '<DEPLOYMENT_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listLogs()', async () => { - const data = { - 'total': 5, - 'executions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listLogs( - '<SITE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getLog()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'functionId': '5e5ea6g16897e', - 'deploymentId': '5e5ea5c16897e', - 'trigger': 'http', - 'status': 'processing', - 'requestMethod': 'GET', - 'requestPath': '/articles?id=5', - 'requestHeaders': [], - 'responseStatusCode': 200, - 'responseBody': '', - 'responseHeaders': [], - 'logs': '', - 'errors': '', - 'duration': 0.4,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.getLog( - '<SITE_ID>', - '<LOG_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteLog()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.deleteLog( - '<SITE_ID>', - '<LOG_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listVariables()', async () => { - const data = { - 'total': 5, - 'variables': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.listVariables( - '<SITE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.createVariable( - '<SITE_ID>', - '<VARIABLE_ID>', - '<KEY>', - '<VALUE>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.getVariable( - '<SITE_ID>', - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateVariable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'API_KEY', - 'value': 'myPa\$\$word1', - 'secret': true, - 'resourceType': 'function', - 'resourceId': 'myAwesomeFunction',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.updateVariable( - '<SITE_ID>', - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteVariable()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await sites.deleteVariable( - '<SITE_ID>', - '<VARIABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/storage.test.js b/test/services/storage.test.js deleted file mode 100644 index 5b28529a..00000000 --- a/test/services/storage.test.js +++ /dev/null @@ -1,291 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Storage } = require("../../dist/services/storage"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Storage', () => { - const client = new Client(); - const storage = new Storage(client); - - - test('test method listBuckets()', async () => { - const data = { - 'total': 5, - 'buckets': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.listBuckets( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createBucket()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.createBucket( - '<BUCKET_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getBucket()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.getBucket( - '<BUCKET_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateBucket()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'fileSecurity': true, - 'name': 'Documents', - 'enabled': true, - 'maximumFileSize': 100, - 'allowedFileExtensions': [], - 'compression': 'gzip', - 'encryption': true, - 'antivirus': true, - 'transformations': true, - 'totalSize': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.updateBucket( - '<BUCKET_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteBucket()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.deleteBucket( - '<BUCKET_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listFiles()', async () => { - const data = { - 'total': 5, - 'files': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.listFiles( - '<BUCKET_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createFile()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'sizeActual': 12345, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.createFile( - '<BUCKET_ID>', - '<FILE_ID>', - InputFile.fromBuffer(new Uint8Array(0), 'image.png'), - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFile()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'sizeActual': 12345, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.getFile( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateFile()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'bucketId': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'name': 'Pink.png', - 'signature': '5d529fd02b544198ae075bd57c1762bb', - 'mimeType': 'image/png', - 'sizeOriginal': 17890, - 'sizeActual': 12345, - 'chunksTotal': 17890, - 'chunksUploaded': 17890, - 'encryption': true, - 'compression': 'gzip',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.updateFile( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteFile()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await storage.deleteFile( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFileDownload()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await storage.getFileDownload( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFilePreview()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await storage.getFilePreview( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getFileView()', async () => { - const data = new ArrayBuffer(0); - mockedFetch.mockImplementation(() => new Response(data)); - - const response = await storage.getFileView( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/tables-d-b.test.js b/test/services/tables-d-b.test.js deleted file mode 100644 index 5c89adc6..00000000 --- a/test/services/tables-d-b.test.js +++ /dev/null @@ -1,1624 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { TablesDB } = require("../../dist/services/tables-db"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('TablesDB', () => { - const client = new Client(); - const tablesDB = new TablesDB(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'databases': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.create( - '<DATABASE_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listTransactions()', async () => { - const data = { - 'total': 5, - 'transactions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listTransactions( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createTransaction( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getTransaction( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTransaction()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateTransaction( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteTransaction()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.deleteTransaction( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createOperations()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'status': 'pending', - 'operations': 5, - 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createOperations( - '<TRANSACTION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.get( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - 'name': 'My Database', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'enabled': true, - 'type': 'legacy', - 'policies': [], - 'archives': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.update( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.delete( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listTables()', async () => { - const data = { - 'total': 5, - 'tables': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listTables( - '<DATABASE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createTable( - '<DATABASE_ID>', - '<TABLE_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getTable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getTable( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTable()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [], - 'databaseId': '5e5ea5c16897e', - 'name': 'My Table', - 'enabled': true, - 'rowSecurity': true, - 'columns': [], - 'indexes': [], - 'bytesMax': 65535, - 'bytesUsed': 1500,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateTable( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteTable()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.deleteTable( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listColumns()', async () => { - const data = { - 'total': 5, - 'columns': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listColumns( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createBigIntColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createBigIntColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateBigIntColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'bigint', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateBigIntColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createBooleanColumn()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createBooleanColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateBooleanColumn()', async () => { - const data = { - 'key': 'isEnabled', - 'type': 'boolean', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateBooleanColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createDatetimeColumn()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createDatetimeColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateDatetimeColumn()', async () => { - const data = { - 'key': 'birthDay', - 'type': 'datetime', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'datetime',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateDatetimeColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - '2020-10-15T06:38:00.000+00:00', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEmailColumn()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createEmailColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmailColumn()', async () => { - const data = { - 'key': 'userEmail', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'email',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateEmailColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - 'email@example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createEnumColumn()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createEnumColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - [], - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEnumColumn()', async () => { - const data = { - 'key': 'status', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'elements': [], - 'format': 'enum',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateEnumColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - [], - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createFloatColumn()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createFloatColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateFloatColumn()', async () => { - const data = { - 'key': 'percentageCompleted', - 'type': 'double', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateFloatColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - 1.0, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createIntegerColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createIntegerColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateIntegerColumn()', async () => { - const data = { - 'key': 'count', - 'type': 'integer', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateIntegerColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createIpColumn()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createIpColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateIpColumn()', async () => { - const data = { - 'key': 'ipAddress', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'ip',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateIpColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createLineColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createLineColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateLineColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateLineColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createLongtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createLongtextColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateLongtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateLongtextColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMediumtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createMediumtextColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMediumtextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateMediumtextColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPointColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createPointColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePointColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updatePointColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPolygonColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createPolygonColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePolygonColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updatePolygonColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createRelationshipColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createRelationshipColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '<RELATED_TABLE_ID>', - 'oneToOne', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createStringColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createStringColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - 1, - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateStringColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateStringColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createTextColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTextColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateTextColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createUrlColumn()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createUrlColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateUrlColumn()', async () => { - const data = { - 'key': 'githubUrl', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'format': 'url',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateUrlColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - 'https://example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createVarcharColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createVarcharColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - 1, - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateVarcharColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateVarcharColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - true, - '<DEFAULT>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'size': 128,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteColumn()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.deleteColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateRelationshipColumn()', async () => { - const data = { - 'key': 'fullName', - 'type': 'string', - 'status': 'available', - 'error': 'string', - 'required': true, - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'relatedTable': 'table', - 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', - 'twoWay': true, - 'twoWayKey': 'string', - 'onDelete': 'restrict|cascade|setNull', - 'side': 'parent|child',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateRelationshipColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listIndexes()', async () => { - const data = { - 'total': 5, - 'indexes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listIndexes( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createIndex( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - 'key', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getIndex()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'key': 'index1', - 'type': 'primary', - 'status': 'available', - 'error': 'string', - 'columns': [], - 'lengths': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getIndex( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteIndex()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.deleteIndex( - '<DATABASE_ID>', - '<TABLE_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.listRows( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createRow( - '<DATABASE_ID>', - '<TABLE_ID>', - '<ROW_ID>', - {}, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.createRows( - '<DATABASE_ID>', - '<TABLE_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method upsertRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.upsertRows( - '<DATABASE_ID>', - '<TABLE_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateRows( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteRows()', async () => { - const data = { - 'total': 5, - 'rows': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.deleteRows( - '<DATABASE_ID>', - '<TABLE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.getRow( - '<DATABASE_ID>', - '<TABLE_ID>', - '<ROW_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method upsertRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.upsertRow( - '<DATABASE_ID>', - '<TABLE_ID>', - '<ROW_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateRow()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.updateRow( - '<DATABASE_ID>', - '<TABLE_ID>', - '<ROW_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteRow()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.deleteRow( - '<DATABASE_ID>', - '<TABLE_ID>', - '<ROW_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method decrementRowColumn()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.decrementRowColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '<ROW_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method incrementRowColumn()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$sequence': '1', - '\$tableId': '5e5ea5c15117e', - '\$databaseId': '5e5ea5c15117e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - '\$permissions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tablesDB.incrementRowColumn( - '<DATABASE_ID>', - '<TABLE_ID>', - '<ROW_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/teams.test.js b/test/services/teams.test.js deleted file mode 100644 index dcb4055b..00000000 --- a/test/services/teams.test.js +++ /dev/null @@ -1,282 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Teams } = require("../../dist/services/teams"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Teams', () => { - const client = new Client(); - const teams = new Teams(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'teams': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.create( - '<TEAM_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.get( - '<TEAM_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateName()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'VIP', - 'total': 7, - 'prefs': {},}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.updateName( - '<TEAM_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.delete( - '<TEAM_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMemberships()', async () => { - const data = { - 'total': 5, - 'memberships': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.listMemberships( - '<TEAM_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.createMembership( - '<TEAM_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.getMembership( - '<TEAM_ID>', - '<MEMBERSHIP_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMembership()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.updateMembership( - '<TEAM_ID>', - '<MEMBERSHIP_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteMembership()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.deleteMembership( - '<TEAM_ID>', - '<MEMBERSHIP_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMembershipStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c16897e', - 'userName': 'John Doe', - 'userEmail': 'john@appwrite.io', - 'userPhone': '+1 555 555 5555', - 'teamId': '5e5ea5c16897e', - 'teamName': 'VIP', - 'invited': '2020-10-15T06:38:00.000+00:00', - 'joined': '2020-10-15T06:38:00.000+00:00', - 'confirm': true, - 'mfa': true, - 'roles': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.updateMembershipStatus( - '<TEAM_ID>', - '<MEMBERSHIP_ID>', - '<USER_ID>', - '<SECRET>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPrefs()', async () => { - const data = {}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.getPrefs( - '<TEAM_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePrefs()', async () => { - const data = {}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await teams.updatePrefs( - '<TEAM_ID>', - {}, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/tokens.test.js b/test/services/tokens.test.js deleted file mode 100644 index 000f188e..00000000 --- a/test/services/tokens.test.js +++ /dev/null @@ -1,107 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Tokens } = require("../../dist/services/tokens"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Tokens', () => { - const client = new Client(); - const tokens = new Tokens(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'tokens': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.list( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createFileToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.createFileToken( - '<BUCKET_ID>', - '<FILE_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.get( - '<TOKEN_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method update()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', - 'resourceType': 'files', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.update( - '<TOKEN_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await tokens.delete( - '<TOKEN_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/usage.test.js b/test/services/usage.test.js deleted file mode 100644 index 0d0428fc..00000000 --- a/test/services/usage.test.js +++ /dev/null @@ -1,42 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Usage } = require("../../dist/services/usage"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Usage', () => { - const client = new Client(); - const usage = new Usage(client); - - - test('test method listEvents()', async () => { - const data = { - 'total': 5, - 'events': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await usage.listEvents( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listGauges()', async () => { - const data = { - 'total': 5, - 'gauges': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await usage.listGauges( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/users.test.js b/test/services/users.test.js deleted file mode 100644 index cb5441a2..00000000 --- a/test/services/users.test.js +++ /dev/null @@ -1,1145 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Users } = require("../../dist/services/users"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Users', () => { - const client = new Client(); - const users = new Users(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'users': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.create( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createArgon2User()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createArgon2User( - '<USER_ID>', - 'email@example.com', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createBcryptUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createBcryptUser( - '<USER_ID>', - 'email@example.com', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listIdentities()', async () => { - const data = { - 'total': 5, - 'identities': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listIdentities( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteIdentity()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteIdentity( - '<IDENTITY_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMD5User()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createMD5User( - '<USER_ID>', - 'email@example.com', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createPHPassUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createPHPassUser( - '<USER_ID>', - 'email@example.com', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createScryptUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createScryptUser( - '<USER_ID>', - 'email@example.com', - 'password', - '<PASSWORD_SALT>', - 1, - 1, - 1, - 1, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createScryptModifiedUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createScryptModifiedUser( - '<USER_ID>', - 'email@example.com', - 'password', - '<PASSWORD_SALT>', - '<PASSWORD_SALT_SEPARATOR>', - '<PASSWORD_SIGNER_KEY>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSHAUser()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createSHAUser( - '<USER_ID>', - 'email@example.com', - 'password', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.get( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.delete( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmail()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateEmail( - '<USER_ID>', - 'email@example.com', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateImpersonator()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateImpersonator( - '<USER_ID>', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createJWT()', async () => { - const data = { - 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createJWT( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateLabels()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateLabels( - '<USER_ID>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listLogs()', async () => { - const data = { - 'total': 5, - 'logs': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listLogs( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMemberships()', async () => { - const data = { - 'total': 5, - 'memberships': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listMemberships( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMfa()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMfa( - '<USER_ID>', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMFA()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMFA( - '<USER_ID>', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteMfaAuthenticator()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteMfaAuthenticator( - '<USER_ID>', - 'totp', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteMFAAuthenticator()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteMFAAuthenticator( - '<USER_ID>', - 'totp', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMfaFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listMfaFactors( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listMFAFactors()', async () => { - const data = { - 'totp': true, - 'phone': true, - 'email': true, - 'recoveryCode': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listMFAFactors( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getMfaRecoveryCodes( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getMFARecoveryCodes( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMfaRecoveryCodes( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateMFARecoveryCodes( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMfaRecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createMfaRecoveryCodes( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createMFARecoveryCodes()', async () => { - const data = { - 'recoveryCodes': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createMFARecoveryCodes( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateName()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateName( - '<USER_ID>', - '<NAME>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePassword()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePassword( - '<USER_ID>', - '', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePhone()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePhone( - '<USER_ID>', - '+12065550100', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getPrefs()', async () => { - const data = {}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getPrefs( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePrefs()', async () => { - const data = {}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePrefs( - '<USER_ID>', - {}, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listSessions()', async () => { - const data = { - 'total': 5, - 'sessions': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listSessions( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createSession()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5bb8c16897e', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'provider': 'email', - 'providerUid': 'user@example.com', - 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', - 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', - 'ip': '127.0.0.1', - 'osCode': 'Mac', - 'osName': 'Mac', - 'osVersion': 'Mac', - 'clientType': 'browser', - 'clientCode': 'CM', - 'clientName': 'Chrome Mobile iOS', - 'clientVersion': '84.0', - 'clientEngine': 'WebKit', - 'clientEngineVersion': '605.1.15', - 'deviceName': 'smartphone', - 'deviceBrand': 'Google', - 'deviceModel': 'Nexus 5', - 'countryCode': 'US', - 'countryName': 'United States', - 'current': true, - 'factors': [], - 'secret': '5e5bb8c16897e', - 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createSession( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteSessions()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteSessions( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteSession()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteSession( - '<USER_ID>', - '<SESSION_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateStatus()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateStatus( - '<USER_ID>', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method listTargets()', async () => { - const data = { - 'total': 5, - 'targets': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.listTargets( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createTarget()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createTarget( - '<USER_ID>', - '<TARGET_ID>', - 'email', - '<IDENTIFIER>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method getTarget()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.getTarget( - '<USER_ID>', - '<TARGET_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateTarget()', async () => { - const data = { - '\$id': '259125845563242502', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'Apple iPhone 12', - 'userId': '259125845563242502', - 'providerType': 'email', - 'identifier': 'token', - 'expired': true,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateTarget( - '<USER_ID>', - '<TARGET_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method deleteTarget()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.deleteTarget( - '<USER_ID>', - '<TARGET_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method createToken()', async () => { - const data = { - '\$id': 'bb8ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - 'userId': '5e5ea5c168bb8', - 'secret': '', - 'expire': '2020-10-15T06:38:00.000+00:00', - 'phrase': 'Golden Fox',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.createToken( - '<USER_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateEmailVerification()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updateEmailVerification( - '<USER_ID>', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updatePhoneVerification()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'John Doe', - 'registration': '2020-10-15T06:38:00.000+00:00', - 'status': true, - 'labels': [], - 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', - 'email': 'john@appwrite.io', - 'phone': '+4930901820', - 'emailVerification': true, - 'phoneVerification': true, - 'mfa': true, - 'prefs': {}, - 'targets': [], - 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await users.updatePhoneVerification( - '<USER_ID>', - true, - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/test/services/webhooks.test.js b/test/services/webhooks.test.js deleted file mode 100644 index 01e7abd3..00000000 --- a/test/services/webhooks.test.js +++ /dev/null @@ -1,155 +0,0 @@ -const { Client } = require("../../dist/client"); -const { InputFile } = require("../../dist/inputFile"); -const { Webhooks } = require("../../dist/services/webhooks"); - -const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); -jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); - -describe('Webhooks', () => { - const client = new Client(); - const webhooks = new Webhooks(client); - - - test('test method list()', async () => { - const data = { - 'total': 5, - 'webhooks': [],}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.list( - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method create()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.create( - '<WEBHOOK_ID>', - '', - '<NAME>', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method get()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.get( - '<WEBHOOK_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method update()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.update( - '<WEBHOOK_ID>', - '<NAME>', - '', - [], - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method delete()', async () => { - const data = {message: ""}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.delete( - '<WEBHOOK_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - - test('test method updateSecret()', async () => { - const data = { - '\$id': '5e5ea5c16897e', - '\$createdAt': '2020-10-15T06:38:00.000+00:00', - '\$updatedAt': '2020-10-15T06:38:00.000+00:00', - 'name': 'My Webhook', - 'url': 'https://example.com/webhook', - 'events': [], - 'tls': true, - 'authUsername': 'username', - 'authPassword': 'password', - 'secret': 'ad3d581ca230e2b7059c545e5a', - 'enabled': true, - 'logs': 'Failed to connect to remote server.', - 'attempts': 10,}; - mockedFetch.mockImplementation(() => Response.json(data)); - - const response = await webhooks.updateSecret( - '<WEBHOOK_ID>', - ); - - // Remove custom toString method on the objects to allow for clean data comparison. - delete response.toString; - - expect(response).toEqual(data); - }); - }) diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 45afe7d2..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "esModuleInterop": true, - "skipLibCheck": true, - "target": "es2017", - "allowJs": true, - "resolveJsonModule": true, - "moduleDetection": "force", - "isolatedModules": true, - "strict": true, - "module": "es2022", - "moduleResolution": "Bundler", - "lib": ["es2022"] - }, - "compileOnSave": false, - "exclude": ["node_modules", "dist"], - "include": ["src"] -} \ No newline at end of file diff --git a/tsup.config.ts b/tsup.config.ts deleted file mode 100644 index d39e2c54..00000000 --- a/tsup.config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { defineConfig, type Options } from "tsup"; -import { esbuildPluginFilePathExtensions } from "esbuild-plugin-file-path-extensions"; - -const commonConfig: Options = { - sourcemap: true, - clean: true, - dts: true, - treeshake: true, - target: "node16", - entry: ["src/**/*.ts"], - outDir: "dist", -}; - -export default defineConfig([ - { - ...commonConfig, - format: "esm", - esbuildPlugins: [esbuildPluginFilePathExtensions({ filter: /^\./ })], - bundle: true, - // Yes, bundle: true => https://github.com/favware/esbuild-plugin-file-path-extensions?tab=readme-ov-file#usage - }, - { - ...commonConfig, - format: "cjs", - bundle: false, - }, -]); From 7ff25d780590910d6b75e42e081198af219b6443 Mon Sep 17 00:00:00 2001 From: Prem Palanisamy <i.prem.tsd@gmail.com> Date: Wed, 27 May 2026 12:22:21 +0100 Subject: [PATCH 2/3] Revert "test regen" This reverts commit b9ec147eb66d2a63d5756f6b5444b375914391e0. --- .gitignore | 3 + .npmrc | 1 + CHANGELOG.md | 195 + LICENSE | 12 + README.md | 175 + .../account/create-anonymous-session.md | 12 + .../account/create-email-password-session.md | 15 + docs/examples/account/create-email-token.md | 16 + .../account/create-email-verification.md | 14 + docs/examples/account/create-jwt.md | 14 + .../account/create-magic-url-token.md | 17 + .../account/create-mfa-authenticator.md | 14 + docs/examples/account/create-mfa-challenge.md | 14 + .../account/create-mfa-recovery-codes.md | 12 + .../examples/account/create-o-auth-2-token.md | 17 + docs/examples/account/create-phone-token.md | 15 + .../account/create-phone-verification.md | 12 + docs/examples/account/create-recovery.md | 15 + docs/examples/account/create-session.md | 15 + docs/examples/account/create-verification.md | 14 + docs/examples/account/create.md | 17 + docs/examples/account/delete-identity.md | 14 + .../account/delete-mfa-authenticator.md | 14 + docs/examples/account/delete-session.md | 14 + docs/examples/account/delete-sessions.md | 12 + .../account/get-mfa-recovery-codes.md | 12 + docs/examples/account/get-prefs.md | 12 + docs/examples/account/get-session.md | 14 + docs/examples/account/get.md | 12 + docs/examples/account/list-identities.md | 15 + docs/examples/account/list-logs.md | 15 + docs/examples/account/list-mfa-factors.md | 12 + docs/examples/account/list-sessions.md | 12 + .../account/update-email-verification.md | 15 + docs/examples/account/update-email.md | 15 + .../account/update-magic-url-session.md | 15 + .../account/update-mfa-authenticator.md | 15 + docs/examples/account/update-mfa-challenge.md | 15 + .../account/update-mfa-recovery-codes.md | 12 + docs/examples/account/update-mfa.md | 14 + docs/examples/account/update-name.md | 14 + docs/examples/account/update-password.md | 15 + docs/examples/account/update-phone-session.md | 15 + .../account/update-phone-verification.md | 15 + docs/examples/account/update-phone.md | 15 + docs/examples/account/update-prefs.md | 18 + docs/examples/account/update-recovery.md | 16 + docs/examples/account/update-session.md | 14 + docs/examples/account/update-status.md | 12 + docs/examples/account/update-verification.md | 15 + docs/examples/activities/get-event.md | 14 + docs/examples/activities/list-events.md | 14 + docs/examples/advisor/delete-report.md | 14 + docs/examples/advisor/get-insight.md | 15 + docs/examples/advisor/get-report.md | 14 + docs/examples/advisor/list-insights.md | 16 + docs/examples/advisor/list-reports.md | 15 + docs/examples/avatars/get-browser.md | 17 + docs/examples/avatars/get-credit-card.md | 17 + docs/examples/avatars/get-favicon.md | 14 + docs/examples/avatars/get-flag.md | 17 + docs/examples/avatars/get-image.md | 16 + docs/examples/avatars/get-initials.md | 17 + docs/examples/avatars/get-qr.md | 17 + docs/examples/avatars/get-screenshot.md | 36 + docs/examples/backups/create-archive.md | 15 + docs/examples/backups/create-policy.md | 20 + docs/examples/backups/create-restoration.md | 17 + docs/examples/backups/delete-archive.md | 14 + docs/examples/backups/delete-policy.md | 14 + docs/examples/backups/get-archive.md | 14 + docs/examples/backups/get-policy.md | 14 + docs/examples/backups/get-restoration.md | 14 + docs/examples/backups/list-archives.md | 14 + docs/examples/backups/list-policies.md | 14 + docs/examples/backups/list-restorations.md | 14 + docs/examples/backups/update-policy.md | 18 + .../databases/create-big-int-attribute.md | 21 + .../databases/create-boolean-attribute.md | 19 + docs/examples/databases/create-collection.md | 21 + .../databases/create-datetime-attribute.md | 19 + docs/examples/databases/create-document.md | 25 + docs/examples/databases/create-documents.md | 17 + .../databases/create-email-attribute.md | 19 + .../databases/create-enum-attribute.md | 20 + .../databases/create-float-attribute.md | 21 + docs/examples/databases/create-index.md | 20 + .../databases/create-integer-attribute.md | 21 + .../examples/databases/create-ip-attribute.md | 19 + .../databases/create-line-attribute.md | 18 + .../databases/create-longtext-attribute.md | 20 + .../databases/create-mediumtext-attribute.md | 20 + docs/examples/databases/create-operations.md | 25 + .../databases/create-point-attribute.md | 18 + .../databases/create-polygon-attribute.md | 18 + .../create-relationship-attribute.md | 21 + .../databases/create-string-attribute.md | 21 + .../databases/create-text-attribute.md | 20 + docs/examples/databases/create-transaction.md | 14 + .../databases/create-url-attribute.md | 19 + .../databases/create-varchar-attribute.md | 21 + docs/examples/databases/create.md | 16 + .../databases/decrement-document-attribute.md | 20 + docs/examples/databases/delete-attribute.md | 16 + docs/examples/databases/delete-collection.md | 15 + docs/examples/databases/delete-document.md | 17 + docs/examples/databases/delete-documents.md | 17 + docs/examples/databases/delete-index.md | 16 + docs/examples/databases/delete-transaction.md | 14 + docs/examples/databases/delete.md | 14 + docs/examples/databases/get-attribute.md | 16 + docs/examples/databases/get-collection.md | 15 + docs/examples/databases/get-document.md | 18 + docs/examples/databases/get-index.md | 16 + docs/examples/databases/get-transaction.md | 14 + docs/examples/databases/get.md | 14 + .../databases/increment-document-attribute.md | 20 + docs/examples/databases/list-attributes.md | 17 + docs/examples/databases/list-collections.md | 17 + docs/examples/databases/list-documents.md | 19 + docs/examples/databases/list-indexes.md | 17 + docs/examples/databases/list-transactions.md | 14 + docs/examples/databases/list.md | 16 + .../databases/update-big-int-attribute.md | 21 + .../databases/update-boolean-attribute.md | 19 + docs/examples/databases/update-collection.md | 20 + .../databases/update-datetime-attribute.md | 19 + docs/examples/databases/update-document.md | 25 + docs/examples/databases/update-documents.md | 24 + .../databases/update-email-attribute.md | 19 + .../databases/update-enum-attribute.md | 20 + .../databases/update-float-attribute.md | 21 + .../databases/update-integer-attribute.md | 21 + .../examples/databases/update-ip-attribute.md | 19 + .../databases/update-line-attribute.md | 19 + .../databases/update-longtext-attribute.md | 19 + .../databases/update-mediumtext-attribute.md | 19 + .../databases/update-point-attribute.md | 19 + .../databases/update-polygon-attribute.md | 19 + .../update-relationship-attribute.md | 18 + .../databases/update-string-attribute.md | 20 + .../databases/update-text-attribute.md | 19 + docs/examples/databases/update-transaction.md | 16 + .../databases/update-url-attribute.md | 19 + .../databases/update-varchar-attribute.md | 20 + docs/examples/databases/update.md | 16 + docs/examples/databases/upsert-document.md | 25 + docs/examples/databases/upsert-documents.md | 17 + docs/examples/functions/create-deployment.md | 19 + .../functions/create-duplicate-deployment.md | 16 + docs/examples/functions/create-execution.md | 20 + .../functions/create-template-deployment.md | 20 + docs/examples/functions/create-variable.md | 18 + .../functions/create-vcs-deployment.md | 17 + docs/examples/functions/create.md | 33 + docs/examples/functions/delete-deployment.md | 15 + docs/examples/functions/delete-execution.md | 15 + docs/examples/functions/delete-variable.md | 15 + docs/examples/functions/delete.md | 14 + .../functions/get-deployment-download.md | 16 + docs/examples/functions/get-deployment.md | 15 + docs/examples/functions/get-execution.md | 15 + docs/examples/functions/get-variable.md | 15 + docs/examples/functions/get.md | 14 + docs/examples/functions/list-deployments.md | 17 + docs/examples/functions/list-executions.md | 16 + docs/examples/functions/list-runtimes.md | 12 + .../examples/functions/list-specifications.md | 12 + docs/examples/functions/list-variables.md | 16 + docs/examples/functions/list.md | 16 + .../functions/update-deployment-status.md | 15 + .../functions/update-function-deployment.md | 15 + docs/examples/functions/update-variable.md | 18 + docs/examples/functions/update.md | 33 + docs/examples/graphql/mutation.md | 14 + docs/examples/graphql/query.md | 14 + docs/examples/health/get-antivirus.md | 12 + docs/examples/health/get-cache.md | 12 + docs/examples/health/get-certificate.md | 14 + docs/examples/health/get-console-pausing.md | 15 + docs/examples/health/get-db.md | 12 + docs/examples/health/get-failed-jobs.md | 15 + docs/examples/health/get-pub-sub.md | 12 + docs/examples/health/get-queue-audits.md | 14 + docs/examples/health/get-queue-builds.md | 14 + .../examples/health/get-queue-certificates.md | 14 + docs/examples/health/get-queue-databases.md | 15 + docs/examples/health/get-queue-deletes.md | 14 + docs/examples/health/get-queue-functions.md | 14 + docs/examples/health/get-queue-logs.md | 14 + docs/examples/health/get-queue-mails.md | 14 + docs/examples/health/get-queue-messaging.md | 14 + docs/examples/health/get-queue-migrations.md | 14 + .../health/get-queue-stats-resources.md | 14 + docs/examples/health/get-queue-usage.md | 14 + docs/examples/health/get-queue-webhooks.md | 14 + docs/examples/health/get-storage-local.md | 12 + docs/examples/health/get-storage.md | 12 + docs/examples/health/get-time.md | 12 + docs/examples/health/get.md | 12 + docs/examples/locale/get.md | 12 + docs/examples/locale/list-codes.md | 12 + docs/examples/locale/list-continents.md | 12 + docs/examples/locale/list-countries-eu.md | 12 + docs/examples/locale/list-countries-phones.md | 12 + docs/examples/locale/list-countries.md | 12 + docs/examples/locale/list-currencies.md | 12 + docs/examples/locale/list-languages.md | 12 + .../messaging/create-apns-provider.md | 21 + docs/examples/messaging/create-email.md | 25 + .../examples/messaging/create-fcm-provider.md | 17 + .../messaging/create-mailgun-provider.md | 23 + .../messaging/create-msg-91-provider.md | 19 + docs/examples/messaging/create-push.md | 32 + .../messaging/create-resend-provider.md | 21 + .../messaging/create-sendgrid-provider.md | 21 + docs/examples/messaging/create-sms.md | 20 + .../messaging/create-smtp-provider.md | 27 + docs/examples/messaging/create-subscriber.md | 16 + .../messaging/create-telesign-provider.md | 19 + .../messaging/create-textmagic-provider.md | 19 + docs/examples/messaging/create-topic.md | 16 + .../messaging/create-twilio-provider.md | 19 + .../messaging/create-vonage-provider.md | 19 + docs/examples/messaging/delete-provider.md | 14 + docs/examples/messaging/delete-subscriber.md | 15 + docs/examples/messaging/delete-topic.md | 14 + docs/examples/messaging/delete.md | 14 + docs/examples/messaging/get-message.md | 14 + docs/examples/messaging/get-provider.md | 14 + docs/examples/messaging/get-subscriber.md | 15 + docs/examples/messaging/get-topic.md | 14 + docs/examples/messaging/list-message-logs.md | 16 + docs/examples/messaging/list-messages.md | 16 + docs/examples/messaging/list-provider-logs.md | 16 + docs/examples/messaging/list-providers.md | 16 + .../messaging/list-subscriber-logs.md | 16 + docs/examples/messaging/list-subscribers.md | 17 + docs/examples/messaging/list-targets.md | 16 + docs/examples/messaging/list-topic-logs.md | 16 + docs/examples/messaging/list-topics.md | 16 + .../messaging/update-apns-provider.md | 21 + docs/examples/messaging/update-email.md | 25 + .../examples/messaging/update-fcm-provider.md | 17 + .../messaging/update-mailgun-provider.md | 23 + .../messaging/update-msg-91-provider.md | 19 + docs/examples/messaging/update-push.md | 32 + .../messaging/update-resend-provider.md | 21 + .../messaging/update-sendgrid-provider.md | 21 + docs/examples/messaging/update-sms.md | 20 + .../messaging/update-smtp-provider.md | 27 + .../messaging/update-telesign-provider.md | 19 + .../messaging/update-textmagic-provider.md | 19 + docs/examples/messaging/update-topic.md | 16 + .../messaging/update-twilio-provider.md | 19 + .../messaging/update-vonage-provider.md | 19 + docs/examples/presences/delete.md | 14 + docs/examples/presences/get.md | 14 + docs/examples/presences/list.md | 16 + docs/examples/presences/update-presence.md | 20 + docs/examples/presences/upsert.md | 19 + .../project/create-android-platform.md | 16 + .../examples/project/create-apple-platform.md | 16 + docs/examples/project/create-ephemeral-key.md | 15 + docs/examples/project/create-key.md | 17 + .../examples/project/create-linux-platform.md | 16 + docs/examples/project/create-mock-phone.md | 15 + docs/examples/project/create-smtp-test.md | 14 + docs/examples/project/create-variable.md | 17 + docs/examples/project/create-web-platform.md | 16 + .../project/create-windows-platform.md | 16 + docs/examples/project/delete-key.md | 14 + docs/examples/project/delete-mock-phone.md | 14 + docs/examples/project/delete-platform.md | 14 + docs/examples/project/delete-variable.md | 14 + docs/examples/project/delete.md | 12 + docs/examples/project/get-email-template.md | 15 + docs/examples/project/get-key.md | 14 + docs/examples/project/get-mock-phone.md | 14 + .../examples/project/get-o-auth-2-provider.md | 14 + docs/examples/project/get-platform.md | 14 + docs/examples/project/get-policy.md | 14 + docs/examples/project/get-variable.md | 14 + docs/examples/project/get.md | 12 + docs/examples/project/list-email-templates.md | 15 + docs/examples/project/list-keys.md | 15 + docs/examples/project/list-mock-phones.md | 15 + .../project/list-o-auth-2-providers.md | 15 + docs/examples/project/list-platforms.md | 15 + docs/examples/project/list-policies.md | 15 + docs/examples/project/list-variables.md | 15 + .../project/update-android-platform.md | 16 + .../examples/project/update-apple-platform.md | 16 + docs/examples/project/update-auth-method.md | 15 + .../update-deny-aliased-email-policy.md | 14 + .../update-deny-disposable-email-policy.md | 14 + .../project/update-deny-free-email-policy.md | 14 + .../examples/project/update-email-template.md | 21 + docs/examples/project/update-key.md | 17 + docs/examples/project/update-labels.md | 14 + .../examples/project/update-linux-platform.md | 16 + .../update-membership-privacy-policy.md | 18 + docs/examples/project/update-mock-phone.md | 15 + .../project/update-o-auth-2-amazon.md | 16 + .../examples/project/update-o-auth-2-apple.md | 18 + .../project/update-o-auth-2-auth-0.md | 17 + .../project/update-o-auth-2-authentik.md | 17 + .../project/update-o-auth-2-autodesk.md | 16 + .../project/update-o-auth-2-bitbucket.md | 16 + .../examples/project/update-o-auth-2-bitly.md | 16 + docs/examples/project/update-o-auth-2-box.md | 16 + .../project/update-o-auth-2-dailymotion.md | 16 + .../project/update-o-auth-2-discord.md | 16 + .../project/update-o-auth-2-disqus.md | 16 + .../project/update-o-auth-2-dropbox.md | 16 + docs/examples/project/update-o-auth-2-etsy.md | 16 + .../project/update-o-auth-2-facebook.md | 16 + .../examples/project/update-o-auth-2-figma.md | 16 + .../project/update-o-auth-2-fusion-auth.md | 17 + .../project/update-o-auth-2-git-hub.md | 16 + .../project/update-o-auth-2-gitlab.md | 17 + .../project/update-o-auth-2-google.md | 17 + .../project/update-o-auth-2-keycloak.md | 18 + docs/examples/project/update-o-auth-2-kick.md | 16 + .../project/update-o-auth-2-linkedin.md | 16 + .../project/update-o-auth-2-microsoft.md | 17 + .../project/update-o-auth-2-notion.md | 16 + docs/examples/project/update-o-auth-2-oidc.md | 20 + docs/examples/project/update-o-auth-2-okta.md | 18 + .../project/update-o-auth-2-paypal-sandbox.md | 16 + .../project/update-o-auth-2-paypal.md | 16 + .../examples/project/update-o-auth-2-podio.md | 16 + .../project/update-o-auth-2-salesforce.md | 16 + .../examples/project/update-o-auth-2-slack.md | 16 + .../project/update-o-auth-2-spotify.md | 16 + .../project/update-o-auth-2-stripe.md | 16 + .../update-o-auth-2-tradeshift-sandbox.md | 16 + .../project/update-o-auth-2-tradeshift.md | 16 + .../project/update-o-auth-2-twitch.md | 16 + .../project/update-o-auth-2-word-press.md | 16 + .../examples/project/update-o-auth-2-yahoo.md | 16 + .../project/update-o-auth-2-yandex.md | 16 + docs/examples/project/update-o-auth-2-zoho.md | 16 + docs/examples/project/update-o-auth-2-zoom.md | 16 + docs/examples/project/update-o-auth-2x.md | 16 + .../update-password-dictionary-policy.md | 14 + .../project/update-password-history-policy.md | 14 + .../update-password-personal-data-policy.md | 14 + docs/examples/project/update-protocol.md | 15 + docs/examples/project/update-service.md | 15 + .../project/update-session-alert-policy.md | 14 + .../project/update-session-duration-policy.md | 14 + .../update-session-invalidation-policy.md | 14 + .../project/update-session-limit-policy.md | 14 + docs/examples/project/update-smtp.md | 23 + .../project/update-user-limit-policy.md | 14 + docs/examples/project/update-variable.md | 17 + docs/examples/project/update-web-platform.md | 16 + .../project/update-windows-platform.md | 16 + docs/examples/proxy/create-api-rule.md | 14 + docs/examples/proxy/create-function-rule.md | 16 + docs/examples/proxy/create-redirect-rule.md | 18 + docs/examples/proxy/create-site-rule.md | 16 + docs/examples/proxy/delete-rule.md | 14 + docs/examples/proxy/get-rule.md | 14 + docs/examples/proxy/list-rules.md | 15 + docs/examples/proxy/update-rule-status.md | 14 + docs/examples/sites/create-deployment.md | 20 + .../sites/create-duplicate-deployment.md | 15 + .../sites/create-template-deployment.md | 20 + docs/examples/sites/create-variable.md | 18 + docs/examples/sites/create-vcs-deployment.md | 17 + docs/examples/sites/create.md | 34 + docs/examples/sites/delete-deployment.md | 15 + docs/examples/sites/delete-log.md | 15 + docs/examples/sites/delete-variable.md | 15 + docs/examples/sites/delete.md | 14 + .../examples/sites/get-deployment-download.md | 16 + docs/examples/sites/get-deployment.md | 15 + docs/examples/sites/get-log.md | 15 + docs/examples/sites/get-variable.md | 15 + docs/examples/sites/get.md | 14 + docs/examples/sites/list-deployments.md | 17 + docs/examples/sites/list-frameworks.md | 12 + docs/examples/sites/list-logs.md | 16 + docs/examples/sites/list-specifications.md | 12 + docs/examples/sites/list-variables.md | 16 + docs/examples/sites/list.md | 16 + .../sites/update-deployment-status.md | 15 + docs/examples/sites/update-site-deployment.md | 15 + docs/examples/sites/update-variable.md | 18 + docs/examples/sites/update.md | 34 + docs/examples/storage/create-bucket.md | 24 + docs/examples/storage/create-file.md | 18 + docs/examples/storage/delete-bucket.md | 14 + docs/examples/storage/delete-file.md | 15 + docs/examples/storage/get-bucket.md | 14 + docs/examples/storage/get-file-download.md | 16 + docs/examples/storage/get-file-preview.md | 27 + docs/examples/storage/get-file-view.md | 16 + docs/examples/storage/get-file.md | 15 + docs/examples/storage/list-buckets.md | 16 + docs/examples/storage/list-files.md | 17 + docs/examples/storage/update-bucket.md | 24 + docs/examples/storage/update-file.md | 17 + .../tablesdb/create-big-int-column.md | 21 + .../tablesdb/create-boolean-column.md | 19 + .../tablesdb/create-datetime-column.md | 19 + docs/examples/tablesdb/create-email-column.md | 19 + docs/examples/tablesdb/create-enum-column.md | 20 + docs/examples/tablesdb/create-float-column.md | 21 + docs/examples/tablesdb/create-index.md | 20 + .../tablesdb/create-integer-column.md | 21 + docs/examples/tablesdb/create-ip-column.md | 19 + docs/examples/tablesdb/create-line-column.md | 18 + .../tablesdb/create-longtext-column.md | 20 + .../tablesdb/create-mediumtext-column.md | 20 + docs/examples/tablesdb/create-operations.md | 25 + docs/examples/tablesdb/create-point-column.md | 18 + .../tablesdb/create-polygon-column.md | 18 + .../tablesdb/create-relationship-column.md | 21 + docs/examples/tablesdb/create-row.md | 25 + docs/examples/tablesdb/create-rows.md | 17 + .../examples/tablesdb/create-string-column.md | 21 + docs/examples/tablesdb/create-table.md | 21 + docs/examples/tablesdb/create-text-column.md | 20 + docs/examples/tablesdb/create-transaction.md | 14 + docs/examples/tablesdb/create-url-column.md | 19 + .../tablesdb/create-varchar-column.md | 21 + docs/examples/tablesdb/create.md | 16 + .../examples/tablesdb/decrement-row-column.md | 20 + docs/examples/tablesdb/delete-column.md | 16 + docs/examples/tablesdb/delete-index.md | 16 + docs/examples/tablesdb/delete-row.md | 17 + docs/examples/tablesdb/delete-rows.md | 17 + docs/examples/tablesdb/delete-table.md | 15 + docs/examples/tablesdb/delete-transaction.md | 14 + docs/examples/tablesdb/delete.md | 14 + docs/examples/tablesdb/get-column.md | 16 + docs/examples/tablesdb/get-index.md | 16 + docs/examples/tablesdb/get-row.md | 18 + docs/examples/tablesdb/get-table.md | 15 + docs/examples/tablesdb/get-transaction.md | 14 + docs/examples/tablesdb/get.md | 14 + .../examples/tablesdb/increment-row-column.md | 20 + docs/examples/tablesdb/list-columns.md | 17 + docs/examples/tablesdb/list-indexes.md | 17 + docs/examples/tablesdb/list-rows.md | 19 + docs/examples/tablesdb/list-tables.md | 17 + docs/examples/tablesdb/list-transactions.md | 14 + docs/examples/tablesdb/list.md | 16 + .../tablesdb/update-big-int-column.md | 21 + .../tablesdb/update-boolean-column.md | 19 + .../tablesdb/update-datetime-column.md | 19 + docs/examples/tablesdb/update-email-column.md | 19 + docs/examples/tablesdb/update-enum-column.md | 20 + docs/examples/tablesdb/update-float-column.md | 21 + .../tablesdb/update-integer-column.md | 21 + docs/examples/tablesdb/update-ip-column.md | 19 + docs/examples/tablesdb/update-line-column.md | 19 + .../tablesdb/update-longtext-column.md | 19 + .../tablesdb/update-mediumtext-column.md | 19 + docs/examples/tablesdb/update-point-column.md | 19 + .../tablesdb/update-polygon-column.md | 19 + .../tablesdb/update-relationship-column.md | 18 + docs/examples/tablesdb/update-row.md | 25 + docs/examples/tablesdb/update-rows.md | 24 + .../examples/tablesdb/update-string-column.md | 20 + docs/examples/tablesdb/update-table.md | 20 + docs/examples/tablesdb/update-text-column.md | 19 + docs/examples/tablesdb/update-transaction.md | 16 + docs/examples/tablesdb/update-url-column.md | 19 + .../tablesdb/update-varchar-column.md | 20 + docs/examples/tablesdb/update.md | 16 + docs/examples/tablesdb/upsert-row.md | 25 + docs/examples/tablesdb/upsert-rows.md | 17 + docs/examples/teams/create-membership.md | 20 + docs/examples/teams/create.md | 16 + docs/examples/teams/delete-membership.md | 15 + docs/examples/teams/delete.md | 14 + docs/examples/teams/get-membership.md | 15 + docs/examples/teams/get-prefs.md | 14 + docs/examples/teams/get.md | 14 + docs/examples/teams/list-memberships.md | 17 + docs/examples/teams/list.md | 16 + .../teams/update-membership-status.md | 17 + docs/examples/teams/update-membership.md | 16 + docs/examples/teams/update-name.md | 15 + docs/examples/teams/update-prefs.md | 15 + docs/examples/tokens/create-file-token.md | 16 + docs/examples/tokens/delete.md | 14 + docs/examples/tokens/get.md | 14 + docs/examples/tokens/list.md | 17 + docs/examples/tokens/update.md | 15 + docs/examples/usage/list-events.md | 15 + docs/examples/usage/list-gauges.md | 15 + docs/examples/users/create-argon-2-user.md | 17 + docs/examples/users/create-bcrypt-user.md | 17 + docs/examples/users/create-jwt.md | 16 + docs/examples/users/create-md-5-user.md | 17 + .../users/create-mfa-recovery-codes.md | 14 + docs/examples/users/create-ph-pass-user.md | 17 + .../users/create-scrypt-modified-user.md | 20 + docs/examples/users/create-scrypt-user.md | 22 + docs/examples/users/create-session.md | 14 + docs/examples/users/create-sha-user.md | 18 + docs/examples/users/create-target.md | 19 + docs/examples/users/create-token.md | 16 + docs/examples/users/create.md | 18 + docs/examples/users/delete-identity.md | 14 + .../users/delete-mfa-authenticator.md | 15 + docs/examples/users/delete-session.md | 15 + docs/examples/users/delete-sessions.md | 14 + docs/examples/users/delete-target.md | 15 + docs/examples/users/delete.md | 14 + docs/examples/users/get-mfa-recovery-codes.md | 14 + docs/examples/users/get-prefs.md | 14 + docs/examples/users/get-target.md | 15 + docs/examples/users/get.md | 14 + docs/examples/users/list-identities.md | 16 + docs/examples/users/list-logs.md | 16 + docs/examples/users/list-memberships.md | 17 + docs/examples/users/list-mfa-factors.md | 14 + docs/examples/users/list-sessions.md | 15 + docs/examples/users/list-targets.md | 16 + docs/examples/users/list.md | 16 + .../users/update-email-verification.md | 15 + docs/examples/users/update-email.md | 15 + docs/examples/users/update-impersonator.md | 15 + docs/examples/users/update-labels.md | 15 + .../users/update-mfa-recovery-codes.md | 14 + docs/examples/users/update-mfa.md | 15 + docs/examples/users/update-name.md | 15 + docs/examples/users/update-password.md | 15 + .../users/update-phone-verification.md | 15 + docs/examples/users/update-phone.md | 15 + docs/examples/users/update-prefs.md | 15 + docs/examples/users/update-status.md | 15 + docs/examples/users/update-target.md | 18 + docs/examples/webhooks/create.md | 22 + docs/examples/webhooks/delete.md | 14 + docs/examples/webhooks/get.md | 14 + docs/examples/webhooks/list.md | 15 + docs/examples/webhooks/update-secret.md | 15 + docs/examples/webhooks/update.md | 21 + package-lock.json | 5093 ++++++++++++ package.json | 57 + src/client.ts | 573 ++ src/enums/adapter.ts | 4 + src/enums/attribute-status.ts | 7 + src/enums/authentication-factor.ts | 6 + src/enums/authenticator-type.ts | 3 + src/enums/backup-services.ts | 8 + src/enums/browser-permission.ts | 22 + src/enums/browser.ts | 16 + src/enums/build-runtime.ts | 94 + src/enums/column-status.ts | 7 + src/enums/compression.ts | 5 + src/enums/credit-card.ts | 19 + src/enums/database-type.ts | 6 + src/enums/databases-index-type.ts | 6 + src/enums/deployment-download-type.ts | 4 + src/enums/deployment-status.ts | 8 + src/enums/execution-method.ts | 9 + src/enums/execution-status.ts | 7 + src/enums/execution-trigger.ts | 5 + src/enums/flag.ts | 197 + src/enums/framework.ts | 17 + src/enums/health-antivirus-status.ts | 5 + src/enums/health-check-status.ts | 4 + src/enums/image-format.ts | 9 + src/enums/image-gravity.ts | 11 + src/enums/index-status.ts | 7 + src/enums/message-priority.ts | 4 + src/enums/message-status.ts | 7 + src/enums/messaging-provider-type.ts | 5 + src/enums/name.ts | 15 + src/enums/o-auth-2-google-prompt.ts | 5 + src/enums/o-auth-provider.ts | 45 + src/enums/order-by.ts | 4 + src/enums/password-hash.ts | 13 + src/enums/platform-type.ts | 7 + src/enums/project-auth-method-id.ts | 9 + src/enums/project-email-template-id.ts | 9 + src/enums/project-email-template-locale.ts | 133 + src/enums/project-key-scopes.ts | 96 + src/enums/project-o-auth-2-google-prompt.ts | 5 + src/enums/project-o-auth-provider-id.ts | 47 + src/enums/project-policy-id.ts | 11 + src/enums/project-protocol-id.ts | 5 + src/enums/project-service-id.ts | 20 + src/enums/project-smtp-secure.ts | 4 + src/enums/proxy-resource-type.ts | 4 + .../proxy-rule-deployment-resource-type.ts | 4 + src/enums/proxy-rule-status.ts | 5 + src/enums/relation-mutate.ts | 5 + src/enums/relationship-type.ts | 6 + src/enums/runtime.ts | 94 + src/enums/scopes.ts | 96 + src/enums/smtp-encryption.ts | 5 + src/enums/status-code.ts | 6 + src/enums/tables-db-index-type.ts | 6 + src/enums/template-reference-type.ts | 5 + src/enums/theme.ts | 4 + src/enums/timezone.ts | 421 + src/enums/vcs-reference-type.ts | 5 + src/id.ts | 47 + src/index.ts | 87 + src/inputFile.ts | 144 + src/models.ts | 7091 +++++++++++++++++ src/operator.ts | 308 + src/permission.ts | 57 + src/query.ts | 576 ++ src/role.ts | 100 + src/services/account.ts | 2831 +++++++ src/services/activities.ts | 116 + src/services/advisor.ts | 309 + src/services/avatars.ts | 754 ++ src/services/backups.ts | 754 ++ src/services/databases.ts | 6224 +++++++++++++++ src/services/functions.ts | 2003 +++++ src/services/graphql.ts | 124 + src/services/health.ts | 1043 +++ src/services/locale.ts | 198 + src/services/messaging.ts | 5194 ++++++++++++ src/services/presences.ts | 383 + src/services/project.ts | 6459 +++++++++++++++ src/services/proxy.ts | 541 ++ src/services/sites.ts | 1917 +++++ src/services/storage.ts | 1082 +++ src/services/tables-db.ts | 6167 ++++++++++++++ src/services/teams.ts | 893 +++ src/services/tokens.ts | 315 + src/services/usage.ts | 130 + src/services/users.ts | 3270 ++++++++ src/services/webhooks.ts | 466 ++ test/id.test.js | 6 + test/operator.test.js | 99 + test/permission.test.js | 10 + test/query.test.js | 155 + test/role.test.js | 14 + test/services/account.test.js | 1307 +++ test/services/activities.test.js | 73 + test/services/advisor.test.js | 111 + test/services/avatars.test.js | 123 + test/services/backups.test.js | 256 + test/services/databases.test.js | 1624 ++++ test/services/functions.test.js | 751 ++ test/services/graphql.test.js | 40 + test/services/health.test.js | 368 + test/services/locale.test.js | 137 + test/services/messaging.test.js | 1200 +++ test/services/presences.test.js | 104 + test/services/project.test.js | 2194 +++++ test/services/proxy.test.js | 215 + test/services/sites.test.js | 729 ++ test/services/storage.test.js | 291 + test/services/tables-d-b.test.js | 1624 ++++ test/services/teams.test.js | 282 + test/services/tokens.test.js | 107 + test/services/usage.test.js | 42 + test/services/users.test.js | 1145 +++ test/services/webhooks.test.js | 155 + tsconfig.json | 18 + tsup.config.ts | 27 + 665 files changed, 79519 insertions(+) create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 docs/examples/account/create-anonymous-session.md create mode 100644 docs/examples/account/create-email-password-session.md create mode 100644 docs/examples/account/create-email-token.md create mode 100644 docs/examples/account/create-email-verification.md create mode 100644 docs/examples/account/create-jwt.md create mode 100644 docs/examples/account/create-magic-url-token.md create mode 100644 docs/examples/account/create-mfa-authenticator.md create mode 100644 docs/examples/account/create-mfa-challenge.md create mode 100644 docs/examples/account/create-mfa-recovery-codes.md create mode 100644 docs/examples/account/create-o-auth-2-token.md create mode 100644 docs/examples/account/create-phone-token.md create mode 100644 docs/examples/account/create-phone-verification.md create mode 100644 docs/examples/account/create-recovery.md create mode 100644 docs/examples/account/create-session.md create mode 100644 docs/examples/account/create-verification.md create mode 100644 docs/examples/account/create.md create mode 100644 docs/examples/account/delete-identity.md create mode 100644 docs/examples/account/delete-mfa-authenticator.md create mode 100644 docs/examples/account/delete-session.md create mode 100644 docs/examples/account/delete-sessions.md create mode 100644 docs/examples/account/get-mfa-recovery-codes.md create mode 100644 docs/examples/account/get-prefs.md create mode 100644 docs/examples/account/get-session.md create mode 100644 docs/examples/account/get.md create mode 100644 docs/examples/account/list-identities.md create mode 100644 docs/examples/account/list-logs.md create mode 100644 docs/examples/account/list-mfa-factors.md create mode 100644 docs/examples/account/list-sessions.md create mode 100644 docs/examples/account/update-email-verification.md create mode 100644 docs/examples/account/update-email.md create mode 100644 docs/examples/account/update-magic-url-session.md create mode 100644 docs/examples/account/update-mfa-authenticator.md create mode 100644 docs/examples/account/update-mfa-challenge.md create mode 100644 docs/examples/account/update-mfa-recovery-codes.md create mode 100644 docs/examples/account/update-mfa.md create mode 100644 docs/examples/account/update-name.md create mode 100644 docs/examples/account/update-password.md create mode 100644 docs/examples/account/update-phone-session.md create mode 100644 docs/examples/account/update-phone-verification.md create mode 100644 docs/examples/account/update-phone.md create mode 100644 docs/examples/account/update-prefs.md create mode 100644 docs/examples/account/update-recovery.md create mode 100644 docs/examples/account/update-session.md create mode 100644 docs/examples/account/update-status.md create mode 100644 docs/examples/account/update-verification.md create mode 100644 docs/examples/activities/get-event.md create mode 100644 docs/examples/activities/list-events.md create mode 100644 docs/examples/advisor/delete-report.md create mode 100644 docs/examples/advisor/get-insight.md create mode 100644 docs/examples/advisor/get-report.md create mode 100644 docs/examples/advisor/list-insights.md create mode 100644 docs/examples/advisor/list-reports.md create mode 100644 docs/examples/avatars/get-browser.md create mode 100644 docs/examples/avatars/get-credit-card.md create mode 100644 docs/examples/avatars/get-favicon.md create mode 100644 docs/examples/avatars/get-flag.md create mode 100644 docs/examples/avatars/get-image.md create mode 100644 docs/examples/avatars/get-initials.md create mode 100644 docs/examples/avatars/get-qr.md create mode 100644 docs/examples/avatars/get-screenshot.md create mode 100644 docs/examples/backups/create-archive.md create mode 100644 docs/examples/backups/create-policy.md create mode 100644 docs/examples/backups/create-restoration.md create mode 100644 docs/examples/backups/delete-archive.md create mode 100644 docs/examples/backups/delete-policy.md create mode 100644 docs/examples/backups/get-archive.md create mode 100644 docs/examples/backups/get-policy.md create mode 100644 docs/examples/backups/get-restoration.md create mode 100644 docs/examples/backups/list-archives.md create mode 100644 docs/examples/backups/list-policies.md create mode 100644 docs/examples/backups/list-restorations.md create mode 100644 docs/examples/backups/update-policy.md create mode 100644 docs/examples/databases/create-big-int-attribute.md create mode 100644 docs/examples/databases/create-boolean-attribute.md create mode 100644 docs/examples/databases/create-collection.md create mode 100644 docs/examples/databases/create-datetime-attribute.md create mode 100644 docs/examples/databases/create-document.md create mode 100644 docs/examples/databases/create-documents.md create mode 100644 docs/examples/databases/create-email-attribute.md create mode 100644 docs/examples/databases/create-enum-attribute.md create mode 100644 docs/examples/databases/create-float-attribute.md create mode 100644 docs/examples/databases/create-index.md create mode 100644 docs/examples/databases/create-integer-attribute.md create mode 100644 docs/examples/databases/create-ip-attribute.md create mode 100644 docs/examples/databases/create-line-attribute.md create mode 100644 docs/examples/databases/create-longtext-attribute.md create mode 100644 docs/examples/databases/create-mediumtext-attribute.md create mode 100644 docs/examples/databases/create-operations.md create mode 100644 docs/examples/databases/create-point-attribute.md create mode 100644 docs/examples/databases/create-polygon-attribute.md create mode 100644 docs/examples/databases/create-relationship-attribute.md create mode 100644 docs/examples/databases/create-string-attribute.md create mode 100644 docs/examples/databases/create-text-attribute.md create mode 100644 docs/examples/databases/create-transaction.md create mode 100644 docs/examples/databases/create-url-attribute.md create mode 100644 docs/examples/databases/create-varchar-attribute.md create mode 100644 docs/examples/databases/create.md create mode 100644 docs/examples/databases/decrement-document-attribute.md create mode 100644 docs/examples/databases/delete-attribute.md create mode 100644 docs/examples/databases/delete-collection.md create mode 100644 docs/examples/databases/delete-document.md create mode 100644 docs/examples/databases/delete-documents.md create mode 100644 docs/examples/databases/delete-index.md create mode 100644 docs/examples/databases/delete-transaction.md create mode 100644 docs/examples/databases/delete.md create mode 100644 docs/examples/databases/get-attribute.md create mode 100644 docs/examples/databases/get-collection.md create mode 100644 docs/examples/databases/get-document.md create mode 100644 docs/examples/databases/get-index.md create mode 100644 docs/examples/databases/get-transaction.md create mode 100644 docs/examples/databases/get.md create mode 100644 docs/examples/databases/increment-document-attribute.md create mode 100644 docs/examples/databases/list-attributes.md create mode 100644 docs/examples/databases/list-collections.md create mode 100644 docs/examples/databases/list-documents.md create mode 100644 docs/examples/databases/list-indexes.md create mode 100644 docs/examples/databases/list-transactions.md create mode 100644 docs/examples/databases/list.md create mode 100644 docs/examples/databases/update-big-int-attribute.md create mode 100644 docs/examples/databases/update-boolean-attribute.md create mode 100644 docs/examples/databases/update-collection.md create mode 100644 docs/examples/databases/update-datetime-attribute.md create mode 100644 docs/examples/databases/update-document.md create mode 100644 docs/examples/databases/update-documents.md create mode 100644 docs/examples/databases/update-email-attribute.md create mode 100644 docs/examples/databases/update-enum-attribute.md create mode 100644 docs/examples/databases/update-float-attribute.md create mode 100644 docs/examples/databases/update-integer-attribute.md create mode 100644 docs/examples/databases/update-ip-attribute.md create mode 100644 docs/examples/databases/update-line-attribute.md create mode 100644 docs/examples/databases/update-longtext-attribute.md create mode 100644 docs/examples/databases/update-mediumtext-attribute.md create mode 100644 docs/examples/databases/update-point-attribute.md create mode 100644 docs/examples/databases/update-polygon-attribute.md create mode 100644 docs/examples/databases/update-relationship-attribute.md create mode 100644 docs/examples/databases/update-string-attribute.md create mode 100644 docs/examples/databases/update-text-attribute.md create mode 100644 docs/examples/databases/update-transaction.md create mode 100644 docs/examples/databases/update-url-attribute.md create mode 100644 docs/examples/databases/update-varchar-attribute.md create mode 100644 docs/examples/databases/update.md create mode 100644 docs/examples/databases/upsert-document.md create mode 100644 docs/examples/databases/upsert-documents.md create mode 100644 docs/examples/functions/create-deployment.md create mode 100644 docs/examples/functions/create-duplicate-deployment.md create mode 100644 docs/examples/functions/create-execution.md create mode 100644 docs/examples/functions/create-template-deployment.md create mode 100644 docs/examples/functions/create-variable.md create mode 100644 docs/examples/functions/create-vcs-deployment.md create mode 100644 docs/examples/functions/create.md create mode 100644 docs/examples/functions/delete-deployment.md create mode 100644 docs/examples/functions/delete-execution.md create mode 100644 docs/examples/functions/delete-variable.md create mode 100644 docs/examples/functions/delete.md create mode 100644 docs/examples/functions/get-deployment-download.md create mode 100644 docs/examples/functions/get-deployment.md create mode 100644 docs/examples/functions/get-execution.md create mode 100644 docs/examples/functions/get-variable.md create mode 100644 docs/examples/functions/get.md create mode 100644 docs/examples/functions/list-deployments.md create mode 100644 docs/examples/functions/list-executions.md create mode 100644 docs/examples/functions/list-runtimes.md create mode 100644 docs/examples/functions/list-specifications.md create mode 100644 docs/examples/functions/list-variables.md create mode 100644 docs/examples/functions/list.md create mode 100644 docs/examples/functions/update-deployment-status.md create mode 100644 docs/examples/functions/update-function-deployment.md create mode 100644 docs/examples/functions/update-variable.md create mode 100644 docs/examples/functions/update.md create mode 100644 docs/examples/graphql/mutation.md create mode 100644 docs/examples/graphql/query.md create mode 100644 docs/examples/health/get-antivirus.md create mode 100644 docs/examples/health/get-cache.md create mode 100644 docs/examples/health/get-certificate.md create mode 100644 docs/examples/health/get-console-pausing.md create mode 100644 docs/examples/health/get-db.md create mode 100644 docs/examples/health/get-failed-jobs.md create mode 100644 docs/examples/health/get-pub-sub.md create mode 100644 docs/examples/health/get-queue-audits.md create mode 100644 docs/examples/health/get-queue-builds.md create mode 100644 docs/examples/health/get-queue-certificates.md create mode 100644 docs/examples/health/get-queue-databases.md create mode 100644 docs/examples/health/get-queue-deletes.md create mode 100644 docs/examples/health/get-queue-functions.md create mode 100644 docs/examples/health/get-queue-logs.md create mode 100644 docs/examples/health/get-queue-mails.md create mode 100644 docs/examples/health/get-queue-messaging.md create mode 100644 docs/examples/health/get-queue-migrations.md create mode 100644 docs/examples/health/get-queue-stats-resources.md create mode 100644 docs/examples/health/get-queue-usage.md create mode 100644 docs/examples/health/get-queue-webhooks.md create mode 100644 docs/examples/health/get-storage-local.md create mode 100644 docs/examples/health/get-storage.md create mode 100644 docs/examples/health/get-time.md create mode 100644 docs/examples/health/get.md create mode 100644 docs/examples/locale/get.md create mode 100644 docs/examples/locale/list-codes.md create mode 100644 docs/examples/locale/list-continents.md create mode 100644 docs/examples/locale/list-countries-eu.md create mode 100644 docs/examples/locale/list-countries-phones.md create mode 100644 docs/examples/locale/list-countries.md create mode 100644 docs/examples/locale/list-currencies.md create mode 100644 docs/examples/locale/list-languages.md create mode 100644 docs/examples/messaging/create-apns-provider.md create mode 100644 docs/examples/messaging/create-email.md create mode 100644 docs/examples/messaging/create-fcm-provider.md create mode 100644 docs/examples/messaging/create-mailgun-provider.md create mode 100644 docs/examples/messaging/create-msg-91-provider.md create mode 100644 docs/examples/messaging/create-push.md create mode 100644 docs/examples/messaging/create-resend-provider.md create mode 100644 docs/examples/messaging/create-sendgrid-provider.md create mode 100644 docs/examples/messaging/create-sms.md create mode 100644 docs/examples/messaging/create-smtp-provider.md create mode 100644 docs/examples/messaging/create-subscriber.md create mode 100644 docs/examples/messaging/create-telesign-provider.md create mode 100644 docs/examples/messaging/create-textmagic-provider.md create mode 100644 docs/examples/messaging/create-topic.md create mode 100644 docs/examples/messaging/create-twilio-provider.md create mode 100644 docs/examples/messaging/create-vonage-provider.md create mode 100644 docs/examples/messaging/delete-provider.md create mode 100644 docs/examples/messaging/delete-subscriber.md create mode 100644 docs/examples/messaging/delete-topic.md create mode 100644 docs/examples/messaging/delete.md create mode 100644 docs/examples/messaging/get-message.md create mode 100644 docs/examples/messaging/get-provider.md create mode 100644 docs/examples/messaging/get-subscriber.md create mode 100644 docs/examples/messaging/get-topic.md create mode 100644 docs/examples/messaging/list-message-logs.md create mode 100644 docs/examples/messaging/list-messages.md create mode 100644 docs/examples/messaging/list-provider-logs.md create mode 100644 docs/examples/messaging/list-providers.md create mode 100644 docs/examples/messaging/list-subscriber-logs.md create mode 100644 docs/examples/messaging/list-subscribers.md create mode 100644 docs/examples/messaging/list-targets.md create mode 100644 docs/examples/messaging/list-topic-logs.md create mode 100644 docs/examples/messaging/list-topics.md create mode 100644 docs/examples/messaging/update-apns-provider.md create mode 100644 docs/examples/messaging/update-email.md create mode 100644 docs/examples/messaging/update-fcm-provider.md create mode 100644 docs/examples/messaging/update-mailgun-provider.md create mode 100644 docs/examples/messaging/update-msg-91-provider.md create mode 100644 docs/examples/messaging/update-push.md create mode 100644 docs/examples/messaging/update-resend-provider.md create mode 100644 docs/examples/messaging/update-sendgrid-provider.md create mode 100644 docs/examples/messaging/update-sms.md create mode 100644 docs/examples/messaging/update-smtp-provider.md create mode 100644 docs/examples/messaging/update-telesign-provider.md create mode 100644 docs/examples/messaging/update-textmagic-provider.md create mode 100644 docs/examples/messaging/update-topic.md create mode 100644 docs/examples/messaging/update-twilio-provider.md create mode 100644 docs/examples/messaging/update-vonage-provider.md create mode 100644 docs/examples/presences/delete.md create mode 100644 docs/examples/presences/get.md create mode 100644 docs/examples/presences/list.md create mode 100644 docs/examples/presences/update-presence.md create mode 100644 docs/examples/presences/upsert.md create mode 100644 docs/examples/project/create-android-platform.md create mode 100644 docs/examples/project/create-apple-platform.md create mode 100644 docs/examples/project/create-ephemeral-key.md create mode 100644 docs/examples/project/create-key.md create mode 100644 docs/examples/project/create-linux-platform.md create mode 100644 docs/examples/project/create-mock-phone.md create mode 100644 docs/examples/project/create-smtp-test.md create mode 100644 docs/examples/project/create-variable.md create mode 100644 docs/examples/project/create-web-platform.md create mode 100644 docs/examples/project/create-windows-platform.md create mode 100644 docs/examples/project/delete-key.md create mode 100644 docs/examples/project/delete-mock-phone.md create mode 100644 docs/examples/project/delete-platform.md create mode 100644 docs/examples/project/delete-variable.md create mode 100644 docs/examples/project/delete.md create mode 100644 docs/examples/project/get-email-template.md create mode 100644 docs/examples/project/get-key.md create mode 100644 docs/examples/project/get-mock-phone.md create mode 100644 docs/examples/project/get-o-auth-2-provider.md create mode 100644 docs/examples/project/get-platform.md create mode 100644 docs/examples/project/get-policy.md create mode 100644 docs/examples/project/get-variable.md create mode 100644 docs/examples/project/get.md create mode 100644 docs/examples/project/list-email-templates.md create mode 100644 docs/examples/project/list-keys.md create mode 100644 docs/examples/project/list-mock-phones.md create mode 100644 docs/examples/project/list-o-auth-2-providers.md create mode 100644 docs/examples/project/list-platforms.md create mode 100644 docs/examples/project/list-policies.md create mode 100644 docs/examples/project/list-variables.md create mode 100644 docs/examples/project/update-android-platform.md create mode 100644 docs/examples/project/update-apple-platform.md create mode 100644 docs/examples/project/update-auth-method.md create mode 100644 docs/examples/project/update-deny-aliased-email-policy.md create mode 100644 docs/examples/project/update-deny-disposable-email-policy.md create mode 100644 docs/examples/project/update-deny-free-email-policy.md create mode 100644 docs/examples/project/update-email-template.md create mode 100644 docs/examples/project/update-key.md create mode 100644 docs/examples/project/update-labels.md create mode 100644 docs/examples/project/update-linux-platform.md create mode 100644 docs/examples/project/update-membership-privacy-policy.md create mode 100644 docs/examples/project/update-mock-phone.md create mode 100644 docs/examples/project/update-o-auth-2-amazon.md create mode 100644 docs/examples/project/update-o-auth-2-apple.md create mode 100644 docs/examples/project/update-o-auth-2-auth-0.md create mode 100644 docs/examples/project/update-o-auth-2-authentik.md create mode 100644 docs/examples/project/update-o-auth-2-autodesk.md create mode 100644 docs/examples/project/update-o-auth-2-bitbucket.md create mode 100644 docs/examples/project/update-o-auth-2-bitly.md create mode 100644 docs/examples/project/update-o-auth-2-box.md create mode 100644 docs/examples/project/update-o-auth-2-dailymotion.md create mode 100644 docs/examples/project/update-o-auth-2-discord.md create mode 100644 docs/examples/project/update-o-auth-2-disqus.md create mode 100644 docs/examples/project/update-o-auth-2-dropbox.md create mode 100644 docs/examples/project/update-o-auth-2-etsy.md create mode 100644 docs/examples/project/update-o-auth-2-facebook.md create mode 100644 docs/examples/project/update-o-auth-2-figma.md create mode 100644 docs/examples/project/update-o-auth-2-fusion-auth.md create mode 100644 docs/examples/project/update-o-auth-2-git-hub.md create mode 100644 docs/examples/project/update-o-auth-2-gitlab.md create mode 100644 docs/examples/project/update-o-auth-2-google.md create mode 100644 docs/examples/project/update-o-auth-2-keycloak.md create mode 100644 docs/examples/project/update-o-auth-2-kick.md create mode 100644 docs/examples/project/update-o-auth-2-linkedin.md create mode 100644 docs/examples/project/update-o-auth-2-microsoft.md create mode 100644 docs/examples/project/update-o-auth-2-notion.md create mode 100644 docs/examples/project/update-o-auth-2-oidc.md create mode 100644 docs/examples/project/update-o-auth-2-okta.md create mode 100644 docs/examples/project/update-o-auth-2-paypal-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-paypal.md create mode 100644 docs/examples/project/update-o-auth-2-podio.md create mode 100644 docs/examples/project/update-o-auth-2-salesforce.md create mode 100644 docs/examples/project/update-o-auth-2-slack.md create mode 100644 docs/examples/project/update-o-auth-2-spotify.md create mode 100644 docs/examples/project/update-o-auth-2-stripe.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift-sandbox.md create mode 100644 docs/examples/project/update-o-auth-2-tradeshift.md create mode 100644 docs/examples/project/update-o-auth-2-twitch.md create mode 100644 docs/examples/project/update-o-auth-2-word-press.md create mode 100644 docs/examples/project/update-o-auth-2-yahoo.md create mode 100644 docs/examples/project/update-o-auth-2-yandex.md create mode 100644 docs/examples/project/update-o-auth-2-zoho.md create mode 100644 docs/examples/project/update-o-auth-2-zoom.md create mode 100644 docs/examples/project/update-o-auth-2x.md create mode 100644 docs/examples/project/update-password-dictionary-policy.md create mode 100644 docs/examples/project/update-password-history-policy.md create mode 100644 docs/examples/project/update-password-personal-data-policy.md create mode 100644 docs/examples/project/update-protocol.md create mode 100644 docs/examples/project/update-service.md create mode 100644 docs/examples/project/update-session-alert-policy.md create mode 100644 docs/examples/project/update-session-duration-policy.md create mode 100644 docs/examples/project/update-session-invalidation-policy.md create mode 100644 docs/examples/project/update-session-limit-policy.md create mode 100644 docs/examples/project/update-smtp.md create mode 100644 docs/examples/project/update-user-limit-policy.md create mode 100644 docs/examples/project/update-variable.md create mode 100644 docs/examples/project/update-web-platform.md create mode 100644 docs/examples/project/update-windows-platform.md create mode 100644 docs/examples/proxy/create-api-rule.md create mode 100644 docs/examples/proxy/create-function-rule.md create mode 100644 docs/examples/proxy/create-redirect-rule.md create mode 100644 docs/examples/proxy/create-site-rule.md create mode 100644 docs/examples/proxy/delete-rule.md create mode 100644 docs/examples/proxy/get-rule.md create mode 100644 docs/examples/proxy/list-rules.md create mode 100644 docs/examples/proxy/update-rule-status.md create mode 100644 docs/examples/sites/create-deployment.md create mode 100644 docs/examples/sites/create-duplicate-deployment.md create mode 100644 docs/examples/sites/create-template-deployment.md create mode 100644 docs/examples/sites/create-variable.md create mode 100644 docs/examples/sites/create-vcs-deployment.md create mode 100644 docs/examples/sites/create.md create mode 100644 docs/examples/sites/delete-deployment.md create mode 100644 docs/examples/sites/delete-log.md create mode 100644 docs/examples/sites/delete-variable.md create mode 100644 docs/examples/sites/delete.md create mode 100644 docs/examples/sites/get-deployment-download.md create mode 100644 docs/examples/sites/get-deployment.md create mode 100644 docs/examples/sites/get-log.md create mode 100644 docs/examples/sites/get-variable.md create mode 100644 docs/examples/sites/get.md create mode 100644 docs/examples/sites/list-deployments.md create mode 100644 docs/examples/sites/list-frameworks.md create mode 100644 docs/examples/sites/list-logs.md create mode 100644 docs/examples/sites/list-specifications.md create mode 100644 docs/examples/sites/list-variables.md create mode 100644 docs/examples/sites/list.md create mode 100644 docs/examples/sites/update-deployment-status.md create mode 100644 docs/examples/sites/update-site-deployment.md create mode 100644 docs/examples/sites/update-variable.md create mode 100644 docs/examples/sites/update.md create mode 100644 docs/examples/storage/create-bucket.md create mode 100644 docs/examples/storage/create-file.md create mode 100644 docs/examples/storage/delete-bucket.md create mode 100644 docs/examples/storage/delete-file.md create mode 100644 docs/examples/storage/get-bucket.md create mode 100644 docs/examples/storage/get-file-download.md create mode 100644 docs/examples/storage/get-file-preview.md create mode 100644 docs/examples/storage/get-file-view.md create mode 100644 docs/examples/storage/get-file.md create mode 100644 docs/examples/storage/list-buckets.md create mode 100644 docs/examples/storage/list-files.md create mode 100644 docs/examples/storage/update-bucket.md create mode 100644 docs/examples/storage/update-file.md create mode 100644 docs/examples/tablesdb/create-big-int-column.md create mode 100644 docs/examples/tablesdb/create-boolean-column.md create mode 100644 docs/examples/tablesdb/create-datetime-column.md create mode 100644 docs/examples/tablesdb/create-email-column.md create mode 100644 docs/examples/tablesdb/create-enum-column.md create mode 100644 docs/examples/tablesdb/create-float-column.md create mode 100644 docs/examples/tablesdb/create-index.md create mode 100644 docs/examples/tablesdb/create-integer-column.md create mode 100644 docs/examples/tablesdb/create-ip-column.md create mode 100644 docs/examples/tablesdb/create-line-column.md create mode 100644 docs/examples/tablesdb/create-longtext-column.md create mode 100644 docs/examples/tablesdb/create-mediumtext-column.md create mode 100644 docs/examples/tablesdb/create-operations.md create mode 100644 docs/examples/tablesdb/create-point-column.md create mode 100644 docs/examples/tablesdb/create-polygon-column.md create mode 100644 docs/examples/tablesdb/create-relationship-column.md create mode 100644 docs/examples/tablesdb/create-row.md create mode 100644 docs/examples/tablesdb/create-rows.md create mode 100644 docs/examples/tablesdb/create-string-column.md create mode 100644 docs/examples/tablesdb/create-table.md create mode 100644 docs/examples/tablesdb/create-text-column.md create mode 100644 docs/examples/tablesdb/create-transaction.md create mode 100644 docs/examples/tablesdb/create-url-column.md create mode 100644 docs/examples/tablesdb/create-varchar-column.md create mode 100644 docs/examples/tablesdb/create.md create mode 100644 docs/examples/tablesdb/decrement-row-column.md create mode 100644 docs/examples/tablesdb/delete-column.md create mode 100644 docs/examples/tablesdb/delete-index.md create mode 100644 docs/examples/tablesdb/delete-row.md create mode 100644 docs/examples/tablesdb/delete-rows.md create mode 100644 docs/examples/tablesdb/delete-table.md create mode 100644 docs/examples/tablesdb/delete-transaction.md create mode 100644 docs/examples/tablesdb/delete.md create mode 100644 docs/examples/tablesdb/get-column.md create mode 100644 docs/examples/tablesdb/get-index.md create mode 100644 docs/examples/tablesdb/get-row.md create mode 100644 docs/examples/tablesdb/get-table.md create mode 100644 docs/examples/tablesdb/get-transaction.md create mode 100644 docs/examples/tablesdb/get.md create mode 100644 docs/examples/tablesdb/increment-row-column.md create mode 100644 docs/examples/tablesdb/list-columns.md create mode 100644 docs/examples/tablesdb/list-indexes.md create mode 100644 docs/examples/tablesdb/list-rows.md create mode 100644 docs/examples/tablesdb/list-tables.md create mode 100644 docs/examples/tablesdb/list-transactions.md create mode 100644 docs/examples/tablesdb/list.md create mode 100644 docs/examples/tablesdb/update-big-int-column.md create mode 100644 docs/examples/tablesdb/update-boolean-column.md create mode 100644 docs/examples/tablesdb/update-datetime-column.md create mode 100644 docs/examples/tablesdb/update-email-column.md create mode 100644 docs/examples/tablesdb/update-enum-column.md create mode 100644 docs/examples/tablesdb/update-float-column.md create mode 100644 docs/examples/tablesdb/update-integer-column.md create mode 100644 docs/examples/tablesdb/update-ip-column.md create mode 100644 docs/examples/tablesdb/update-line-column.md create mode 100644 docs/examples/tablesdb/update-longtext-column.md create mode 100644 docs/examples/tablesdb/update-mediumtext-column.md create mode 100644 docs/examples/tablesdb/update-point-column.md create mode 100644 docs/examples/tablesdb/update-polygon-column.md create mode 100644 docs/examples/tablesdb/update-relationship-column.md create mode 100644 docs/examples/tablesdb/update-row.md create mode 100644 docs/examples/tablesdb/update-rows.md create mode 100644 docs/examples/tablesdb/update-string-column.md create mode 100644 docs/examples/tablesdb/update-table.md create mode 100644 docs/examples/tablesdb/update-text-column.md create mode 100644 docs/examples/tablesdb/update-transaction.md create mode 100644 docs/examples/tablesdb/update-url-column.md create mode 100644 docs/examples/tablesdb/update-varchar-column.md create mode 100644 docs/examples/tablesdb/update.md create mode 100644 docs/examples/tablesdb/upsert-row.md create mode 100644 docs/examples/tablesdb/upsert-rows.md create mode 100644 docs/examples/teams/create-membership.md create mode 100644 docs/examples/teams/create.md create mode 100644 docs/examples/teams/delete-membership.md create mode 100644 docs/examples/teams/delete.md create mode 100644 docs/examples/teams/get-membership.md create mode 100644 docs/examples/teams/get-prefs.md create mode 100644 docs/examples/teams/get.md create mode 100644 docs/examples/teams/list-memberships.md create mode 100644 docs/examples/teams/list.md create mode 100644 docs/examples/teams/update-membership-status.md create mode 100644 docs/examples/teams/update-membership.md create mode 100644 docs/examples/teams/update-name.md create mode 100644 docs/examples/teams/update-prefs.md create mode 100644 docs/examples/tokens/create-file-token.md create mode 100644 docs/examples/tokens/delete.md create mode 100644 docs/examples/tokens/get.md create mode 100644 docs/examples/tokens/list.md create mode 100644 docs/examples/tokens/update.md create mode 100644 docs/examples/usage/list-events.md create mode 100644 docs/examples/usage/list-gauges.md create mode 100644 docs/examples/users/create-argon-2-user.md create mode 100644 docs/examples/users/create-bcrypt-user.md create mode 100644 docs/examples/users/create-jwt.md create mode 100644 docs/examples/users/create-md-5-user.md create mode 100644 docs/examples/users/create-mfa-recovery-codes.md create mode 100644 docs/examples/users/create-ph-pass-user.md create mode 100644 docs/examples/users/create-scrypt-modified-user.md create mode 100644 docs/examples/users/create-scrypt-user.md create mode 100644 docs/examples/users/create-session.md create mode 100644 docs/examples/users/create-sha-user.md create mode 100644 docs/examples/users/create-target.md create mode 100644 docs/examples/users/create-token.md create mode 100644 docs/examples/users/create.md create mode 100644 docs/examples/users/delete-identity.md create mode 100644 docs/examples/users/delete-mfa-authenticator.md create mode 100644 docs/examples/users/delete-session.md create mode 100644 docs/examples/users/delete-sessions.md create mode 100644 docs/examples/users/delete-target.md create mode 100644 docs/examples/users/delete.md create mode 100644 docs/examples/users/get-mfa-recovery-codes.md create mode 100644 docs/examples/users/get-prefs.md create mode 100644 docs/examples/users/get-target.md create mode 100644 docs/examples/users/get.md create mode 100644 docs/examples/users/list-identities.md create mode 100644 docs/examples/users/list-logs.md create mode 100644 docs/examples/users/list-memberships.md create mode 100644 docs/examples/users/list-mfa-factors.md create mode 100644 docs/examples/users/list-sessions.md create mode 100644 docs/examples/users/list-targets.md create mode 100644 docs/examples/users/list.md create mode 100644 docs/examples/users/update-email-verification.md create mode 100644 docs/examples/users/update-email.md create mode 100644 docs/examples/users/update-impersonator.md create mode 100644 docs/examples/users/update-labels.md create mode 100644 docs/examples/users/update-mfa-recovery-codes.md create mode 100644 docs/examples/users/update-mfa.md create mode 100644 docs/examples/users/update-name.md create mode 100644 docs/examples/users/update-password.md create mode 100644 docs/examples/users/update-phone-verification.md create mode 100644 docs/examples/users/update-phone.md create mode 100644 docs/examples/users/update-prefs.md create mode 100644 docs/examples/users/update-status.md create mode 100644 docs/examples/users/update-target.md create mode 100644 docs/examples/webhooks/create.md create mode 100644 docs/examples/webhooks/delete.md create mode 100644 docs/examples/webhooks/get.md create mode 100644 docs/examples/webhooks/list.md create mode 100644 docs/examples/webhooks/update-secret.md create mode 100644 docs/examples/webhooks/update.md create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/client.ts create mode 100644 src/enums/adapter.ts create mode 100644 src/enums/attribute-status.ts create mode 100644 src/enums/authentication-factor.ts create mode 100644 src/enums/authenticator-type.ts create mode 100644 src/enums/backup-services.ts create mode 100644 src/enums/browser-permission.ts create mode 100644 src/enums/browser.ts create mode 100644 src/enums/build-runtime.ts create mode 100644 src/enums/column-status.ts create mode 100644 src/enums/compression.ts create mode 100644 src/enums/credit-card.ts create mode 100644 src/enums/database-type.ts create mode 100644 src/enums/databases-index-type.ts create mode 100644 src/enums/deployment-download-type.ts create mode 100644 src/enums/deployment-status.ts create mode 100644 src/enums/execution-method.ts create mode 100644 src/enums/execution-status.ts create mode 100644 src/enums/execution-trigger.ts create mode 100644 src/enums/flag.ts create mode 100644 src/enums/framework.ts create mode 100644 src/enums/health-antivirus-status.ts create mode 100644 src/enums/health-check-status.ts create mode 100644 src/enums/image-format.ts create mode 100644 src/enums/image-gravity.ts create mode 100644 src/enums/index-status.ts create mode 100644 src/enums/message-priority.ts create mode 100644 src/enums/message-status.ts create mode 100644 src/enums/messaging-provider-type.ts create mode 100644 src/enums/name.ts create mode 100644 src/enums/o-auth-2-google-prompt.ts create mode 100644 src/enums/o-auth-provider.ts create mode 100644 src/enums/order-by.ts create mode 100644 src/enums/password-hash.ts create mode 100644 src/enums/platform-type.ts create mode 100644 src/enums/project-auth-method-id.ts create mode 100644 src/enums/project-email-template-id.ts create mode 100644 src/enums/project-email-template-locale.ts create mode 100644 src/enums/project-key-scopes.ts create mode 100644 src/enums/project-o-auth-2-google-prompt.ts create mode 100644 src/enums/project-o-auth-provider-id.ts create mode 100644 src/enums/project-policy-id.ts create mode 100644 src/enums/project-protocol-id.ts create mode 100644 src/enums/project-service-id.ts create mode 100644 src/enums/project-smtp-secure.ts create mode 100644 src/enums/proxy-resource-type.ts create mode 100644 src/enums/proxy-rule-deployment-resource-type.ts create mode 100644 src/enums/proxy-rule-status.ts create mode 100644 src/enums/relation-mutate.ts create mode 100644 src/enums/relationship-type.ts create mode 100644 src/enums/runtime.ts create mode 100644 src/enums/scopes.ts create mode 100644 src/enums/smtp-encryption.ts create mode 100644 src/enums/status-code.ts create mode 100644 src/enums/tables-db-index-type.ts create mode 100644 src/enums/template-reference-type.ts create mode 100644 src/enums/theme.ts create mode 100644 src/enums/timezone.ts create mode 100644 src/enums/vcs-reference-type.ts create mode 100644 src/id.ts create mode 100644 src/index.ts create mode 100644 src/inputFile.ts create mode 100644 src/models.ts create mode 100644 src/operator.ts create mode 100644 src/permission.ts create mode 100644 src/query.ts create mode 100644 src/role.ts create mode 100644 src/services/account.ts create mode 100644 src/services/activities.ts create mode 100644 src/services/advisor.ts create mode 100644 src/services/avatars.ts create mode 100644 src/services/backups.ts create mode 100644 src/services/databases.ts create mode 100644 src/services/functions.ts create mode 100644 src/services/graphql.ts create mode 100644 src/services/health.ts create mode 100644 src/services/locale.ts create mode 100644 src/services/messaging.ts create mode 100644 src/services/presences.ts create mode 100644 src/services/project.ts create mode 100644 src/services/proxy.ts create mode 100644 src/services/sites.ts create mode 100644 src/services/storage.ts create mode 100644 src/services/tables-db.ts create mode 100644 src/services/teams.ts create mode 100644 src/services/tokens.ts create mode 100644 src/services/usage.ts create mode 100644 src/services/users.ts create mode 100644 src/services/webhooks.ts create mode 100644 test/id.test.js create mode 100644 test/operator.test.js create mode 100644 test/permission.test.js create mode 100644 test/query.test.js create mode 100644 test/role.test.js create mode 100644 test/services/account.test.js create mode 100644 test/services/activities.test.js create mode 100644 test/services/advisor.test.js create mode 100644 test/services/avatars.test.js create mode 100644 test/services/backups.test.js create mode 100644 test/services/databases.test.js create mode 100644 test/services/functions.test.js create mode 100644 test/services/graphql.test.js create mode 100644 test/services/health.test.js create mode 100644 test/services/locale.test.js create mode 100644 test/services/messaging.test.js create mode 100644 test/services/presences.test.js create mode 100644 test/services/project.test.js create mode 100644 test/services/proxy.test.js create mode 100644 test/services/sites.test.js create mode 100644 test/services/storage.test.js create mode 100644 test/services/tables-d-b.test.js create mode 100644 test/services/teams.test.js create mode 100644 test/services/tokens.test.js create mode 100644 test/services/usage.test.js create mode 100644 test/services/users.test.js create mode 100644 test/services/webhooks.test.js create mode 100644 tsconfig.json create mode 100644 tsup.config.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..3bdd52eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +dist/ +.DS_Store diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..7253a5ce --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +min-release-age=7 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..a47aa7fc --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,195 @@ +# Change Log + +## 25.1.0 + +* Added `sizeActual` property to file model for actual stored size after compression +* Added `Deno121`, `Deno124`, and `Deno135` runtime options to `BuildRuntime` and `Runtime` enums +* Updated advisor authentication examples to use API key instead of session +* Updated billing limits properties to be optional in project models + +## 25.0.0 + +* Breaking: Renamed `AuthMethod` enum to `ProjectAuthMethodId` +* Breaking: Renamed `EmailTemplateType` to `ProjectEmailTemplateId` and `EmailTemplateLocale` to `ProjectEmailTemplateLocale` +* Breaking: Renamed `ServiceId` to `ProjectServiceId`, `ProtocolId` to `ProjectProtocolId`, `Secure` to `ProjectSMTPSecure`, `ProjectPolicy` to `ProjectPolicyId` +* Breaking: Replaced `Scopes` enum with `ProjectKeyScopes` for project key endpoints +* Breaking: Removed `updateDenyCanonicalEmailPolicy`; replaced with `updateDenyAliasedEmailPolicy`, `updateDenyDisposableEmailPolicy`, and `updateDenyFreeEmailPolicy` +* Breaking: Removed `AuthProvider` model; use new `ProjectOAuthProviderId` enum instead +* Added: `Project.get` method to fetch current project details +* Added: `Advisor`, `Presences`, and `Usage` services +* Added: `Insight`, `Presence`, `Report`, `UsageEvent`, and `UsageGauge` models with list variants +* Added: `ProjectAuthMethod`, `ProjectProtocol`, and `ProjectService` models +* Added: `ProjectOAuthProviderId` and `ProjectOAuth2GooglePrompt` enums +* Updated: `Project`, `Database`, and `OAuth2Google` model schemas +* Updated: `X-Appwrite-Response-Format` header to `1.9.5` + +## 24.1.0 + +* Added: Introduced `bigint` create/update APIs for legacy Databases attributes +* Added: Introduced `bigint` create/update APIs for `TablesDB` columns +* Updated: Extended key-list query filters with `key`, `resourceType`, `resourceId`, and `secret` + +## 24.0.0 + +* [BREAKING] Renamed Webhook model fields: `security` → `tls`, `httpUser` → `authUsername`, `httpPass` → `authPassword`, `signatureKey` → `secret` +* [BREAKING] Renamed Webhook service parameters to match: `security` → `tls`, `httpUser` → `authUsername`, `httpPass` → `authPassword` +* [BREAKING] Renamed `Webhooks.updateSignature()` to `Webhooks.updateSecret()` with new optional `secret` parameter +* Added `Client.getHeaders()` method to retrieve request headers +* Added `secret` parameter to Webhook create and update methods +* Added `x` OAuth provider to `OAuthProvider` enum +* Added `userType` field to `Log` model +* Added `purge` parameter to `updateCollection` and `updateTable` for cache invalidation +* Added Project service: platform CRUD, key CRUD, protocol/service status management +* Added new models: `Key`, `KeyList`, `Project`, `DevKey`, `MockNumber`, `AuthProvider`, `PlatformAndroid`, `PlatformApple`, `PlatformLinux`, `PlatformList`, `PlatformWeb`, `PlatformWindows`, `BillingLimits`, `Block` +* Added new enums: `PlatformType`, `ProtocolId`, `ServiceId` +* Updated `BuildRuntime`, `Runtime` enums with `dart-3.11` and `flutter-3.41` +* Updated `Scopes` enum with `keysRead`, `keysWrite`, `platformsRead`, `platformsWrite` +* Updated `X-Appwrite-Response-Format` header to `1.9.1` +* Updated TTL description for list caching in Databases and TablesDB + +## 23.1.0 + +* Added: Added `getHeaders()` method to `Client` to expose current request headers +* Added: Added `package-lock.json` to track dependency lockfile in version control +* Updated: Improved MFA authenticator test data with realistic TOTP secret and URI values + +## 23.0.0 + +* [BREAKING] Changed `$sequence` type from `number` to `string` for `Row` and `Document` models +* [BREAKING] Renamed `IndexType` enum: split into `DatabasesIndexType` (with new `Spatial` value) and `TablesDBIndexType` +* [BREAKING] Replaced `specification` parameter with `buildSpecification` and `runtimeSpecification` in `Functions.create()`, `Functions.update()`, `Sites.create()`, `Sites.update()` +* Added new `Project` service with full CRUD for project-level environment variables +* Added new `Webhooks` service with full CRUD for project webhooks (including `updateSignature`) +* Added `Users.updateImpersonator()` method for enabling/disabling user impersonation +* Added impersonation support: `setImpersonateUserId()`, `setImpersonateUserEmail()`, `setImpersonateUserPhone()` on `Client` +* Added `impersonator` and `impersonatorUserId` optional fields to `User` model +* Added `deploymentRetention` parameter to Functions and Sites create/update +* Added `startCommand` parameter to Sites create/update +* Added `Webhook` and `WebhookList` models +* Added `Documentsdb`, `Vectorsdb` values to `BackupServices` and `DatabaseType` enums +* Added `WebhooksRead`, `WebhooksWrite`, `ProjectRead`, `ProjectWrite` scopes +* Added custom `toString()` on response data using `JSONbig.stringify` for BigInt support +* Removed `getQueueBillingProjectAggregation`, `getQueueBillingTeamAggregation`, `getQueuePriorityBuilds`, `getQueueRegionManager`, `getQueueThreats` from `Health` service +* Updated `Log` model field descriptions to clarify impersonation behavior +* Updated `X-Appwrite-Response-Format` header to `1.9.0` + +## 22.1.2 + +* Fix very large double values (for example 1.7976931348623157e+308) from being expanded into giant integer literals + +## 22.1.1 + +* Removed unused BigNumber import from src/client.ts to clean up dependencies +* Updated documentation examples to include the new encrypt option for text-like attributes (encrypt: false) across multiple examples +* Updated README to specify Appwrite server compatibility with 1.8.x +* Repo cleanup: removed obsolete GitHub workflow and issue template files as part of repository cleanup (non-breaking) + +## 22.0.1 + +* Fix doc examples with proper formatting +* Add support for the new `Backups` service + +## 22.0.0 + +* Add array-based enum parameters (e.g., `permissions: BrowserPermission[]`). +* Breaking change: `Output` enum has been removed; use `ImageFormat` instead. +* Add `getQueueAudits` support to `Health` service. +* Add longtext/mediumtext/text/varchar attribute and column helpers to `Databases` and `TablesDB` services. + +## 21.1.0 + +* Added ability to create columns and indexes synchronously while creating a table + +## 21.0.0 + +* Rename `VCSDeploymentType` enum to `VCSReferenceType` +* Change `createTemplateDeployment` method signature: replace `version` parameter with `type` (TemplateReferenceType) and `reference` parameters +* Add `getScreenshot` method to `Avatars` service +* Add `Theme`, `Timezone` and `Output` enums + +## 20.3.0 + +* Add `total` parameter to list queries allowing skipping counting rows in a table for improved performance +* Add `Operator` class for atomic modification of rows via update, bulk update, upsert, and bulk upsert operations +* Add `createResendProvider` and `updateResendProvider` methods to `Messaging` service + +## 20.2.1 + +* Add transaction support for Databases and TablesDB + +## 20.1.0 + +* Deprecate `createVerification` method in `Account` service +* Add `createEmailVerification` method in `Account` service + +## 17.2.0 + +* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service +* Fix autocompletion not working for `Document` model even when generic is passed + +## 17.1.0 + +* Add `upsertDocument` method +* Add `dart-3.8` and `flutter-3.32` runtimes +* Add `gif` image format +* Update bulk operation methods to reflect warning message +* Fix file parameter handling in chunked upload method + +## 17.0.0 + +* Add `REGION` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime`, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Updates enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Removes `search` param from `listExecutions` method + +## 16.0.0 + +* Fix: remove content-type from GET requests +* Update (breaking): min and max params are now optional in `updateFloatAttribute` and `updateIntegerAttribute` methods (changes their positioning in method definition) + +## 15.0.1 + +* Remove titles from all function descriptions +* Fix typing for collection "attribute" key +* Remove unnecessary awaits and asyncs +* Ensure `AppwriteException` response is always string + +## 15.0.0 + +* Fix: pong response & chunked upload + +## 14.2.0 + +* Add new push message parameters + +## 14.1.0 + +* Support updating attribute name and size + +## 14.0.0 + +* Support for Appwrite 1.6 +* Add `key` attribute to `Runtime` response model. +* Add `buildSize` attribute to `Deployments` response model +* Add `scheduledAt` attribute to `Executions` response model +* Add `scopes` attribute to `Functions` response model +* Add `specifications` attribute to `Functions` response model +* Add new response model for `Specifications` +* Add new response model for `Builds` +* Add `createJWT()` : Enables creating a JWT using the `userId` +* Add `listSpecifications()`: Enables listing available runtime specifications +* Add `deleteExecution()` : Enables deleting executions +* Add `updateDeploymentBuild()`: Enables cancelling a deployment +* Add `scheduledAt` parameter to `createExecution()`: Enables creating a delayed execution +* Breaking changes + * Remove `otp` parameter from `deleteMFAAuthenticator`. + * Add `scopes` parameter for create/update function. + * Rename `templateBranch` to `templateVersion` in `createFunction()`. + * Rename `downloadDeployment()` to `getDeploymentDownload()` + +> You can find the new syntax for breaking changes in the [Appwrite API references](https://appwrite.io/docs/references). Select version `1.6.x`. diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..6f8702b5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..62fd49f6 --- /dev/null +++ b/README.md @@ -0,0 +1,175 @@ +# Appwrite Node.js SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.9.5-blue.svg?style=flat-square) +[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) +[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) +[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) + +**This SDK is compatible with Appwrite server version 1.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-node/releases).** + + > This is the Node.js SDK for integrating with Appwrite from your Node.js server-side code. + If you're looking to integrate from the browser, you should check [appwrite/sdk-for-web](https://github.com/appwrite/sdk-for-web) + +Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Node.js SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) + +![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) + +## Installation + +To install via [NPM](https://www.npmjs.com/): + +```bash +npm install node-appwrite --save +``` + + +## Getting Started + +### Init your SDK + +Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key project API keys section. + +```js +const sdk = require('node-appwrite'); + +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSelfSigned() // Use only on dev mode with a self-signed SSL cert +; +``` + +### Make Your First Request + +Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section. + +```js +let users = new sdk.Users(client); + +let promise = users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Full Example +```js +const sdk = require('node-appwrite'); + +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key + .setSelfSigned() // Use only on dev mode with a self-signed SSL cert +; + +let users = new sdk.Users(client); +let promise = users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Type Safety with Models + +The Appwrite Node SDK provides type safety when working with database documents through generic methods. Methods like `listDocuments`, `getDocument`, and others accept a generic type parameter that allows you to specify your custom model type for full type safety. + +**TypeScript:** +```typescript +interface Book { + name: string; + author: string; + releaseYear?: string; + category?: string; + genre?: string[]; + isCheckedOut: boolean; +} + +const databases = new Databases(client); + +try { + const documents = await databases.listDocuments<Book>( + 'your-database-id', + 'your-collection-id' + ); + + documents.documents.forEach(book => { + console.log(`Book: ${book.name} by ${book.author}`); // Now you have full type safety + }); +} catch (error) { + console.error('Appwrite error:', error); +} +``` + +**JavaScript (with JSDoc for type hints):** +```javascript +/** + * @typedef {Object} Book + * @property {string} name + * @property {string} author + * @property {string} [releaseYear] + * @property {string} [category] + * @property {string[]} [genre] + * @property {boolean} isCheckedOut + */ + +const databases = new Databases(client); + +try { + /** @type {Models.DocumentList<Book>} */ + const documents = await databases.listDocuments( + 'your-database-id', + 'your-collection-id' + ); + + documents.documents.forEach(book => { + console.log(`Book: ${book.name} by ${book.author}`); // Type hints available in IDE + }); +} catch (error) { + console.error('Appwrite error:', error); +} +``` + +**Tip**: You can use the `appwrite types` command to automatically generate TypeScript interfaces based on your Appwrite database schema. Learn more about [type generation](https://appwrite.io/docs/products/databases/type-generation). + +### Error Handling + +The Appwrite Node SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example. + +```js +let users = new sdk.Users(client); + +try { + let res = await users.create(sdk.ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien"); +} catch(e) { + console.log(e.message); +} +``` + +### Learn more +You can use the following resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Node Playground](https://github.com/appwrite/playground-for-node) + + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md new file mode 100644 index 00000000..036df9b9 --- /dev/null +++ b/docs/examples/account/create-anonymous-session.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createAnonymousSession(); +``` diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md new file mode 100644 index 00000000..125d73bb --- /dev/null +++ b/docs/examples/account/create-email-password-session.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createEmailPasswordSession({ + email: 'email@example.com', + password: 'password' +}); +``` diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md new file mode 100644 index 00000000..cebf1f61 --- /dev/null +++ b/docs/examples/account/create-email-token.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createEmailToken({ + userId: '<USER_ID>', + email: 'email@example.com', + phrase: false // optional +}); +``` diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md new file mode 100644 index 00000000..6c74da96 --- /dev/null +++ b/docs/examples/account/create-email-verification.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createEmailVerification({ + url: 'https://example.com' +}); +``` diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md new file mode 100644 index 00000000..c7204e0f --- /dev/null +++ b/docs/examples/account/create-jwt.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createJWT({ + duration: 0 // optional +}); +``` diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md new file mode 100644 index 00000000..ee5f1432 --- /dev/null +++ b/docs/examples/account/create-magic-url-token.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createMagicURLToken({ + userId: '<USER_ID>', + email: 'email@example.com', + url: 'https://example.com', // optional + phrase: false // optional +}); +``` diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md new file mode 100644 index 00000000..25081e27 --- /dev/null +++ b/docs/examples/account/create-mfa-authenticator.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createMFAAuthenticator({ + type: sdk.AuthenticatorType.Totp +}); +``` diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md new file mode 100644 index 00000000..af4e0448 --- /dev/null +++ b/docs/examples/account/create-mfa-challenge.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createMFAChallenge({ + factor: sdk.AuthenticationFactor.Email +}); +``` diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 00000000..5e8e4021 --- /dev/null +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createMFARecoveryCodes(); +``` diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md new file mode 100644 index 00000000..7bc8a243 --- /dev/null +++ b/docs/examples/account/create-o-auth-2-token.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createOAuth2Token({ + provider: sdk.OAuthProvider.Amazon, + success: 'https://example.com', // optional + failure: 'https://example.com', // optional + scopes: [] // optional +}); +``` diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md new file mode 100644 index 00000000..999f3e10 --- /dev/null +++ b/docs/examples/account/create-phone-token.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createPhoneToken({ + userId: '<USER_ID>', + phone: '+12065550100' +}); +``` diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md new file mode 100644 index 00000000..05708153 --- /dev/null +++ b/docs/examples/account/create-phone-verification.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createPhoneVerification(); +``` diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md new file mode 100644 index 00000000..4dd41d7e --- /dev/null +++ b/docs/examples/account/create-recovery.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createRecovery({ + email: 'email@example.com', + url: 'https://example.com' +}); +``` diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md new file mode 100644 index 00000000..3ab786f9 --- /dev/null +++ b/docs/examples/account/create-session.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createSession({ + userId: '<USER_ID>', + secret: '<SECRET>' +}); +``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md new file mode 100644 index 00000000..95dec7e3 --- /dev/null +++ b/docs/examples/account/create-verification.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createVerification({ + url: 'https://example.com' +}); +``` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md new file mode 100644 index 00000000..db31f30b --- /dev/null +++ b/docs/examples/account/create.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.create({ + userId: '<USER_ID>', + email: 'email@example.com', + password: '', + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md new file mode 100644 index 00000000..53a043bf --- /dev/null +++ b/docs/examples/account/delete-identity.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteIdentity({ + identityId: '<IDENTITY_ID>' +}); +``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md new file mode 100644 index 00000000..18522f2d --- /dev/null +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteMFAAuthenticator({ + type: sdk.AuthenticatorType.Totp +}); +``` diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md new file mode 100644 index 00000000..7fe49e3f --- /dev/null +++ b/docs/examples/account/delete-session.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteSession({ + sessionId: '<SESSION_ID>' +}); +``` diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md new file mode 100644 index 00000000..912575ce --- /dev/null +++ b/docs/examples/account/delete-sessions.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteSessions(); +``` diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 00000000..cb08fe7c --- /dev/null +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getMFARecoveryCodes(); +``` diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md new file mode 100644 index 00000000..67edf19f --- /dev/null +++ b/docs/examples/account/get-prefs.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getPrefs(); +``` diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md new file mode 100644 index 00000000..dab81595 --- /dev/null +++ b/docs/examples/account/get-session.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getSession({ + sessionId: '<SESSION_ID>' +}); +``` diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md new file mode 100644 index 00000000..e755aa46 --- /dev/null +++ b/docs/examples/account/get.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.get(); +``` diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md new file mode 100644 index 00000000..00d60b9e --- /dev/null +++ b/docs/examples/account/list-identities.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listIdentities({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md new file mode 100644 index 00000000..d7e89331 --- /dev/null +++ b/docs/examples/account/list-logs.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listLogs({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md new file mode 100644 index 00000000..31362190 --- /dev/null +++ b/docs/examples/account/list-mfa-factors.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listMFAFactors(); +``` diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md new file mode 100644 index 00000000..0bbd093e --- /dev/null +++ b/docs/examples/account/list-sessions.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listSessions(); +``` diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md new file mode 100644 index 00000000..4fd5953b --- /dev/null +++ b/docs/examples/account/update-email-verification.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateEmailVerification({ + userId: '<USER_ID>', + secret: '<SECRET>' +}); +``` diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md new file mode 100644 index 00000000..985c189b --- /dev/null +++ b/docs/examples/account/update-email.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateEmail({ + email: 'email@example.com', + password: 'password' +}); +``` diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md new file mode 100644 index 00000000..1811200a --- /dev/null +++ b/docs/examples/account/update-magic-url-session.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMagicURLSession({ + userId: '<USER_ID>', + secret: '<SECRET>' +}); +``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md new file mode 100644 index 00000000..fa34ef45 --- /dev/null +++ b/docs/examples/account/update-mfa-authenticator.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMFAAuthenticator({ + type: sdk.AuthenticatorType.Totp, + otp: '<OTP>' +}); +``` diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md new file mode 100644 index 00000000..a584356b --- /dev/null +++ b/docs/examples/account/update-mfa-challenge.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMFAChallenge({ + challengeId: '<CHALLENGE_ID>', + otp: '<OTP>' +}); +``` diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 00000000..c893c231 --- /dev/null +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMFARecoveryCodes(); +``` diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md new file mode 100644 index 00000000..38604a3b --- /dev/null +++ b/docs/examples/account/update-mfa.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMFA({ + mfa: false +}); +``` diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md new file mode 100644 index 00000000..24fb8692 --- /dev/null +++ b/docs/examples/account/update-name.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateName({ + name: '<NAME>' +}); +``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md new file mode 100644 index 00000000..f6b7bb54 --- /dev/null +++ b/docs/examples/account/update-password.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePassword({ + password: '', + oldPassword: 'password' // optional +}); +``` diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md new file mode 100644 index 00000000..204c33a7 --- /dev/null +++ b/docs/examples/account/update-phone-session.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePhoneSession({ + userId: '<USER_ID>', + secret: '<SECRET>' +}); +``` diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md new file mode 100644 index 00000000..c5e1abd3 --- /dev/null +++ b/docs/examples/account/update-phone-verification.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePhoneVerification({ + userId: '<USER_ID>', + secret: '<SECRET>' +}); +``` diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md new file mode 100644 index 00000000..c6763022 --- /dev/null +++ b/docs/examples/account/update-phone.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePhone({ + phone: '+12065550100', + password: 'password' +}); +``` diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md new file mode 100644 index 00000000..65c70e0e --- /dev/null +++ b/docs/examples/account/update-prefs.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePrefs({ + prefs: { + "language": "en", + "timezone": "UTC", + "darkTheme": true + } +}); +``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md new file mode 100644 index 00000000..268f3e97 --- /dev/null +++ b/docs/examples/account/update-recovery.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateRecovery({ + userId: '<USER_ID>', + secret: '<SECRET>', + password: '' +}); +``` diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md new file mode 100644 index 00000000..9dfcbf26 --- /dev/null +++ b/docs/examples/account/update-session.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateSession({ + sessionId: '<SESSION_ID>' +}); +``` diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md new file mode 100644 index 00000000..ffb3f25e --- /dev/null +++ b/docs/examples/account/update-status.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateStatus(); +``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md new file mode 100644 index 00000000..0486ce39 --- /dev/null +++ b/docs/examples/account/update-verification.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateVerification({ + userId: '<USER_ID>', + secret: '<SECRET>' +}); +``` diff --git a/docs/examples/activities/get-event.md b/docs/examples/activities/get-event.md new file mode 100644 index 00000000..da7c261f --- /dev/null +++ b/docs/examples/activities/get-event.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const activities = new sdk.Activities(client); + +const result = await activities.getEvent({ + eventId: '<EVENT_ID>' +}); +``` diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md new file mode 100644 index 00000000..11407e89 --- /dev/null +++ b/docs/examples/activities/list-events.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const activities = new sdk.Activities(client); + +const result = await activities.listEvents({ + queries: '' // optional +}); +``` diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md new file mode 100644 index 00000000..8169db07 --- /dev/null +++ b/docs/examples/advisor/delete-report.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const advisor = new sdk.Advisor(client); + +const result = await advisor.deleteReport({ + reportId: '<REPORT_ID>' +}); +``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md new file mode 100644 index 00000000..7a625d28 --- /dev/null +++ b/docs/examples/advisor/get-insight.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const advisor = new sdk.Advisor(client); + +const result = await advisor.getInsight({ + reportId: '<REPORT_ID>', + insightId: '<INSIGHT_ID>' +}); +``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md new file mode 100644 index 00000000..abd111c0 --- /dev/null +++ b/docs/examples/advisor/get-report.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const advisor = new sdk.Advisor(client); + +const result = await advisor.getReport({ + reportId: '<REPORT_ID>' +}); +``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md new file mode 100644 index 00000000..a4adefac --- /dev/null +++ b/docs/examples/advisor/list-insights.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const advisor = new sdk.Advisor(client); + +const result = await advisor.listInsights({ + reportId: '<REPORT_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md new file mode 100644 index 00000000..6fa66f10 --- /dev/null +++ b/docs/examples/advisor/list-reports.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const advisor = new sdk.Advisor(client); + +const result = await advisor.listReports({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md new file mode 100644 index 00000000..6ffb388d --- /dev/null +++ b/docs/examples/avatars/get-browser.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getBrowser({ + code: sdk.Browser.AvantBrowser, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +}); +``` diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md new file mode 100644 index 00000000..ea806baf --- /dev/null +++ b/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getCreditCard({ + code: sdk.CreditCard.AmericanExpress, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +}); +``` diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md new file mode 100644 index 00000000..bd9ae2ca --- /dev/null +++ b/docs/examples/avatars/get-favicon.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getFavicon({ + url: 'https://example.com' +}); +``` diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md new file mode 100644 index 00000000..d05b666b --- /dev/null +++ b/docs/examples/avatars/get-flag.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getFlag({ + code: sdk.Flag.Afghanistan, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +}); +``` diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md new file mode 100644 index 00000000..6f013db1 --- /dev/null +++ b/docs/examples/avatars/get-image.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getImage({ + url: 'https://example.com', + width: 0, // optional + height: 0 // optional +}); +``` diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md new file mode 100644 index 00000000..3d35c6df --- /dev/null +++ b/docs/examples/avatars/get-initials.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getInitials({ + name: '<NAME>', // optional + width: 0, // optional + height: 0, // optional + background: '' // optional +}); +``` diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md new file mode 100644 index 00000000..e4235a38 --- /dev/null +++ b/docs/examples/avatars/get-qr.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getQR({ + text: '<TEXT>', + size: 1, // optional + margin: 0, // optional + download: false // optional +}); +``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md new file mode 100644 index 00000000..1aab6cd3 --- /dev/null +++ b/docs/examples/avatars/get-screenshot.md @@ -0,0 +1,36 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getScreenshot({ + url: 'https://example.com', + headers: { + "Authorization": "Bearer token123", + "X-Custom-Header": "value" + }, // optional + viewportWidth: 1920, // optional + viewportHeight: 1080, // optional + scale: 2, // optional + theme: sdk.Theme.Dark, // optional + userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional + fullpage: true, // optional + locale: 'en-US', // optional + timezone: sdk.Timezone.AmericaNewYork, // optional + latitude: 37.7749, // optional + longitude: -122.4194, // optional + accuracy: 100, // optional + touch: true, // optional + permissions: [sdk.BrowserPermission.Geolocation, sdk.BrowserPermission.Notifications], // optional + sleep: 3, // optional + width: 800, // optional + height: 600, // optional + quality: 85, // optional + output: sdk.ImageFormat.Jpeg // optional +}); +``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 00000000..1a11d459 --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.createArchive({ + services: [sdk.BackupServices.Databases], + resourceId: '<RESOURCE_ID>' // optional +}); +``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md new file mode 100644 index 00000000..71670929 --- /dev/null +++ b/docs/examples/backups/create-policy.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.createPolicy({ + policyId: '<POLICY_ID>', + services: [sdk.BackupServices.Databases], + retention: 1, + schedule: '', + name: '<NAME>', // optional + resourceId: '<RESOURCE_ID>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md new file mode 100644 index 00000000..f41a2344 --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.createRestoration({ + archiveId: '<ARCHIVE_ID>', + services: [sdk.BackupServices.Databases], + newResourceId: '<NEW_RESOURCE_ID>', // optional + newResourceName: '<NEW_RESOURCE_NAME>' // optional +}); +``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md new file mode 100644 index 00000000..f0c5615d --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.deleteArchive({ + archiveId: '<ARCHIVE_ID>' +}); +``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md new file mode 100644 index 00000000..493e89ef --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.deletePolicy({ + policyId: '<POLICY_ID>' +}); +``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md new file mode 100644 index 00000000..ade4e222 --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.getArchive({ + archiveId: '<ARCHIVE_ID>' +}); +``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md new file mode 100644 index 00000000..391c0196 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.getPolicy({ + policyId: '<POLICY_ID>' +}); +``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md new file mode 100644 index 00000000..46d18f3a --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.getRestoration({ + restorationId: '<RESTORATION_ID>' +}); +``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md new file mode 100644 index 00000000..d6f51c56 --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.listArchives({ + queries: [] // optional +}); +``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md new file mode 100644 index 00000000..7f87b1d6 --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.listPolicies({ + queries: [] // optional +}); +``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md new file mode 100644 index 00000000..4475a17d --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.listRestorations({ + queries: [] // optional +}); +``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md new file mode 100644 index 00000000..5912b39f --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const backups = new sdk.Backups(client); + +const result = await backups.updatePolicy({ + policyId: '<POLICY_ID>', + name: '<NAME>', // optional + retention: 1, // optional + schedule: '', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md new file mode 100644 index 00000000..3d40ce75 --- /dev/null +++ b/docs/examples/databases/create-big-int-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createBigIntAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md new file mode 100644 index 00000000..606ca49c --- /dev/null +++ b/docs/examples/databases/create-boolean-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createBooleanAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: false, // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md new file mode 100644 index 00000000..b58e0919 --- /dev/null +++ b/docs/examples/databases/create-collection.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createCollection({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + attributes: [], // optional + indexes: [] // optional +}); +``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md new file mode 100644 index 00000000..361ee95e --- /dev/null +++ b/docs/examples/databases/create-datetime-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createDatetimeAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md new file mode 100644 index 00000000..3c38b69e --- /dev/null +++ b/docs/examples/databases/create-document.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.createDocument({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 30, + "isAdmin": false + }, + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md new file mode 100644 index 00000000..60f4eab8 --- /dev/null +++ b/docs/examples/databases/create-documents.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createDocuments({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documents: [], + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md new file mode 100644 index 00000000..13382c3d --- /dev/null +++ b/docs/examples/databases/create-email-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createEmailAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: 'email@example.com', // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md new file mode 100644 index 00000000..fe7abce4 --- /dev/null +++ b/docs/examples/databases/create-enum-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createEnumAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md new file mode 100644 index 00000000..f179528f --- /dev/null +++ b/docs/examples/databases/create-float-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createFloatAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md new file mode 100644 index 00000000..ba3bf3a6 --- /dev/null +++ b/docs/examples/databases/create-index.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createIndex({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + type: sdk.DatabasesIndexType.Key, + attributes: [], + orders: [sdk.OrderBy.Asc], // optional + lengths: [] // optional +}); +``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md new file mode 100644 index 00000000..d0dbed90 --- /dev/null +++ b/docs/examples/databases/create-integer-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createIntegerAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md new file mode 100644 index 00000000..c21ad541 --- /dev/null +++ b/docs/examples/databases/create-ip-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createIpAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '', // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md new file mode 100644 index 00000000..8d615095 --- /dev/null +++ b/docs/examples/databases/create-line-attribute.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createLineAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]] // optional +}); +``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md new file mode 100644 index 00000000..b49077ee --- /dev/null +++ b/docs/examples/databases/create-longtext-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createLongtextAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md new file mode 100644 index 00000000..44d9199f --- /dev/null +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createMediumtextAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md new file mode 100644 index 00000000..06a3c468 --- /dev/null +++ b/docs/examples/databases/create-operations.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createOperations({ + transactionId: '<TRANSACTION_ID>', + operations: [ + { + "action": "create", + "databaseId": "<DATABASE_ID>", + "collectionId": "<COLLECTION_ID>", + "documentId": "<DOCUMENT_ID>", + "data": { + "name": "Walter O'Brien" + } + } + ] // optional +}); +``` diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md new file mode 100644 index 00000000..57058752 --- /dev/null +++ b/docs/examples/databases/create-point-attribute.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createPointAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: [1, 2] // optional +}); +``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md new file mode 100644 index 00000000..f3562ab4 --- /dev/null +++ b/docs/examples/databases/create-polygon-attribute.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createPolygonAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional +}); +``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md new file mode 100644 index 00000000..30d4dfd7 --- /dev/null +++ b/docs/examples/databases/create-relationship-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createRelationshipAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + relatedCollectionId: '<RELATED_COLLECTION_ID>', + type: sdk.RelationshipType.OneToOne, + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: sdk.RelationMutate.Cascade // optional +}); +``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md new file mode 100644 index 00000000..e0c2cdb4 --- /dev/null +++ b/docs/examples/databases/create-string-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createStringAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + size: 1, + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md new file mode 100644 index 00000000..48fd6ded --- /dev/null +++ b/docs/examples/databases/create-text-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createTextAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md new file mode 100644 index 00000000..8785149a --- /dev/null +++ b/docs/examples/databases/create-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createTransaction({ + ttl: 60 // optional +}); +``` diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md new file mode 100644 index 00000000..f0d1a29a --- /dev/null +++ b/docs/examples/databases/create-url-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createUrlAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: 'https://example.com', // optional + array: false // optional +}); +``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md new file mode 100644 index 00000000..64582747 --- /dev/null +++ b/docs/examples/databases/create-varchar-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createVarcharAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + size: 1, + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md new file mode 100644 index 00000000..d35731b6 --- /dev/null +++ b/docs/examples/databases/create.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.create({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +}); +``` diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md new file mode 100644 index 00000000..80fe2486 --- /dev/null +++ b/docs/examples/databases/decrement-document-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.decrementDocumentAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + attribute: '', + value: null, // optional + min: null, // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md new file mode 100644 index 00000000..30501051 --- /dev/null +++ b/docs/examples/databases/delete-attribute.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +}); +``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md new file mode 100644 index 00000000..2da5c205 --- /dev/null +++ b/docs/examples/databases/delete-collection.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteCollection({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>' +}); +``` diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md new file mode 100644 index 00000000..22bc7143 --- /dev/null +++ b/docs/examples/databases/delete-document.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.deleteDocument({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md new file mode 100644 index 00000000..4851243e --- /dev/null +++ b/docs/examples/databases/delete-documents.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteDocuments({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md new file mode 100644 index 00000000..b7a8f0c3 --- /dev/null +++ b/docs/examples/databases/delete-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteIndex({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +}); +``` diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md new file mode 100644 index 00000000..b89214ba --- /dev/null +++ b/docs/examples/databases/delete-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteTransaction({ + transactionId: '<TRANSACTION_ID>' +}); +``` diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md new file mode 100644 index 00000000..00009485 --- /dev/null +++ b/docs/examples/databases/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.delete({ + databaseId: '<DATABASE_ID>' +}); +``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md new file mode 100644 index 00000000..eade77dd --- /dev/null +++ b/docs/examples/databases/get-attribute.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.getAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +}); +``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md new file mode 100644 index 00000000..8b96abaf --- /dev/null +++ b/docs/examples/databases/get-collection.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.getCollection({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>' +}); +``` diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md new file mode 100644 index 00000000..9a66df4f --- /dev/null +++ b/docs/examples/databases/get-document.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.getDocument({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md new file mode 100644 index 00000000..1900b0f5 --- /dev/null +++ b/docs/examples/databases/get-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.getIndex({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +}); +``` diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md new file mode 100644 index 00000000..09c0255a --- /dev/null +++ b/docs/examples/databases/get-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.getTransaction({ + transactionId: '<TRANSACTION_ID>' +}); +``` diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md new file mode 100644 index 00000000..9533a738 --- /dev/null +++ b/docs/examples/databases/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.get({ + databaseId: '<DATABASE_ID>' +}); +``` diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md new file mode 100644 index 00000000..cb24d704 --- /dev/null +++ b/docs/examples/databases/increment-document-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.incrementDocumentAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + attribute: '', + value: null, // optional + max: null, // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md new file mode 100644 index 00000000..635391cd --- /dev/null +++ b/docs/examples/databases/list-attributes.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.listAttributes({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md new file mode 100644 index 00000000..38f1f3eb --- /dev/null +++ b/docs/examples/databases/list-collections.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.listCollections({ + databaseId: '<DATABASE_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md new file mode 100644 index 00000000..11fcec2d --- /dev/null +++ b/docs/examples/databases/list-documents.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.listDocuments({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>', // optional + total: false, // optional + ttl: 0 // optional +}); +``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md new file mode 100644 index 00000000..c6411092 --- /dev/null +++ b/docs/examples/databases/list-indexes.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.listIndexes({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md new file mode 100644 index 00000000..4707b131 --- /dev/null +++ b/docs/examples/databases/list-transactions.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.listTransactions({ + queries: [] // optional +}); +``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md new file mode 100644 index 00000000..d88d05ee --- /dev/null +++ b/docs/examples/databases/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md new file mode 100644 index 00000000..1ff012a5 --- /dev/null +++ b/docs/examples/databases/update-big-int-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateBigIntAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md new file mode 100644 index 00000000..c9b165e9 --- /dev/null +++ b/docs/examples/databases/update-boolean-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateBooleanAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: false, + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md new file mode 100644 index 00000000..f7f65c32 --- /dev/null +++ b/docs/examples/databases/update-collection.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateCollection({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + purge: false // optional +}); +``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md new file mode 100644 index 00000000..6c65696b --- /dev/null +++ b/docs/examples/databases/update-datetime-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateDatetimeAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md new file mode 100644 index 00000000..cae4ccfe --- /dev/null +++ b/docs/examples/databases/update-document.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.updateDocument({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md new file mode 100644 index 00000000..168074c1 --- /dev/null +++ b/docs/examples/databases/update-documents.md @@ -0,0 +1,24 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateDocuments({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md new file mode 100644 index 00000000..fa6c4319 --- /dev/null +++ b/docs/examples/databases/update-email-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateEmailAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: 'email@example.com', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md new file mode 100644 index 00000000..0fc74cdf --- /dev/null +++ b/docs/examples/databases/update-enum-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateEnumAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md new file mode 100644 index 00000000..894ab665 --- /dev/null +++ b/docs/examples/databases/update-float-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateFloatAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md new file mode 100644 index 00000000..10ddb38f --- /dev/null +++ b/docs/examples/databases/update-integer-attribute.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateIntegerAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md new file mode 100644 index 00000000..5e53e5d7 --- /dev/null +++ b/docs/examples/databases/update-ip-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateIpAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md new file mode 100644 index 00000000..c106a035 --- /dev/null +++ b/docs/examples/databases/update-line-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateLineAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]], // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md new file mode 100644 index 00000000..d21f3988 --- /dev/null +++ b/docs/examples/databases/update-longtext-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateLongtextAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md new file mode 100644 index 00000000..25857d5d --- /dev/null +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateMediumtextAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md new file mode 100644 index 00000000..96a4ae85 --- /dev/null +++ b/docs/examples/databases/update-point-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updatePointAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: [1, 2], // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md new file mode 100644 index 00000000..72828a8a --- /dev/null +++ b/docs/examples/databases/update-polygon-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updatePolygonAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md new file mode 100644 index 00000000..9dc8ebd7 --- /dev/null +++ b/docs/examples/databases/update-relationship-attribute.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateRelationshipAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + onDelete: sdk.RelationMutate.Cascade, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md new file mode 100644 index 00000000..1c509d28 --- /dev/null +++ b/docs/examples/databases/update-string-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateStringAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md new file mode 100644 index 00000000..3154f5a9 --- /dev/null +++ b/docs/examples/databases/update-text-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateTextAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md new file mode 100644 index 00000000..a83cb03b --- /dev/null +++ b/docs/examples/databases/update-transaction.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateTransaction({ + transactionId: '<TRANSACTION_ID>', + commit: false, // optional + rollback: false // optional +}); +``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md new file mode 100644 index 00000000..1cebc2f4 --- /dev/null +++ b/docs/examples/databases/update-url-attribute.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateUrlAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: 'https://example.com', + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md new file mode 100644 index 00000000..43a1cf03 --- /dev/null +++ b/docs/examples/databases/update-varchar-attribute.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateVarcharAttribute({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md new file mode 100644 index 00000000..36ff3bd1 --- /dev/null +++ b/docs/examples/databases/update.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.update({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md new file mode 100644 index 00000000..13e882ad --- /dev/null +++ b/docs/examples/databases/upsert-document.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.upsertDocument({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 30, + "isAdmin": false + }, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md new file mode 100644 index 00000000..2a304924 --- /dev/null +++ b/docs/examples/databases/upsert-documents.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.upsertDocuments({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documents: [], + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md new file mode 100644 index 00000000..0cd67cbf --- /dev/null +++ b/docs/examples/functions/create-deployment.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); +const fs = require('fs'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createDeployment({ + functionId: '<FUNCTION_ID>', + code: InputFile.fromPath('/path/to/file', 'filename'), + activate: false, + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>' // optional +}); +``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md new file mode 100644 index 00000000..f5abb222 --- /dev/null +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createDuplicateDeployment({ + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', + buildId: '<BUILD_ID>' // optional +}); +``` diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md new file mode 100644 index 00000000..f93d87e4 --- /dev/null +++ b/docs/examples/functions/create-execution.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new sdk.Functions(client); + +const result = await functions.createExecution({ + functionId: '<FUNCTION_ID>', + body: '<BODY>', // optional + async: false, // optional + xpath: '<PATH>', // optional + method: sdk.ExecutionMethod.GET, // optional + headers: {}, // optional + scheduledAt: '<SCHEDULED_AT>' // optional +}); +``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md new file mode 100644 index 00000000..20977559 --- /dev/null +++ b/docs/examples/functions/create-template-deployment.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createTemplateDeployment({ + functionId: '<FUNCTION_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + rootDirectory: '<ROOT_DIRECTORY>', + type: sdk.TemplateReferenceType.Commit, + reference: '<REFERENCE>', + activate: false // optional +}); +``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md new file mode 100644 index 00000000..21246bbe --- /dev/null +++ b/docs/examples/functions/create-variable.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createVariable({ + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +}); +``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md new file mode 100644 index 00000000..4bf9d23b --- /dev/null +++ b/docs/examples/functions/create-vcs-deployment.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createVcsDeployment({ + functionId: '<FUNCTION_ID>', + type: sdk.VCSReferenceType.Branch, + reference: '<REFERENCE>', + activate: false // optional +}); +``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md new file mode 100644 index 00000000..4e3d5e95 --- /dev/null +++ b/docs/examples/functions/create.md @@ -0,0 +1,33 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.create({ + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: sdk.Runtime.Node145, + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>', // optional + scopes: [sdk.Scopes.ProjectRead], // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); +``` diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md new file mode 100644 index 00000000..20120ebd --- /dev/null +++ b/docs/examples/functions/delete-deployment.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.deleteDeployment({ + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md new file mode 100644 index 00000000..4d78ad9c --- /dev/null +++ b/docs/examples/functions/delete-execution.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.deleteExecution({ + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>' +}); +``` diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md new file mode 100644 index 00000000..b8ed9d54 --- /dev/null +++ b/docs/examples/functions/delete-variable.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.deleteVariable({ + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>' +}); +``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md new file mode 100644 index 00000000..446ca2a5 --- /dev/null +++ b/docs/examples/functions/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.delete({ + functionId: '<FUNCTION_ID>' +}); +``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md new file mode 100644 index 00000000..5e9a956d --- /dev/null +++ b/docs/examples/functions/get-deployment-download.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.getDeploymentDownload({ + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', + type: sdk.DeploymentDownloadType.Source // optional +}); +``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md new file mode 100644 index 00000000..29d9b2e6 --- /dev/null +++ b/docs/examples/functions/get-deployment.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.getDeployment({ + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md new file mode 100644 index 00000000..c987772d --- /dev/null +++ b/docs/examples/functions/get-execution.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new sdk.Functions(client); + +const result = await functions.getExecution({ + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>' +}); +``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md new file mode 100644 index 00000000..abc2e91d --- /dev/null +++ b/docs/examples/functions/get-variable.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.getVariable({ + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>' +}); +``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md new file mode 100644 index 00000000..97050f04 --- /dev/null +++ b/docs/examples/functions/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.get({ + functionId: '<FUNCTION_ID>' +}); +``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md new file mode 100644 index 00000000..c53aaa45 --- /dev/null +++ b/docs/examples/functions/list-deployments.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listDeployments({ + functionId: '<FUNCTION_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md new file mode 100644 index 00000000..b549100f --- /dev/null +++ b/docs/examples/functions/list-executions.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new sdk.Functions(client); + +const result = await functions.listExecutions({ + functionId: '<FUNCTION_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md new file mode 100644 index 00000000..fdaefd3a --- /dev/null +++ b/docs/examples/functions/list-runtimes.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listRuntimes(); +``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md new file mode 100644 index 00000000..0fc8b8d7 --- /dev/null +++ b/docs/examples/functions/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listSpecifications(); +``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md new file mode 100644 index 00000000..d09e5d05 --- /dev/null +++ b/docs/examples/functions/list-variables.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listVariables({ + functionId: '<FUNCTION_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md new file mode 100644 index 00000000..faeeaae7 --- /dev/null +++ b/docs/examples/functions/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md new file mode 100644 index 00000000..5d45a02a --- /dev/null +++ b/docs/examples/functions/update-deployment-status.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.updateDeploymentStatus({ + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md new file mode 100644 index 00000000..0dfd06f5 --- /dev/null +++ b/docs/examples/functions/update-function-deployment.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.updateFunctionDeployment({ + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md new file mode 100644 index 00000000..e0bdec98 --- /dev/null +++ b/docs/examples/functions/update-variable.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.updateVariable({ + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', // optional + value: '<VALUE>', // optional + secret: false // optional +}); +``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md new file mode 100644 index 00000000..fe60cad3 --- /dev/null +++ b/docs/examples/functions/update.md @@ -0,0 +1,33 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.update({ + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: sdk.Runtime.Node145, // optional + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>', // optional + scopes: [sdk.Scopes.ProjectRead], // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); +``` diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md new file mode 100644 index 00000000..31aa4bf3 --- /dev/null +++ b/docs/examples/graphql/mutation.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const graphql = new sdk.Graphql(client); + +const result = await graphql.mutation({ + query: {} +}); +``` diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md new file mode 100644 index 00000000..3bd436e0 --- /dev/null +++ b/docs/examples/graphql/query.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const graphql = new sdk.Graphql(client); + +const result = await graphql.query({ + query: {} +}); +``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md new file mode 100644 index 00000000..3f0c8345 --- /dev/null +++ b/docs/examples/health/get-antivirus.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getAntivirus(); +``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md new file mode 100644 index 00000000..a9525064 --- /dev/null +++ b/docs/examples/health/get-cache.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getCache(); +``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md new file mode 100644 index 00000000..571b3cdc --- /dev/null +++ b/docs/examples/health/get-certificate.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getCertificate({ + domain: '' // optional +}); +``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md new file mode 100644 index 00000000..a3dfca6f --- /dev/null +++ b/docs/examples/health/get-console-pausing.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getConsolePausing({ + threshold: null, // optional + inactivityDays: null // optional +}); +``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md new file mode 100644 index 00000000..45a840c9 --- /dev/null +++ b/docs/examples/health/get-db.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getDB(); +``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md new file mode 100644 index 00000000..e495453c --- /dev/null +++ b/docs/examples/health/get-failed-jobs.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getFailedJobs({ + name: sdk.Name.V1Database, + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md new file mode 100644 index 00000000..c03bb59e --- /dev/null +++ b/docs/examples/health/get-pub-sub.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getPubSub(); +``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 00000000..dcc7c6ce --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueAudits({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md new file mode 100644 index 00000000..da49e020 --- /dev/null +++ b/docs/examples/health/get-queue-builds.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueBuilds({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md new file mode 100644 index 00000000..ef065d59 --- /dev/null +++ b/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueCertificates({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md new file mode 100644 index 00000000..181621ec --- /dev/null +++ b/docs/examples/health/get-queue-databases.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueDatabases({ + name: '<NAME>', // optional + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md new file mode 100644 index 00000000..e1b5bc00 --- /dev/null +++ b/docs/examples/health/get-queue-deletes.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueDeletes({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md new file mode 100644 index 00000000..f40904a2 --- /dev/null +++ b/docs/examples/health/get-queue-functions.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueFunctions({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md new file mode 100644 index 00000000..437a86b0 --- /dev/null +++ b/docs/examples/health/get-queue-logs.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueLogs({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md new file mode 100644 index 00000000..3da627b8 --- /dev/null +++ b/docs/examples/health/get-queue-mails.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueMails({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md new file mode 100644 index 00000000..504ad1de --- /dev/null +++ b/docs/examples/health/get-queue-messaging.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueMessaging({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md new file mode 100644 index 00000000..59e45509 --- /dev/null +++ b/docs/examples/health/get-queue-migrations.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueMigrations({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md new file mode 100644 index 00000000..542d11e0 --- /dev/null +++ b/docs/examples/health/get-queue-stats-resources.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueStatsResources({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md new file mode 100644 index 00000000..86dbfb83 --- /dev/null +++ b/docs/examples/health/get-queue-usage.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueUsage({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 00000000..36c3037a --- /dev/null +++ b/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueWebhooks({ + threshold: null // optional +}); +``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md new file mode 100644 index 00000000..15933394 --- /dev/null +++ b/docs/examples/health/get-storage-local.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getStorageLocal(); +``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md new file mode 100644 index 00000000..75ec5cb8 --- /dev/null +++ b/docs/examples/health/get-storage.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getStorage(); +``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md new file mode 100644 index 00000000..86d86174 --- /dev/null +++ b/docs/examples/health/get-time.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getTime(); +``` diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md new file mode 100644 index 00000000..bfb883b6 --- /dev/null +++ b/docs/examples/health/get.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.get(); +``` diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md new file mode 100644 index 00000000..004a9325 --- /dev/null +++ b/docs/examples/locale/get.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.get(); +``` diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md new file mode 100644 index 00000000..136992f4 --- /dev/null +++ b/docs/examples/locale/list-codes.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCodes(); +``` diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md new file mode 100644 index 00000000..aa58ec57 --- /dev/null +++ b/docs/examples/locale/list-continents.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listContinents(); +``` diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md new file mode 100644 index 00000000..538b4927 --- /dev/null +++ b/docs/examples/locale/list-countries-eu.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCountriesEU(); +``` diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md new file mode 100644 index 00000000..c2701418 --- /dev/null +++ b/docs/examples/locale/list-countries-phones.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCountriesPhones(); +``` diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md new file mode 100644 index 00000000..99ee2d35 --- /dev/null +++ b/docs/examples/locale/list-countries.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCountries(); +``` diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md new file mode 100644 index 00000000..c381774d --- /dev/null +++ b/docs/examples/locale/list-currencies.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCurrencies(); +``` diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md new file mode 100644 index 00000000..cfd522c6 --- /dev/null +++ b/docs/examples/locale/list-languages.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listLanguages(); +``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md new file mode 100644 index 00000000..dc203a39 --- /dev/null +++ b/docs/examples/messaging/create-apns-provider.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createAPNSProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + authKey: '<AUTH_KEY>', // optional + authKeyId: '<AUTH_KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + bundleId: '<BUNDLE_ID>', // optional + sandbox: false, // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md new file mode 100644 index 00000000..1662aae1 --- /dev/null +++ b/docs/examples/messaging/create-email.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createEmail({ + messageId: '<MESSAGE_ID>', + subject: '<SUBJECT>', + content: '<CONTENT>', + topics: [], // optional + users: [], // optional + targets: [], // optional + cc: [], // optional + bcc: [], // optional + attachments: [], // optional + draft: false, // optional + html: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md new file mode 100644 index 00000000..78b6d06c --- /dev/null +++ b/docs/examples/messaging/create-fcm-provider.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createFCMProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + serviceAccountJSON: {}, // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md new file mode 100644 index 00000000..f2961b6d --- /dev/null +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,23 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createMailgunProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + domain: '<DOMAIN>', // optional + isEuRegion: false, // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md new file mode 100644 index 00000000..ba6829a6 --- /dev/null +++ b/docs/examples/messaging/create-msg-91-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createMsg91Provider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + templateId: '<TEMPLATE_ID>', // optional + senderId: '<SENDER_ID>', // optional + authKey: '<AUTH_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md new file mode 100644 index 00000000..467cde4a --- /dev/null +++ b/docs/examples/messaging/create-push.md @@ -0,0 +1,32 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createPush({ + messageId: '<MESSAGE_ID>', + title: '<TITLE>', // optional + body: '<BODY>', // optional + topics: [], // optional + users: [], // optional + targets: [], // optional + data: {}, // optional + action: '<ACTION>', // optional + image: '<ID1:ID2>', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: null, // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional + contentAvailable: false, // optional + critical: false, // optional + priority: sdk.MessagePriority.Normal // optional +}); +``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md new file mode 100644 index 00000000..d1c391d0 --- /dev/null +++ b/docs/examples/messaging/create-resend-provider.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createResendProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 00000000..9c3be00c --- /dev/null +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSendgridProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md new file mode 100644 index 00000000..31d75c00 --- /dev/null +++ b/docs/examples/messaging/create-sms.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSMS({ + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', + topics: [], // optional + users: [], // optional + targets: [], // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md new file mode 100644 index 00000000..e17fdc19 --- /dev/null +++ b/docs/examples/messaging/create-smtp-provider.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSMTPProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: sdk.SmtpEncryption.None, // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md new file mode 100644 index 00000000..51410af7 --- /dev/null +++ b/docs/examples/messaging/create-subscriber.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSubscriber({ + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', + targetId: '<TARGET_ID>' +}); +``` diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md new file mode 100644 index 00000000..baf83a6c --- /dev/null +++ b/docs/examples/messaging/create-telesign-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTelesignProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md new file mode 100644 index 00000000..655a2248 --- /dev/null +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTextmagicProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md new file mode 100644 index 00000000..4625517a --- /dev/null +++ b/docs/examples/messaging/create-topic.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTopic({ + topicId: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"] // optional +}); +``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md new file mode 100644 index 00000000..0db55435 --- /dev/null +++ b/docs/examples/messaging/create-twilio-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTwilioProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md new file mode 100644 index 00000000..cf8cd38a --- /dev/null +++ b/docs/examples/messaging/create-vonage-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createVonageProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md new file mode 100644 index 00000000..53fc2aea --- /dev/null +++ b/docs/examples/messaging/delete-provider.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.deleteProvider({ + providerId: '<PROVIDER_ID>' +}); +``` diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md new file mode 100644 index 00000000..99c61d7a --- /dev/null +++ b/docs/examples/messaging/delete-subscriber.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const messaging = new sdk.Messaging(client); + +const result = await messaging.deleteSubscriber({ + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +}); +``` diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md new file mode 100644 index 00000000..3ffa99f9 --- /dev/null +++ b/docs/examples/messaging/delete-topic.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.deleteTopic({ + topicId: '<TOPIC_ID>' +}); +``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md new file mode 100644 index 00000000..62e7d61a --- /dev/null +++ b/docs/examples/messaging/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.delete({ + messageId: '<MESSAGE_ID>' +}); +``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md new file mode 100644 index 00000000..894a74ac --- /dev/null +++ b/docs/examples/messaging/get-message.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getMessage({ + messageId: '<MESSAGE_ID>' +}); +``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md new file mode 100644 index 00000000..c7e91ff0 --- /dev/null +++ b/docs/examples/messaging/get-provider.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getProvider({ + providerId: '<PROVIDER_ID>' +}); +``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md new file mode 100644 index 00000000..8a915341 --- /dev/null +++ b/docs/examples/messaging/get-subscriber.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getSubscriber({ + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +}); +``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md new file mode 100644 index 00000000..f352c9d7 --- /dev/null +++ b/docs/examples/messaging/get-topic.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getTopic({ + topicId: '<TOPIC_ID>' +}); +``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md new file mode 100644 index 00000000..c9c8a471 --- /dev/null +++ b/docs/examples/messaging/list-message-logs.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listMessageLogs({ + messageId: '<MESSAGE_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md new file mode 100644 index 00000000..053adc9f --- /dev/null +++ b/docs/examples/messaging/list-messages.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listMessages({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md new file mode 100644 index 00000000..92b4c2f4 --- /dev/null +++ b/docs/examples/messaging/list-provider-logs.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listProviderLogs({ + providerId: '<PROVIDER_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md new file mode 100644 index 00000000..603ff0bd --- /dev/null +++ b/docs/examples/messaging/list-providers.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listProviders({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md new file mode 100644 index 00000000..2f892254 --- /dev/null +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listSubscriberLogs({ + subscriberId: '<SUBSCRIBER_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md new file mode 100644 index 00000000..bba6aae4 --- /dev/null +++ b/docs/examples/messaging/list-subscribers.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listSubscribers({ + topicId: '<TOPIC_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md new file mode 100644 index 00000000..dc053961 --- /dev/null +++ b/docs/examples/messaging/list-targets.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listTargets({ + messageId: '<MESSAGE_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md new file mode 100644 index 00000000..ee76366c --- /dev/null +++ b/docs/examples/messaging/list-topic-logs.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listTopicLogs({ + topicId: '<TOPIC_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md new file mode 100644 index 00000000..62fecb61 --- /dev/null +++ b/docs/examples/messaging/list-topics.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listTopics({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md new file mode 100644 index 00000000..6cd012d9 --- /dev/null +++ b/docs/examples/messaging/update-apns-provider.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateAPNSProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + authKey: '<AUTH_KEY>', // optional + authKeyId: '<AUTH_KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + bundleId: '<BUNDLE_ID>', // optional + sandbox: false // optional +}); +``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md new file mode 100644 index 00000000..f4e27865 --- /dev/null +++ b/docs/examples/messaging/update-email.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateEmail({ + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + subject: '<SUBJECT>', // optional + content: '<CONTENT>', // optional + draft: false, // optional + html: false, // optional + cc: [], // optional + bcc: [], // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional + attachments: [] // optional +}); +``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md new file mode 100644 index 00000000..4d76843e --- /dev/null +++ b/docs/examples/messaging/update-fcm-provider.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateFCMProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + serviceAccountJSON: {} // optional +}); +``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md new file mode 100644 index 00000000..5725f1eb --- /dev/null +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,23 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateMailgunProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + apiKey: '<API_KEY>', // optional + domain: '<DOMAIN>', // optional + isEuRegion: false, // optional + enabled: false, // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +}); +``` diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md new file mode 100644 index 00000000..d66ba73f --- /dev/null +++ b/docs/examples/messaging/update-msg-91-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateMsg91Provider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + templateId: '<TEMPLATE_ID>', // optional + senderId: '<SENDER_ID>', // optional + authKey: '<AUTH_KEY>' // optional +}); +``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md new file mode 100644 index 00000000..f0e5e324 --- /dev/null +++ b/docs/examples/messaging/update-push.md @@ -0,0 +1,32 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updatePush({ + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + title: '<TITLE>', // optional + body: '<BODY>', // optional + data: {}, // optional + action: '<ACTION>', // optional + image: '<ID1:ID2>', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: null, // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00', // optional + contentAvailable: false, // optional + critical: false, // optional + priority: sdk.MessagePriority.Normal // optional +}); +``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md new file mode 100644 index 00000000..563c907f --- /dev/null +++ b/docs/examples/messaging/update-resend-provider.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateResendProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +}); +``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 00000000..ece8ae7c --- /dev/null +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateSendgridProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +}); +``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md new file mode 100644 index 00000000..074cab2e --- /dev/null +++ b/docs/examples/messaging/update-sms.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateSMS({ + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + content: '<CONTENT>', // optional + draft: false, // optional + scheduledAt: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md new file mode 100644 index 00000000..d860736f --- /dev/null +++ b/docs/examples/messaging/update-smtp-provider.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateSMTPProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + host: '<HOST>', // optional + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: sdk.SmtpEncryption.None, // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md new file mode 100644 index 00000000..b8b7ea08 --- /dev/null +++ b/docs/examples/messaging/update-telesign-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTelesignProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +}); +``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md new file mode 100644 index 00000000..bf35cef8 --- /dev/null +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTextmagicProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +}); +``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md new file mode 100644 index 00000000..8ec30739 --- /dev/null +++ b/docs/examples/messaging/update-topic.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTopic({ + topicId: '<TOPIC_ID>', + name: '<NAME>', // optional + subscribe: ["any"] // optional +}); +``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md new file mode 100644 index 00000000..da83c43c --- /dev/null +++ b/docs/examples/messaging/update-twilio-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTwilioProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + from: '<FROM>' // optional +}); +``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md new file mode 100644 index 00000000..caefea0d --- /dev/null +++ b/docs/examples/messaging/update-vonage-provider.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateVonageProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + from: '<FROM>' // optional +}); +``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md new file mode 100644 index 00000000..4c1cfc24 --- /dev/null +++ b/docs/examples/presences/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.delete({ + presenceId: '<PRESENCE_ID>' +}); +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md new file mode 100644 index 00000000..1e8a332d --- /dev/null +++ b/docs/examples/presences/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.get({ + presenceId: '<PRESENCE_ID>' +}); +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md new file mode 100644 index 00000000..fbb18d4d --- /dev/null +++ b/docs/examples/presences/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.list({ + queries: [], // optional + total: false, // optional + ttl: 0 // optional +}); +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 00000000..ffb1272f --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.updatePresence({ + presenceId: '<PRESENCE_ID>', + userId: '<USER_ID>', + status: '<STATUS>', // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {}, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + purge: false // optional +}); +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md new file mode 100644 index 00000000..63b9267f --- /dev/null +++ b/docs/examples/presences/upsert.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const presences = new sdk.Presences(client); + +const result = await presences.upsert({ + presenceId: '<PRESENCE_ID>', + userId: '<USER_ID>', + status: '<STATUS>', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + expiresAt: '2020-10-15T06:38:00.000+00:00', // optional + metadata: {} // optional +}); +``` diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md new file mode 100644 index 00000000..09a9f337 --- /dev/null +++ b/docs/examples/project/create-android-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createAndroidPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + applicationId: '<APPLICATION_ID>' +}); +``` diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md new file mode 100644 index 00000000..6ffe87b7 --- /dev/null +++ b/docs/examples/project/create-apple-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createApplePlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + bundleIdentifier: '<BUNDLE_IDENTIFIER>' +}); +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md new file mode 100644 index 00000000..e368a605 --- /dev/null +++ b/docs/examples/project/create-ephemeral-key.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createEphemeralKey({ + scopes: [sdk.ProjectKeyScopes.ProjectRead], + duration: 600 +}); +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md new file mode 100644 index 00000000..362821b3 --- /dev/null +++ b/docs/examples/project/create-key.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [sdk.ProjectKeyScopes.ProjectRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md new file mode 100644 index 00000000..aa51173c --- /dev/null +++ b/docs/examples/project/create-linux-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createLinuxPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageName: '<PACKAGE_NAME>' +}); +``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md new file mode 100644 index 00000000..6bb2962c --- /dev/null +++ b/docs/examples/project/create-mock-phone.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createMockPhone({ + number: '+12065550100', + otp: '<OTP>' +}); +``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md new file mode 100644 index 00000000..708daf85 --- /dev/null +++ b/docs/examples/project/create-smtp-test.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createSMTPTest({ + emails: [] +}); +``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md new file mode 100644 index 00000000..6333b935 --- /dev/null +++ b/docs/examples/project/create-variable.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createVariable({ + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +}); +``` diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md new file mode 100644 index 00000000..84e36ce1 --- /dev/null +++ b/docs/examples/project/create-web-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createWebPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + hostname: 'app.example.com' +}); +``` diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md new file mode 100644 index 00000000..369f0349 --- /dev/null +++ b/docs/examples/project/create-windows-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.createWindowsPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' +}); +``` diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md new file mode 100644 index 00000000..bbe19c2a --- /dev/null +++ b/docs/examples/project/delete-key.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.deleteKey({ + keyId: '<KEY_ID>' +}); +``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md new file mode 100644 index 00000000..94d341a7 --- /dev/null +++ b/docs/examples/project/delete-mock-phone.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.deleteMockPhone({ + number: '+12065550100' +}); +``` diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md new file mode 100644 index 00000000..cb734805 --- /dev/null +++ b/docs/examples/project/delete-platform.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.deletePlatform({ + platformId: '<PLATFORM_ID>' +}); +``` diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md new file mode 100644 index 00000000..c930811b --- /dev/null +++ b/docs/examples/project/delete-variable.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.deleteVariable({ + variableId: '<VARIABLE_ID>' +}); +``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md new file mode 100644 index 00000000..150939ed --- /dev/null +++ b/docs/examples/project/delete.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.delete(); +``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md new file mode 100644 index 00000000..d4683e56 --- /dev/null +++ b/docs/examples/project/get-email-template.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.getEmailTemplate({ + templateId: sdk.ProjectEmailTemplateId.Verification, + locale: sdk.ProjectEmailTemplateLocale.Af // optional +}); +``` diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md new file mode 100644 index 00000000..81b7e2f1 --- /dev/null +++ b/docs/examples/project/get-key.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.getKey({ + keyId: '<KEY_ID>' +}); +``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md new file mode 100644 index 00000000..73082c43 --- /dev/null +++ b/docs/examples/project/get-mock-phone.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.getMockPhone({ + number: '+12065550100' +}); +``` diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md new file mode 100644 index 00000000..7c1d85c5 --- /dev/null +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.getOAuth2Provider({ + providerId: sdk.ProjectOAuthProviderId.Amazon +}); +``` diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md new file mode 100644 index 00000000..4f450e4b --- /dev/null +++ b/docs/examples/project/get-platform.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.getPlatform({ + platformId: '<PLATFORM_ID>' +}); +``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md new file mode 100644 index 00000000..e55cb859 --- /dev/null +++ b/docs/examples/project/get-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.getPolicy({ + policyId: sdk.ProjectPolicyId.PasswordDictionary +}); +``` diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md new file mode 100644 index 00000000..5232de86 --- /dev/null +++ b/docs/examples/project/get-variable.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.getVariable({ + variableId: '<VARIABLE_ID>' +}); +``` diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md new file mode 100644 index 00000000..5ee86b8a --- /dev/null +++ b/docs/examples/project/get.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.get(); +``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md new file mode 100644 index 00000000..34bc7778 --- /dev/null +++ b/docs/examples/project/list-email-templates.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.listEmailTemplates({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md new file mode 100644 index 00000000..e9266822 --- /dev/null +++ b/docs/examples/project/list-keys.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.listKeys({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md new file mode 100644 index 00000000..0816b18a --- /dev/null +++ b/docs/examples/project/list-mock-phones.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.listMockPhones({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md new file mode 100644 index 00000000..244767d3 --- /dev/null +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.listOAuth2Providers({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md new file mode 100644 index 00000000..c180b9d7 --- /dev/null +++ b/docs/examples/project/list-platforms.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.listPlatforms({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md new file mode 100644 index 00000000..f7b6260f --- /dev/null +++ b/docs/examples/project/list-policies.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.listPolicies({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md new file mode 100644 index 00000000..3ffd1b95 --- /dev/null +++ b/docs/examples/project/list-variables.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.listVariables({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md new file mode 100644 index 00000000..8164b0d0 --- /dev/null +++ b/docs/examples/project/update-android-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateAndroidPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + applicationId: '<APPLICATION_ID>' +}); +``` diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md new file mode 100644 index 00000000..93abb676 --- /dev/null +++ b/docs/examples/project/update-apple-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateApplePlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + bundleIdentifier: '<BUNDLE_IDENTIFIER>' +}); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md new file mode 100644 index 00000000..8e2e4bbb --- /dev/null +++ b/docs/examples/project/update-auth-method.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateAuthMethod({ + methodId: sdk.ProjectAuthMethodId.EmailPassword, + enabled: false +}); +``` diff --git a/docs/examples/project/update-deny-aliased-email-policy.md b/docs/examples/project/update-deny-aliased-email-policy.md new file mode 100644 index 00000000..92b7e648 --- /dev/null +++ b/docs/examples/project/update-deny-aliased-email-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateDenyAliasedEmailPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md new file mode 100644 index 00000000..e2b25316 --- /dev/null +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateDenyDisposableEmailPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md new file mode 100644 index 00000000..85799e8e --- /dev/null +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateDenyFreeEmailPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md new file mode 100644 index 00000000..ddf6ca67 --- /dev/null +++ b/docs/examples/project/update-email-template.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateEmailTemplate({ + templateId: sdk.ProjectEmailTemplateId.Verification, + locale: sdk.ProjectEmailTemplateLocale.Af, // optional + subject: '<SUBJECT>', // optional + message: '<MESSAGE>', // optional + senderName: '<SENDER_NAME>', // optional + senderEmail: 'email@example.com', // optional + replyToEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>' // optional +}); +``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md new file mode 100644 index 00000000..39be329e --- /dev/null +++ b/docs/examples/project/update-key.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [sdk.ProjectKeyScopes.ProjectRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md new file mode 100644 index 00000000..f924ec09 --- /dev/null +++ b/docs/examples/project/update-labels.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateLabels({ + labels: [] +}); +``` diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md new file mode 100644 index 00000000..cb483d60 --- /dev/null +++ b/docs/examples/project/update-linux-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateLinuxPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageName: '<PACKAGE_NAME>' +}); +``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md new file mode 100644 index 00000000..66eff9f3 --- /dev/null +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateMembershipPrivacyPolicy({ + userId: false, // optional + userEmail: false, // optional + userPhone: false, // optional + userName: false, // optional + userMFA: false // optional +}); +``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md new file mode 100644 index 00000000..a0c70abc --- /dev/null +++ b/docs/examples/project/update-mock-phone.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateMockPhone({ + number: '+12065550100', + otp: '<OTP>' +}); +``` diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md new file mode 100644 index 00000000..12a535ff --- /dev/null +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Amazon({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md new file mode 100644 index 00000000..ae985a4a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Apple({ + serviceId: '<SERVICE_ID>', // optional + keyId: '<KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + p8File: '<P8_FILE>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md new file mode 100644 index 00000000..37bf4a56 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Auth0({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md new file mode 100644 index 00000000..e500466b --- /dev/null +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Authentik({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md new file mode 100644 index 00000000..0b8aabce --- /dev/null +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Autodesk({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md new file mode 100644 index 00000000..d3b5dc7b --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Bitbucket({ + key: '<KEY>', // optional + secret: '<SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md new file mode 100644 index 00000000..feecad27 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Bitly({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md new file mode 100644 index 00000000..c9724638 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-box.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Box({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md new file mode 100644 index 00000000..8d176339 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Dailymotion({ + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md new file mode 100644 index 00000000..5469509f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Discord({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md new file mode 100644 index 00000000..c71bebfe --- /dev/null +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Disqus({ + publicKey: '<PUBLIC_KEY>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md new file mode 100644 index 00000000..9f2654dc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Dropbox({ + appKey: '<APP_KEY>', // optional + appSecret: '<APP_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md new file mode 100644 index 00000000..684c4243 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Etsy({ + keyString: '<KEY_STRING>', // optional + sharedSecret: '<SHARED_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md new file mode 100644 index 00000000..7fca48a6 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Facebook({ + appId: '<APP_ID>', // optional + appSecret: '<APP_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md new file mode 100644 index 00000000..3b805738 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Figma({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md new file mode 100644 index 00000000..654991c9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2FusionAuth({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md new file mode 100644 index 00000000..cc2be084 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2GitHub({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md new file mode 100644 index 00000000..40e1943e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Gitlab({ + applicationId: '<APPLICATION_ID>', // optional + secret: '<SECRET>', // optional + endpoint: 'https://example.com', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md new file mode 100644 index 00000000..726d6059 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-google.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Google({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + prompt: [sdk.ProjectOAuth2GooglePrompt.None], // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md new file mode 100644 index 00000000..bce76ee5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Keycloak({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + realmName: '<REALM_NAME>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md new file mode 100644 index 00000000..1d581052 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Kick({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md new file mode 100644 index 00000000..02c68d99 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Linkedin({ + clientId: '<CLIENT_ID>', // optional + primaryClientSecret: '<PRIMARY_CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md new file mode 100644 index 00000000..cc5a8c27 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Microsoft({ + applicationId: '<APPLICATION_ID>', // optional + applicationSecret: '<APPLICATION_SECRET>', // optional + tenant: '<TENANT>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md new file mode 100644 index 00000000..c3297799 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Notion({ + oauthClientId: '<OAUTH_CLIENT_ID>', // optional + oauthClientSecret: '<OAUTH_CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md new file mode 100644 index 00000000..7f1f6eb7 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Oidc({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + wellKnownURL: 'https://example.com', // optional + authorizationURL: 'https://example.com', // optional + tokenURL: 'https://example.com', // optional + userInfoURL: 'https://example.com', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md new file mode 100644 index 00000000..a85c9809 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Okta({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + domain: '', // optional + authorizationServerId: '<AUTHORIZATION_SERVER_ID>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md new file mode 100644 index 00000000..e6b8de7f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2PaypalSandbox({ + clientId: '<CLIENT_ID>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md new file mode 100644 index 00000000..8f7162c7 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Paypal({ + clientId: '<CLIENT_ID>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md new file mode 100644 index 00000000..3d6c2c44 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Podio({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md new file mode 100644 index 00000000..a1937639 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Salesforce({ + customerKey: '<CUSTOMER_KEY>', // optional + customerSecret: '<CUSTOMER_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md new file mode 100644 index 00000000..6dab9092 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Slack({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md new file mode 100644 index 00000000..72ffa64d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Spotify({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md new file mode 100644 index 00000000..1df015f1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Stripe({ + clientId: '<CLIENT_ID>', // optional + apiSecretKey: '<API_SECRET_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md new file mode 100644 index 00000000..df090e92 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2TradeshiftSandbox({ + oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional + oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md new file mode 100644 index 00000000..afddd8c0 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Tradeshift({ + oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional + oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md new file mode 100644 index 00000000..ad096ea9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Twitch({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md new file mode 100644 index 00000000..597ccd5b --- /dev/null +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2WordPress({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md new file mode 100644 index 00000000..79b3b021 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Yahoo({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md new file mode 100644 index 00000000..2f79c448 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Yandex({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md new file mode 100644 index 00000000..031a2816 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Zoho({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md new file mode 100644 index 00000000..985400b1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2Zoom({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md new file mode 100644 index 00000000..183e2257 --- /dev/null +++ b/docs/examples/project/update-o-auth-2x.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateOAuth2X({ + customerKey: '<CUSTOMER_KEY>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md new file mode 100644 index 00000000..8b8bdd02 --- /dev/null +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updatePasswordDictionaryPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md new file mode 100644 index 00000000..b8ab9d03 --- /dev/null +++ b/docs/examples/project/update-password-history-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updatePasswordHistoryPolicy({ + total: 1 +}); +``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md new file mode 100644 index 00000000..df490a4a --- /dev/null +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updatePasswordPersonalDataPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md new file mode 100644 index 00000000..373e9178 --- /dev/null +++ b/docs/examples/project/update-protocol.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateProtocol({ + protocolId: sdk.ProjectProtocolId.Rest, + enabled: false +}); +``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md new file mode 100644 index 00000000..ded8eb76 --- /dev/null +++ b/docs/examples/project/update-service.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateService({ + serviceId: sdk.ProjectServiceId.Account, + enabled: false +}); +``` diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md new file mode 100644 index 00000000..54546084 --- /dev/null +++ b/docs/examples/project/update-session-alert-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateSessionAlertPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md new file mode 100644 index 00000000..2a4873be --- /dev/null +++ b/docs/examples/project/update-session-duration-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateSessionDurationPolicy({ + duration: 5 +}); +``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md new file mode 100644 index 00000000..a5840bc2 --- /dev/null +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateSessionInvalidationPolicy({ + enabled: false +}); +``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md new file mode 100644 index 00000000..514d77aa --- /dev/null +++ b/docs/examples/project/update-session-limit-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateSessionLimitPolicy({ + total: 1 +}); +``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md new file mode 100644 index 00000000..fe7258a5 --- /dev/null +++ b/docs/examples/project/update-smtp.md @@ -0,0 +1,23 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateSMTP({ + host: '', // optional + port: null, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + senderEmail: 'email@example.com', // optional + senderName: '<SENDER_NAME>', // optional + replyToEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + secure: sdk.ProjectSMTPSecure.Tls, // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md new file mode 100644 index 00000000..bb372042 --- /dev/null +++ b/docs/examples/project/update-user-limit-policy.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateUserLimitPolicy({ + total: 1 +}); +``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md new file mode 100644 index 00000000..58e738ed --- /dev/null +++ b/docs/examples/project/update-variable.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateVariable({ + variableId: '<VARIABLE_ID>', + key: '<KEY>', // optional + value: '<VALUE>', // optional + secret: false // optional +}); +``` diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md new file mode 100644 index 00000000..9c4f9bd1 --- /dev/null +++ b/docs/examples/project/update-web-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateWebPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + hostname: 'app.example.com' +}); +``` diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md new file mode 100644 index 00000000..3fd19d7d --- /dev/null +++ b/docs/examples/project/update-windows-platform.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const project = new sdk.Project(client); + +const result = await project.updateWindowsPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' +}); +``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md new file mode 100644 index 00000000..25fcf691 --- /dev/null +++ b/docs/examples/proxy/create-api-rule.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.createAPIRule({ + domain: '' +}); +``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md new file mode 100644 index 00000000..cf225f67 --- /dev/null +++ b/docs/examples/proxy/create-function-rule.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.createFunctionRule({ + domain: '', + functionId: '<FUNCTION_ID>', + branch: '<BRANCH>' // optional +}); +``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md new file mode 100644 index 00000000..0f33abd6 --- /dev/null +++ b/docs/examples/proxy/create-redirect-rule.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.createRedirectRule({ + domain: '', + url: 'https://example.com', + statusCode: sdk.StatusCode.MovedPermanently301, + resourceId: '<RESOURCE_ID>', + resourceType: sdk.ProxyResourceType.Site +}); +``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md new file mode 100644 index 00000000..bafbee3d --- /dev/null +++ b/docs/examples/proxy/create-site-rule.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.createSiteRule({ + domain: '', + siteId: '<SITE_ID>', + branch: '<BRANCH>' // optional +}); +``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 00000000..2d07a110 --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.deleteRule({ + ruleId: '<RULE_ID>' +}); +``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 00000000..e89612dc --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.getRule({ + ruleId: '<RULE_ID>' +}); +``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 00000000..b161a085 --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.listRules({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md new file mode 100644 index 00000000..9e050fc7 --- /dev/null +++ b/docs/examples/proxy/update-rule-status.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const proxy = new sdk.Proxy(client); + +const result = await proxy.updateRuleStatus({ + ruleId: '<RULE_ID>' +}); +``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md new file mode 100644 index 00000000..2603dda9 --- /dev/null +++ b/docs/examples/sites/create-deployment.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); +const fs = require('fs'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createDeployment({ + siteId: '<SITE_ID>', + code: InputFile.fromPath('/path/to/file', 'filename'), + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + activate: false // optional +}); +``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md new file mode 100644 index 00000000..e14d8585 --- /dev/null +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createDuplicateDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md new file mode 100644 index 00000000..b08d94ab --- /dev/null +++ b/docs/examples/sites/create-template-deployment.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createTemplateDeployment({ + siteId: '<SITE_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + rootDirectory: '<ROOT_DIRECTORY>', + type: sdk.TemplateReferenceType.Branch, + reference: '<REFERENCE>', + activate: false // optional +}); +``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md new file mode 100644 index 00000000..cad7be76 --- /dev/null +++ b/docs/examples/sites/create-variable.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +}); +``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md new file mode 100644 index 00000000..6d28546e --- /dev/null +++ b/docs/examples/sites/create-vcs-deployment.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createVcsDeployment({ + siteId: '<SITE_ID>', + type: sdk.VCSReferenceType.Branch, + reference: '<REFERENCE>', + activate: false // optional +}); +``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md new file mode 100644 index 00000000..65e5c64c --- /dev/null +++ b/docs/examples/sites/create.md @@ -0,0 +1,34 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.create({ + siteId: '<SITE_ID>', + name: '<NAME>', + framework: sdk.Framework.Analog, + buildRuntime: sdk.BuildRuntime.Node145, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + startCommand: '<START_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + adapter: sdk.Adapter.Static, // optional + installationId: '<INSTALLATION_ID>', // optional + fallbackFile: '<FALLBACK_FILE>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); +``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md new file mode 100644 index 00000000..533f2985 --- /dev/null +++ b/docs/examples/sites/delete-deployment.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.deleteDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md new file mode 100644 index 00000000..38f7c3a3 --- /dev/null +++ b/docs/examples/sites/delete-log.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.deleteLog({ + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +}); +``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md new file mode 100644 index 00000000..11ebaca9 --- /dev/null +++ b/docs/examples/sites/delete-variable.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.deleteVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +}); +``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md new file mode 100644 index 00000000..03bd1a57 --- /dev/null +++ b/docs/examples/sites/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.delete({ + siteId: '<SITE_ID>' +}); +``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md new file mode 100644 index 00000000..6e7ee4aa --- /dev/null +++ b/docs/examples/sites/get-deployment-download.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getDeploymentDownload({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', + type: sdk.DeploymentDownloadType.Source // optional +}); +``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md new file mode 100644 index 00000000..1f1430ca --- /dev/null +++ b/docs/examples/sites/get-deployment.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md new file mode 100644 index 00000000..f8190b4a --- /dev/null +++ b/docs/examples/sites/get-log.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getLog({ + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +}); +``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md new file mode 100644 index 00000000..cafb71b1 --- /dev/null +++ b/docs/examples/sites/get-variable.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +}); +``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md new file mode 100644 index 00000000..0b21b2bb --- /dev/null +++ b/docs/examples/sites/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.get({ + siteId: '<SITE_ID>' +}); +``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md new file mode 100644 index 00000000..1b544a0a --- /dev/null +++ b/docs/examples/sites/list-deployments.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listDeployments({ + siteId: '<SITE_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md new file mode 100644 index 00000000..9a417bfd --- /dev/null +++ b/docs/examples/sites/list-frameworks.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listFrameworks(); +``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md new file mode 100644 index 00000000..62b16945 --- /dev/null +++ b/docs/examples/sites/list-logs.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listLogs({ + siteId: '<SITE_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md new file mode 100644 index 00000000..6e882891 --- /dev/null +++ b/docs/examples/sites/list-specifications.md @@ -0,0 +1,12 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listSpecifications(); +``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md new file mode 100644 index 00000000..26ae3212 --- /dev/null +++ b/docs/examples/sites/list-variables.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listVariables({ + siteId: '<SITE_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md new file mode 100644 index 00000000..518aa709 --- /dev/null +++ b/docs/examples/sites/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md new file mode 100644 index 00000000..73a74758 --- /dev/null +++ b/docs/examples/sites/update-deployment-status.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.updateDeploymentStatus({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md new file mode 100644 index 00000000..1221d370 --- /dev/null +++ b/docs/examples/sites/update-site-deployment.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.updateSiteDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); +``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md new file mode 100644 index 00000000..2853a180 --- /dev/null +++ b/docs/examples/sites/update-variable.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.updateVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', // optional + value: '<VALUE>', // optional + secret: false // optional +}); +``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md new file mode 100644 index 00000000..0411752f --- /dev/null +++ b/docs/examples/sites/update.md @@ -0,0 +1,34 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.update({ + siteId: '<SITE_ID>', + name: '<NAME>', + framework: sdk.Framework.Analog, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + startCommand: '<START_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + buildRuntime: sdk.BuildRuntime.Node145, // optional + adapter: sdk.Adapter.Static, // optional + fallbackFile: '<FALLBACK_FILE>', // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); +``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md new file mode 100644 index 00000000..47dc8b31 --- /dev/null +++ b/docs/examples/storage/create-bucket.md @@ -0,0 +1,24 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.createBucket({ + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: sdk.Compression.None, // optional + encryption: false, // optional + antivirus: false, // optional + transformations: false // optional +}); +``` diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md new file mode 100644 index 00000000..055e5ab5 --- /dev/null +++ b/docs/examples/storage/create-file.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); +const fs = require('fs'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.createFile({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + file: InputFile.fromPath('/path/to/file', 'filename'), + permissions: [sdk.Permission.read(sdk.Role.any())] // optional +}); +``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md new file mode 100644 index 00000000..bf6fa1b6 --- /dev/null +++ b/docs/examples/storage/delete-bucket.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.deleteBucket({ + bucketId: '<BUCKET_ID>' +}); +``` diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md new file mode 100644 index 00000000..d49838e1 --- /dev/null +++ b/docs/examples/storage/delete-file.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.deleteFile({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +}); +``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md new file mode 100644 index 00000000..380db535 --- /dev/null +++ b/docs/examples/storage/get-bucket.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.getBucket({ + bucketId: '<BUCKET_ID>' +}); +``` diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md new file mode 100644 index 00000000..c0a10d96 --- /dev/null +++ b/docs/examples/storage/get-file-download.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFileDownload({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + token: '<TOKEN>' // optional +}); +``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md new file mode 100644 index 00000000..984333db --- /dev/null +++ b/docs/examples/storage/get-file-preview.md @@ -0,0 +1,27 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFilePreview({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + width: 0, // optional + height: 0, // optional + gravity: sdk.ImageGravity.Center, // optional + quality: -1, // optional + borderWidth: 0, // optional + borderColor: '', // optional + borderRadius: 0, // optional + opacity: 0, // optional + rotation: -360, // optional + background: '', // optional + output: sdk.ImageFormat.Jpg, // optional + token: '<TOKEN>' // optional +}); +``` diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md new file mode 100644 index 00000000..a20c4ac2 --- /dev/null +++ b/docs/examples/storage/get-file-view.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFileView({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + token: '<TOKEN>' // optional +}); +``` diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md new file mode 100644 index 00000000..d8bdf4dd --- /dev/null +++ b/docs/examples/storage/get-file.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFile({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +}); +``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md new file mode 100644 index 00000000..c17389e5 --- /dev/null +++ b/docs/examples/storage/list-buckets.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.listBuckets({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md new file mode 100644 index 00000000..f51fad9d --- /dev/null +++ b/docs/examples/storage/list-files.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.listFiles({ + bucketId: '<BUCKET_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md new file mode 100644 index 00000000..c17c9691 --- /dev/null +++ b/docs/examples/storage/update-bucket.md @@ -0,0 +1,24 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.updateBucket({ + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: sdk.Compression.None, // optional + encryption: false, // optional + antivirus: false, // optional + transformations: false // optional +}); +``` diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md new file mode 100644 index 00000000..8d2294ff --- /dev/null +++ b/docs/examples/storage/update-file.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.updateFile({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + name: '<NAME>', // optional + permissions: [sdk.Permission.read(sdk.Role.any())] // optional +}); +``` diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md new file mode 100644 index 00000000..21ca0bfd --- /dev/null +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createBigIntColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md new file mode 100644 index 00000000..b9df8ba8 --- /dev/null +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createBooleanColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: false, // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md new file mode 100644 index 00000000..602c2a1a --- /dev/null +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createDatetimeColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md new file mode 100644 index 00000000..bdd59341 --- /dev/null +++ b/docs/examples/tablesdb/create-email-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createEmailColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'email@example.com', // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md new file mode 100644 index 00000000..4016ce71 --- /dev/null +++ b/docs/examples/tablesdb/create-enum-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createEnumColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md new file mode 100644 index 00000000..b533f38a --- /dev/null +++ b/docs/examples/tablesdb/create-float-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createFloatColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md new file mode 100644 index 00000000..6a7523ba --- /dev/null +++ b/docs/examples/tablesdb/create-index.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + type: sdk.TablesDBIndexType.Key, + columns: [], + orders: [sdk.OrderBy.Asc], // optional + lengths: [] // optional +}); +``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md new file mode 100644 index 00000000..6e99e93e --- /dev/null +++ b/docs/examples/tablesdb/create-integer-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createIntegerColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md new file mode 100644 index 00000000..7d176b6a --- /dev/null +++ b/docs/examples/tablesdb/create-ip-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createIpColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '', // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md new file mode 100644 index 00000000..f99194c6 --- /dev/null +++ b/docs/examples/tablesdb/create-line-column.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createLineColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]] // optional +}); +``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md new file mode 100644 index 00000000..89d37c47 --- /dev/null +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createLongtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md new file mode 100644 index 00000000..daa59589 --- /dev/null +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createMediumtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md new file mode 100644 index 00000000..d1823aa8 --- /dev/null +++ b/docs/examples/tablesdb/create-operations.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createOperations({ + transactionId: '<TRANSACTION_ID>', + operations: [ + { + "action": "create", + "databaseId": "<DATABASE_ID>", + "tableId": "<TABLE_ID>", + "rowId": "<ROW_ID>", + "data": { + "name": "Walter O'Brien" + } + } + ] // optional +}); +``` diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md new file mode 100644 index 00000000..a68d1e43 --- /dev/null +++ b/docs/examples/tablesdb/create-point-column.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createPointColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [1, 2] // optional +}); +``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md new file mode 100644 index 00000000..0f4631bc --- /dev/null +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createPolygonColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional +}); +``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md new file mode 100644 index 00000000..6f2c0fa9 --- /dev/null +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createRelationshipColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + relatedTableId: '<RELATED_TABLE_ID>', + type: sdk.RelationshipType.OneToOne, + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: sdk.RelationMutate.Cascade // optional +}); +``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md new file mode 100644 index 00000000..485afcde --- /dev/null +++ b/docs/examples/tablesdb/create-row.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createRow({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rowId: '<ROW_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 30, + "isAdmin": false + }, + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md new file mode 100644 index 00000000..05364214 --- /dev/null +++ b/docs/examples/tablesdb/create-rows.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rows: [], + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md new file mode 100644 index 00000000..255701ce --- /dev/null +++ b/docs/examples/tablesdb/create-string-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createStringColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + size: 1, + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md new file mode 100644 index 00000000..b429f797 --- /dev/null +++ b/docs/examples/tablesdb/create-table.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + name: '<NAME>', + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + rowSecurity: false, // optional + enabled: false, // optional + columns: [], // optional + indexes: [] // optional +}); +``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md new file mode 100644 index 00000000..e7b9a479 --- /dev/null +++ b/docs/examples/tablesdb/create-text-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createTextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md new file mode 100644 index 00000000..c737347f --- /dev/null +++ b/docs/examples/tablesdb/create-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createTransaction({ + ttl: 60 // optional +}); +``` diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md new file mode 100644 index 00000000..01e27e7d --- /dev/null +++ b/docs/examples/tablesdb/create-url-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createUrlColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'https://example.com', // optional + array: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md new file mode 100644 index 00000000..9cfc6fa6 --- /dev/null +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.createVarcharColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + size: 1, + required: false, + xdefault: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +}); +``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md new file mode 100644 index 00000000..0571906c --- /dev/null +++ b/docs/examples/tablesdb/create.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.create({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +}); +``` diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md new file mode 100644 index 00000000..2fafbbbf --- /dev/null +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.decrementRowColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rowId: '<ROW_ID>', + column: '', + value: null, // optional + min: null, // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md new file mode 100644 index 00000000..51fd96e3 --- /dev/null +++ b/docs/examples/tablesdb/delete-column.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.deleteColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); +``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md new file mode 100644 index 00000000..4c7ad1ee --- /dev/null +++ b/docs/examples/tablesdb/delete-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.deleteIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); +``` diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md new file mode 100644 index 00000000..20d4e95b --- /dev/null +++ b/docs/examples/tablesdb/delete-row.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.deleteRow({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rowId: '<ROW_ID>', + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md new file mode 100644 index 00000000..3dd8f1e0 --- /dev/null +++ b/docs/examples/tablesdb/delete-rows.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.deleteRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md new file mode 100644 index 00000000..f3071a45 --- /dev/null +++ b/docs/examples/tablesdb/delete-table.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.deleteTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>' +}); +``` diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md new file mode 100644 index 00000000..3daa0bd6 --- /dev/null +++ b/docs/examples/tablesdb/delete-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.deleteTransaction({ + transactionId: '<TRANSACTION_ID>' +}); +``` diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md new file mode 100644 index 00000000..018b3a9c --- /dev/null +++ b/docs/examples/tablesdb/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.delete({ + databaseId: '<DATABASE_ID>' +}); +``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md new file mode 100644 index 00000000..8daf93d4 --- /dev/null +++ b/docs/examples/tablesdb/get-column.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); +``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md new file mode 100644 index 00000000..164f833e --- /dev/null +++ b/docs/examples/tablesdb/get-index.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); +``` diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md new file mode 100644 index 00000000..6cbf26f0 --- /dev/null +++ b/docs/examples/tablesdb/get-row.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getRow({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rowId: '<ROW_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md new file mode 100644 index 00000000..e8254356 --- /dev/null +++ b/docs/examples/tablesdb/get-table.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>' +}); +``` diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md new file mode 100644 index 00000000..c39cfe11 --- /dev/null +++ b/docs/examples/tablesdb/get-transaction.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.getTransaction({ + transactionId: '<TRANSACTION_ID>' +}); +``` diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md new file mode 100644 index 00000000..38d5ce7a --- /dev/null +++ b/docs/examples/tablesdb/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.get({ + databaseId: '<DATABASE_ID>' +}); +``` diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md new file mode 100644 index 00000000..1388043a --- /dev/null +++ b/docs/examples/tablesdb/increment-row-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.incrementRowColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rowId: '<ROW_ID>', + column: '', + value: null, // optional + max: null, // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md new file mode 100644 index 00000000..59b2bfbf --- /dev/null +++ b/docs/examples/tablesdb/list-columns.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listColumns({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md new file mode 100644 index 00000000..7ff6df55 --- /dev/null +++ b/docs/examples/tablesdb/list-indexes.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listIndexes({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md new file mode 100644 index 00000000..2777730b --- /dev/null +++ b/docs/examples/tablesdb/list-rows.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>', // optional + total: false, // optional + ttl: 0 // optional +}); +``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md new file mode 100644 index 00000000..82779015 --- /dev/null +++ b/docs/examples/tablesdb/list-tables.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listTables({ + databaseId: '<DATABASE_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md new file mode 100644 index 00000000..892bd288 --- /dev/null +++ b/docs/examples/tablesdb/list-transactions.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.listTransactions({ + queries: [] // optional +}); +``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md new file mode 100644 index 00000000..3514e2dc --- /dev/null +++ b/docs/examples/tablesdb/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md new file mode 100644 index 00000000..4defcb4c --- /dev/null +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateBigIntColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md new file mode 100644 index 00000000..6ad62691 --- /dev/null +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateBooleanColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: false, + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md new file mode 100644 index 00000000..ff93b140 --- /dev/null +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateDatetimeColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md new file mode 100644 index 00000000..fc6c764b --- /dev/null +++ b/docs/examples/tablesdb/update-email-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateEmailColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'email@example.com', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md new file mode 100644 index 00000000..b97a4c58 --- /dev/null +++ b/docs/examples/tablesdb/update-enum-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateEnumColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md new file mode 100644 index 00000000..d332d81f --- /dev/null +++ b/docs/examples/tablesdb/update-float-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateFloatColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md new file mode 100644 index 00000000..4a49705d --- /dev/null +++ b/docs/examples/tablesdb/update-integer-column.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateIntegerColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md new file mode 100644 index 00000000..00dfce17 --- /dev/null +++ b/docs/examples/tablesdb/update-ip-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateIpColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md new file mode 100644 index 00000000..0a6bd255 --- /dev/null +++ b/docs/examples/tablesdb/update-line-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateLineColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]], // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md new file mode 100644 index 00000000..cdb20747 --- /dev/null +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateLongtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md new file mode 100644 index 00000000..7c84b920 --- /dev/null +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateMediumtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md new file mode 100644 index 00000000..c2e10506 --- /dev/null +++ b/docs/examples/tablesdb/update-point-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updatePointColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [1, 2], // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md new file mode 100644 index 00000000..0a38cd0a --- /dev/null +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updatePolygonColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md new file mode 100644 index 00000000..86f935a5 --- /dev/null +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateRelationshipColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + onDelete: sdk.RelationMutate.Cascade, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md new file mode 100644 index 00000000..bac92af2 --- /dev/null +++ b/docs/examples/tablesdb/update-row.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateRow({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rowId: '<ROW_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md new file mode 100644 index 00000000..09ab8601 --- /dev/null +++ b/docs/examples/tablesdb/update-rows.md @@ -0,0 +1,24 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md new file mode 100644 index 00000000..757aa6cf --- /dev/null +++ b/docs/examples/tablesdb/update-string-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateStringColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md new file mode 100644 index 00000000..6aa65c2e --- /dev/null +++ b/docs/examples/tablesdb/update-table.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + name: '<NAME>', // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + rowSecurity: false, // optional + enabled: false, // optional + purge: false // optional +}); +``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md new file mode 100644 index 00000000..69970d63 --- /dev/null +++ b/docs/examples/tablesdb/update-text-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateTextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md new file mode 100644 index 00000000..d0607478 --- /dev/null +++ b/docs/examples/tablesdb/update-transaction.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateTransaction({ + transactionId: '<TRANSACTION_ID>', + commit: false, // optional + rollback: false // optional +}); +``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md new file mode 100644 index 00000000..08392f5d --- /dev/null +++ b/docs/examples/tablesdb/update-url-column.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateUrlColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'https://example.com', + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md new file mode 100644 index 00000000..58f94220 --- /dev/null +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.updateVarcharColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md new file mode 100644 index 00000000..7cbf6f58 --- /dev/null +++ b/docs/examples/tablesdb/update.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.update({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', // optional + enabled: false // optional +}); +``` diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md new file mode 100644 index 00000000..f544bc06 --- /dev/null +++ b/docs/examples/tablesdb/upsert-row.md @@ -0,0 +1,25 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.upsertRow({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rowId: '<ROW_ID>', + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional + permissions: [sdk.Permission.read(sdk.Role.any())], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md new file mode 100644 index 00000000..7bbf2ed3 --- /dev/null +++ b/docs/examples/tablesdb/upsert-rows.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tablesDB = new sdk.TablesDB(client); + +const result = await tablesDB.upsertRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rows: [], + transactionId: '<TRANSACTION_ID>' // optional +}); +``` diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md new file mode 100644 index 00000000..910bb757 --- /dev/null +++ b/docs/examples/teams/create-membership.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.createMembership({ + teamId: '<TEAM_ID>', + roles: [], + email: 'email@example.com', // optional + userId: '<USER_ID>', // optional + phone: '+12065550100', // optional + url: 'https://example.com', // optional + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md new file mode 100644 index 00000000..8e5702b2 --- /dev/null +++ b/docs/examples/teams/create.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.create({ + teamId: '<TEAM_ID>', + name: '<NAME>', + roles: [] // optional +}); +``` diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md new file mode 100644 index 00000000..7dd11603 --- /dev/null +++ b/docs/examples/teams/delete-membership.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.deleteMembership({ + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>' +}); +``` diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md new file mode 100644 index 00000000..8593956f --- /dev/null +++ b/docs/examples/teams/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.delete({ + teamId: '<TEAM_ID>' +}); +``` diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md new file mode 100644 index 00000000..4ecf078d --- /dev/null +++ b/docs/examples/teams/get-membership.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.getMembership({ + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>' +}); +``` diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md new file mode 100644 index 00000000..0238bdba --- /dev/null +++ b/docs/examples/teams/get-prefs.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.getPrefs({ + teamId: '<TEAM_ID>' +}); +``` diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md new file mode 100644 index 00000000..bd01c5c5 --- /dev/null +++ b/docs/examples/teams/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.get({ + teamId: '<TEAM_ID>' +}); +``` diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md new file mode 100644 index 00000000..1185380b --- /dev/null +++ b/docs/examples/teams/list-memberships.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.listMemberships({ + teamId: '<TEAM_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md new file mode 100644 index 00000000..b4525fba --- /dev/null +++ b/docs/examples/teams/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md new file mode 100644 index 00000000..614737ec --- /dev/null +++ b/docs/examples/teams/update-membership-status.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updateMembershipStatus({ + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + userId: '<USER_ID>', + secret: '<SECRET>' +}); +``` diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md new file mode 100644 index 00000000..95a5c375 --- /dev/null +++ b/docs/examples/teams/update-membership.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updateMembership({ + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + roles: [] +}); +``` diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md new file mode 100644 index 00000000..0c64d2ba --- /dev/null +++ b/docs/examples/teams/update-name.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updateName({ + teamId: '<TEAM_ID>', + name: '<NAME>' +}); +``` diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md new file mode 100644 index 00000000..180e3224 --- /dev/null +++ b/docs/examples/teams/update-prefs.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updatePrefs({ + teamId: '<TEAM_ID>', + prefs: {} +}); +``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md new file mode 100644 index 00000000..bfb5d8d0 --- /dev/null +++ b/docs/examples/tokens/create-file-token.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.createFileToken({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md new file mode 100644 index 00000000..f3b40894 --- /dev/null +++ b/docs/examples/tokens/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.delete({ + tokenId: '<TOKEN_ID>' +}); +``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md new file mode 100644 index 00000000..383ea5f3 --- /dev/null +++ b/docs/examples/tokens/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.get({ + tokenId: '<TOKEN_ID>' +}); +``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md new file mode 100644 index 00000000..13e48480 --- /dev/null +++ b/docs/examples/tokens/list.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.list({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md new file mode 100644 index 00000000..0ab3b168 --- /dev/null +++ b/docs/examples/tokens/update.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.update({ + tokenId: '<TOKEN_ID>', + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md new file mode 100644 index 00000000..887f98fe --- /dev/null +++ b/docs/examples/usage/list-events.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const usage = new sdk.Usage(client); + +const result = await usage.listEvents({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md new file mode 100644 index 00000000..aa5ba1d8 --- /dev/null +++ b/docs/examples/usage/list-gauges.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const usage = new sdk.Usage(client); + +const result = await usage.listGauges({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md new file mode 100644 index 00000000..4f45f7fd --- /dev/null +++ b/docs/examples/users/create-argon-2-user.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createArgon2User({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md new file mode 100644 index 00000000..55100412 --- /dev/null +++ b/docs/examples/users/create-bcrypt-user.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createBcryptUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md new file mode 100644 index 00000000..c2e6eaa4 --- /dev/null +++ b/docs/examples/users/create-jwt.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createJWT({ + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', // optional + duration: 0 // optional +}); +``` diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md new file mode 100644 index 00000000..004c3b74 --- /dev/null +++ b/docs/examples/users/create-md-5-user.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createMD5User({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 00000000..2f712022 --- /dev/null +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createMFARecoveryCodes({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md new file mode 100644 index 00000000..945f7476 --- /dev/null +++ b/docs/examples/users/create-ph-pass-user.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createPHPassUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md new file mode 100644 index 00000000..fc8a5e00 --- /dev/null +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,20 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createScryptModifiedUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md new file mode 100644 index 00000000..e9a35358 --- /dev/null +++ b/docs/examples/users/create-scrypt-user.md @@ -0,0 +1,22 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createScryptUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordCpu: null, + passwordMemory: null, + passwordParallel: null, + passwordLength: null, + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md new file mode 100644 index 00000000..04e37680 --- /dev/null +++ b/docs/examples/users/create-session.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createSession({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md new file mode 100644 index 00000000..47c0d74b --- /dev/null +++ b/docs/examples/users/create-sha-user.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createSHAUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordVersion: sdk.PasswordHash.Sha1, // optional + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md new file mode 100644 index 00000000..bc19f2bf --- /dev/null +++ b/docs/examples/users/create-target.md @@ -0,0 +1,19 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + providerType: sdk.MessagingProviderType.Email, + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md new file mode 100644 index 00000000..5978df65 --- /dev/null +++ b/docs/examples/users/create-token.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createToken({ + userId: '<USER_ID>', + length: 4, // optional + expire: 60 // optional +}); +``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md new file mode 100644 index 00000000..5610f062 --- /dev/null +++ b/docs/examples/users/create.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.create({ + userId: '<USER_ID>', + email: 'email@example.com', // optional + phone: '+12065550100', // optional + password: '', // optional + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md new file mode 100644 index 00000000..1a730d8d --- /dev/null +++ b/docs/examples/users/delete-identity.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteIdentity({ + identityId: '<IDENTITY_ID>' +}); +``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md new file mode 100644 index 00000000..a5d4e3d0 --- /dev/null +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteMFAAuthenticator({ + userId: '<USER_ID>', + type: sdk.AuthenticatorType.Totp +}); +``` diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md new file mode 100644 index 00000000..d39eccd0 --- /dev/null +++ b/docs/examples/users/delete-session.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteSession({ + userId: '<USER_ID>', + sessionId: '<SESSION_ID>' +}); +``` diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md new file mode 100644 index 00000000..9331435b --- /dev/null +++ b/docs/examples/users/delete-sessions.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteSessions({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md new file mode 100644 index 00000000..3f579302 --- /dev/null +++ b/docs/examples/users/delete-target.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +}); +``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md new file mode 100644 index 00000000..8714dc59 --- /dev/null +++ b/docs/examples/users/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.delete({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 00000000..3e379926 --- /dev/null +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.getMFARecoveryCodes({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md new file mode 100644 index 00000000..d81539e9 --- /dev/null +++ b/docs/examples/users/get-prefs.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.getPrefs({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md new file mode 100644 index 00000000..97ee9647 --- /dev/null +++ b/docs/examples/users/get-target.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.getTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +}); +``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md new file mode 100644 index 00000000..3f86f8c9 --- /dev/null +++ b/docs/examples/users/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.get({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md new file mode 100644 index 00000000..e25c26f4 --- /dev/null +++ b/docs/examples/users/list-identities.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listIdentities({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md new file mode 100644 index 00000000..7cb97e27 --- /dev/null +++ b/docs/examples/users/list-logs.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listLogs({ + userId: '<USER_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md new file mode 100644 index 00000000..0a758c00 --- /dev/null +++ b/docs/examples/users/list-memberships.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listMemberships({ + userId: '<USER_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md new file mode 100644 index 00000000..9272a20c --- /dev/null +++ b/docs/examples/users/list-mfa-factors.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listMFAFactors({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md new file mode 100644 index 00000000..d941dcfb --- /dev/null +++ b/docs/examples/users/list-sessions.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listSessions({ + userId: '<USER_ID>', + total: false // optional +}); +``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md new file mode 100644 index 00000000..aa7be748 --- /dev/null +++ b/docs/examples/users/list-targets.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listTargets({ + userId: '<USER_ID>', + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md new file mode 100644 index 00000000..916dabc0 --- /dev/null +++ b/docs/examples/users/list.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md new file mode 100644 index 00000000..7a43202d --- /dev/null +++ b/docs/examples/users/update-email-verification.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateEmailVerification({ + userId: '<USER_ID>', + emailVerification: false +}); +``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md new file mode 100644 index 00000000..10cf0027 --- /dev/null +++ b/docs/examples/users/update-email.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateEmail({ + userId: '<USER_ID>', + email: 'email@example.com' +}); +``` diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md new file mode 100644 index 00000000..a41d11dc --- /dev/null +++ b/docs/examples/users/update-impersonator.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateImpersonator({ + userId: '<USER_ID>', + impersonator: false +}); +``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md new file mode 100644 index 00000000..28f28931 --- /dev/null +++ b/docs/examples/users/update-labels.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateLabels({ + userId: '<USER_ID>', + labels: [] +}); +``` diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 00000000..41fa921e --- /dev/null +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateMFARecoveryCodes({ + userId: '<USER_ID>' +}); +``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md new file mode 100644 index 00000000..c62e10fc --- /dev/null +++ b/docs/examples/users/update-mfa.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateMFA({ + userId: '<USER_ID>', + mfa: false +}); +``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md new file mode 100644 index 00000000..03369c9c --- /dev/null +++ b/docs/examples/users/update-name.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateName({ + userId: '<USER_ID>', + name: '<NAME>' +}); +``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md new file mode 100644 index 00000000..ab572ca0 --- /dev/null +++ b/docs/examples/users/update-password.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePassword({ + userId: '<USER_ID>', + password: '' +}); +``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md new file mode 100644 index 00000000..4489902d --- /dev/null +++ b/docs/examples/users/update-phone-verification.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePhoneVerification({ + userId: '<USER_ID>', + phoneVerification: false +}); +``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md new file mode 100644 index 00000000..d45d5ed0 --- /dev/null +++ b/docs/examples/users/update-phone.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePhone({ + userId: '<USER_ID>', + number: '+12065550100' +}); +``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md new file mode 100644 index 00000000..3bb011ae --- /dev/null +++ b/docs/examples/users/update-prefs.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePrefs({ + userId: '<USER_ID>', + prefs: {} +}); +``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md new file mode 100644 index 00000000..ec7d5bdb --- /dev/null +++ b/docs/examples/users/update-status.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateStatus({ + userId: '<USER_ID>', + status: false +}); +``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md new file mode 100644 index 00000000..d1dcf74a --- /dev/null +++ b/docs/examples/users/update-target.md @@ -0,0 +1,18 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // optional + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +}); +``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md new file mode 100644 index 00000000..c8603872 --- /dev/null +++ b/docs/examples/webhooks/create.md @@ -0,0 +1,22 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new sdk.Webhooks(client); + +const result = await webhooks.create({ + webhookId: '<WEBHOOK_ID>', + url: '', + name: '<NAME>', + events: [], + enabled: false, // optional + tls: false, // optional + authUsername: '<AUTH_USERNAME>', // optional + authPassword: '<AUTH_PASSWORD>', // optional + secret: '<SECRET>' // optional +}); +``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md new file mode 100644 index 00000000..51639e22 --- /dev/null +++ b/docs/examples/webhooks/delete.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new sdk.Webhooks(client); + +const result = await webhooks.delete({ + webhookId: '<WEBHOOK_ID>' +}); +``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md new file mode 100644 index 00000000..07d1ecda --- /dev/null +++ b/docs/examples/webhooks/get.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new sdk.Webhooks(client); + +const result = await webhooks.get({ + webhookId: '<WEBHOOK_ID>' +}); +``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md new file mode 100644 index 00000000..f509df71 --- /dev/null +++ b/docs/examples/webhooks/list.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new sdk.Webhooks(client); + +const result = await webhooks.list({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md new file mode 100644 index 00000000..7c0e504c --- /dev/null +++ b/docs/examples/webhooks/update-secret.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new sdk.Webhooks(client); + +const result = await webhooks.updateSecret({ + webhookId: '<WEBHOOK_ID>', + secret: '<SECRET>' // optional +}); +``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md new file mode 100644 index 00000000..6596e900 --- /dev/null +++ b/docs/examples/webhooks/update.md @@ -0,0 +1,21 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const webhooks = new sdk.Webhooks(client); + +const result = await webhooks.update({ + webhookId: '<WEBHOOK_ID>', + name: '<NAME>', + url: '', + events: [], + enabled: false, // optional + tls: false, // optional + authUsername: '<AUTH_USERNAME>', // optional + authPassword: '<AUTH_PASSWORD>' // optional +}); +``` diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..fa96a4ec --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5093 @@ +{ + "name": "node-appwrite", + "version": "25.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "node-appwrite", + "version": "25.1.0", + "dependencies": { + "json-bigint": "1.0.0", + "node-fetch-native-with-agent": "1.7.2" + }, + "devDependencies": { + "@types/json-bigint": "1.0.4", + "@types/node": "20.11.25", + "esbuild-plugin-file-path-extensions": "^2.0.0", + "jest": "^29.7.0", + "tslib": "2.6.2", + "tsup": "^8.5.1", + "typescript": "5.4.2" + }, + "license": "BSD-3-Clause" + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.0.tgz", + "integrity": "sha512-T1NCJqT/j9+cn8fvkt7jtwbLBfLC/1y1c7NtCeXFRgzGTsafi68MRv8yzkYSapBnFA6L3U2VSc02ciDzoAJhJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", + "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helpers": "^7.28.6", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/traverse": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", + "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.28.6", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-validator-identifier": "^7.28.5", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", + "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", + "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.2.tgz", + "integrity": "sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-attributes/-/plugin-syntax-import-attributes-7.28.6.tgz", + "integrity": "sha512-jiLC0ma9XkQT3TKJ9uYvlakm66Pamywo+qwL+oL8HJOvc6TWdZXVfhqJr8CCzbSGUAbDOzlGHJC1U+vRfLQDvw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.28.6.tgz", + "integrity": "sha512-wgEmr06G6sIpqr8YDwA2dSRTE3bJ+V0IfpzfSY3Lfgd7YWOaAdlykvJi13ZKBt8cZHfgH1IXN+CL656W3uUa4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.28.6.tgz", + "integrity": "sha512-+nDNmQye7nlnuuHDboPbGm00Vqg3oO8niRRL27/4LYHUsHYh0zJ1xWOz0uRwNFmM1Avzk8wZbc6rdiYhomzv/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.28.6", + "@babel/parser": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", + "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", + "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.7.tgz", + "integrity": "sha512-EKX3Qwmhz1eMdEJokhALr0YiD0lhQNwDqkPYyPhiSwKrh7/4KRjQc04sZ8db+5DVVnZ1LmbNDI1uAMPEUBnQPg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.7.tgz", + "integrity": "sha512-jbPXvB4Yj2yBV7HUfE2KHe4GJX51QplCN1pGbYjvsyCZbQmies29EoJbkEc+vYuU5o45AfQn37vZlyXy4YJ8RQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.7.tgz", + "integrity": "sha512-62dPZHpIXzvChfvfLJow3q5dDtiNMkwiRzPylSCfriLvZeq0a1bWChrGx/BbUbPwOrsWKMn8idSllklzBy+dgQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.7.tgz", + "integrity": "sha512-x5VpMODneVDb70PYV2VQOmIUUiBtY3D3mPBG8NxVk5CogneYhkR7MmM3yR/uMdITLrC1ml/NV1rj4bMJuy9MCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.7.tgz", + "integrity": "sha512-5lckdqeuBPlKUwvoCXIgI2D9/ABmPq3Rdp7IfL70393YgaASt7tbju3Ac+ePVi3KDH6N2RqePfHnXkaDtY9fkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.7.tgz", + "integrity": "sha512-rYnXrKcXuT7Z+WL5K980jVFdvVKhCHhUwid+dDYQpH+qu+TefcomiMAJpIiC2EM3Rjtq0sO3StMV/+3w3MyyqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.7.tgz", + "integrity": "sha512-B48PqeCsEgOtzME2GbNM2roU29AMTuOIN91dsMO30t+Ydis3z/3Ngoj5hhnsOSSwNzS+6JppqWsuhTp6E82l2w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.7.tgz", + "integrity": "sha512-jOBDK5XEjA4m5IJK3bpAQF9/Lelu/Z9ZcdhTRLf4cajlB+8VEhFFRjWgfy3M1O4rO2GQ/b2dLwCUGpiF/eATNQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.7.tgz", + "integrity": "sha512-RkT/YXYBTSULo3+af8Ib0ykH8u2MBh57o7q/DAs3lTJlyVQkgQvlrPTnjIzzRPQyavxtPtfg0EopvDyIt0j1rA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.7.tgz", + "integrity": "sha512-RZPHBoxXuNnPQO9rvjh5jdkRmVizktkT7TCDkDmQ0W2SwHInKCAV95GRuvdSvA7w4VMwfCjUiPwDi0ZO6Nfe9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.7.tgz", + "integrity": "sha512-GA48aKNkyQDbd3KtkplYWT102C5sn/EZTY4XROkxONgruHPU72l+gW+FfF8tf2cFjeHaRbWpOYa/uRBz/Xq1Pg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.7.tgz", + "integrity": "sha512-a4POruNM2oWsD4WKvBSEKGIiWQF8fZOAsycHOt6JBpZ+JN2n2JH9WAv56SOyu9X5IqAjqSIPTaJkqN8F7XOQ5Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.7.tgz", + "integrity": "sha512-KabT5I6StirGfIz0FMgl1I+R1H73Gp0ofL9A3nG3i/cYFJzKHhouBV5VWK1CSgKvVaG4q1RNpCTR2LuTVB3fIw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.7.tgz", + "integrity": "sha512-gRsL4x6wsGHGRqhtI+ifpN/vpOFTQtnbsupUF5R5YTAg+y/lKelYR1hXbnBdzDjGbMYjVJLJTd2OFmMewAgwlQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.7.tgz", + "integrity": "sha512-hL25LbxO1QOngGzu2U5xeXtxXcW+/GvMN3ejANqXkxZ/opySAZMrc+9LY/WyjAan41unrR3YrmtTsUpwT66InQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.7.tgz", + "integrity": "sha512-2k8go8Ycu1Kb46vEelhu1vqEP+UeRVj2zY1pSuPdgvbd5ykAw82Lrro28vXUrRmzEsUV0NzCf54yARIK8r0fdw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.7.tgz", + "integrity": "sha512-hzznmADPt+OmsYzw1EE33ccA+HPdIqiCRq7cQeL1Jlq2gb1+OyWBkMCrYGBJ+sxVzve2ZJEVeePbLM2iEIZSxA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.7.tgz", + "integrity": "sha512-b6pqtrQdigZBwZxAn1UpazEisvwaIDvdbMbmrly7cDTMFnw/+3lVxxCTGOrkPVnsYIosJJXAsILG9XcQS+Yu6w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.7.tgz", + "integrity": "sha512-OfatkLojr6U+WN5EDYuoQhtM+1xco+/6FSzJJnuWiUw5eVcicbyK3dq5EeV/QHT1uy6GoDhGbFpprUiHUYggrw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.7.tgz", + "integrity": "sha512-AFuojMQTxAz75Fo8idVcqoQWEHIXFRbOc1TrVcFSgCZtQfSdc1RXgB3tjOn/krRHENUB4j00bfGjyl2mJrU37A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.7.tgz", + "integrity": "sha512-+A1NJmfM8WNDv5CLVQYJ5PshuRm/4cI6WMZRg1by1GwPIQPCTs1GLEUHwiiQGT5zDdyLiRM/l1G0Pv54gvtKIg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.7.tgz", + "integrity": "sha512-+KrvYb/C8zA9CU/g0sR6w2RBw7IGc5J2BPnc3dYc5VJxHCSF1yNMxTV5LQ7GuKteQXZtspjFbiuW5/dOj7H4Yw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.7.tgz", + "integrity": "sha512-ikktIhFBzQNt/QDyOL580ti9+5mL/YZeUPKU2ivGtGjdTYoqz6jObj6nOMfhASpS4GU4Q/Clh1QtxWAvcYKamA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.7.tgz", + "integrity": "sha512-7yRhbHvPqSpRUV7Q20VuDwbjW5kIMwTHpptuUzV+AA46kiPze5Z7qgt6CLCK3pWFrHeNfDd1VKgyP4O+ng17CA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.7.tgz", + "integrity": "sha512-SmwKXe6VHIyZYbBLJrhOoCJRB/Z1tckzmgTLfFYOfpMAx63BJEaL9ExI8x7v0oAO3Zh6D/Oi1gVxEYr5oUCFhw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.7.tgz", + "integrity": "sha512-56hiAJPhwQ1R4i+21FVF7V8kSD5zZTdHcVuRFMW0hn753vVfQN8xlx4uOPT4xoGH0Z/oVATuR82AiqSTDIpaHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.1.tgz", + "integrity": "sha512-d6FinEBLdIiK+1uACUttJKfgZREXrF0Qc2SmLII7W2AD8FfiZ9Wjd+rD/iRuf5s5dWrr1GgwXCvPqOuDquOowA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.1.tgz", + "integrity": "sha512-YjG/EwIDvvYI1YvYbHvDz/BYHtkY4ygUIXHnTdLhG+hKIQFBiosfWiACWortsKPKU/+dUwQQCKQM3qrDe8c9BA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.1.tgz", + "integrity": "sha512-mjCpF7GmkRtSJwon+Rq1N8+pI+8l7w5g9Z3vWj4T7abguC4Czwi3Yu/pFaLvA3TTeMVjnu3ctigusqWUfjZzvw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.1.tgz", + "integrity": "sha512-haZ7hJ1JT4e9hqkoT9R/19XW2QKqjfJVv+i5AGg57S+nLk9lQnJ1F/eZloRO3o9Scy9CM3wQ9l+dkXtcBgN5Ew==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.1.tgz", + "integrity": "sha512-czw90wpQq3ZsAVBlinZjAYTKduOjTywlG7fEeWKUA7oCmpA8xdTkxZZlwNJKWqILlq0wehoZcJYfBvOyhPTQ6w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.1.tgz", + "integrity": "sha512-KVB2rqsxTHuBtfOeySEyzEOB7ltlB/ux38iu2rBQzkjbwRVlkhAGIEDiiYnO2kFOkJp+Z7pUXKyrRRFuFUKt+g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.1.tgz", + "integrity": "sha512-L+34Qqil+v5uC0zEubW7uByo78WOCIrBvci69E7sFASRl0X7b/MB6Cqd1lky/CtcSVTydWa2WZwFuWexjS5o6g==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.1.tgz", + "integrity": "sha512-n83O8rt4v34hgFzlkb1ycniJh7IR5RCIqt6mz1VRJD6pmhRi0CXdmfnLu9dIUS6buzh60IvACM842Ffb3xd6Gg==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.1.tgz", + "integrity": "sha512-Nql7sTeAzhTAja3QXeAI48+/+GjBJ+QmAH13snn0AJSNL50JsDqotyudHyMbO2RbJkskbMbFJfIJKWA6R1LCJQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.1.tgz", + "integrity": "sha512-+pUymDhd0ys9GcKZPPWlFiZ67sTWV5UU6zOJat02M1+PiuSGDziyRuI/pPue3hoUwm2uGfxdL+trT6Z9rxnlMA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.1.tgz", + "integrity": "sha512-VSvgvQeIcsEvY4bKDHEDWcpW4Yw7BtlKG1GUT4FzBUlEKQK0rWHYBqQt6Fm2taXS+1bXvJT6kICu5ZwqKCnvlQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.1.tgz", + "integrity": "sha512-4LqhUomJqwe641gsPp6xLfhqWMbQV04KtPp7/dIp0nzPxAkNY1AbwL5W0MQpcalLYk07vaW9Kp1PBhdpZYYcEw==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.1.tgz", + "integrity": "sha512-tLQQ9aPvkBxOc/EUT6j3pyeMD6Hb8QF2BTBnCQWP/uu1lhc9AIrIjKnLYMEroIz/JvtGYgI9dF3AxHZNaEH0rw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.1.tgz", + "integrity": "sha512-RMxFhJwc9fSXP6PqmAz4cbv3kAyvD1etJFjTx4ONqFP9DkTkXsAMU4v3Vyc5BgzC+anz7nS/9tp4obsKfqkDHg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.1.tgz", + "integrity": "sha512-QKgFl+Yc1eEk6MmOBfRHYF6lTxiiiV3/z/BRrbSiW2I7AFTXoBFvdMEyglohPj//2mZS4hDOqeB0H1ACh3sBbg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.1.tgz", + "integrity": "sha512-RAjXjP/8c6ZtzatZcA1RaQr6O1TRhzC+adn8YZDnChliZHviqIjmvFwHcxi4JKPSDAt6Uhf/7vqcBzQJy0PDJg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.1.tgz", + "integrity": "sha512-wcuocpaOlaL1COBYiA89O6yfjlp3RwKDeTIA0hM7OpmhR1Bjo9j31G1uQVpDlTvwxGn2nQs65fBFL5UFd76FcQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.1.tgz", + "integrity": "sha512-77PpsFQUCOiZR9+LQEFg9GClyfkNXj1MP6wRnzYs0EeWbPcHs02AXu4xuUbM1zhwn3wqaizle3AEYg5aeoohhg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.1.tgz", + "integrity": "sha512-5cIATbk5vynAjqqmyBjlciMJl1+R/CwX9oLk/EyiFXDWd95KpHdrOJT//rnUl4cUcskrd0jCCw3wpZnhIHdD9w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.1.tgz", + "integrity": "sha512-cl0w09WsCi17mcmWqqglez9Gk8isgeWvoUZ3WiJFYSR3zjBQc2J5/ihSjpl+VLjPqjQ/1hJRcqBfLjssREQILw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.1.tgz", + "integrity": "sha512-4Cv23ZrONRbNtbZa37mLSueXUCtN7MXccChtKpUnQNgF010rjrjfHx3QxkS2PI7LqGT5xXyYs1a7LbzAwT0iCA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.1.tgz", + "integrity": "sha512-i1okWYkA4FJICtr7KpYzFpRTHgy5jdDbZiWfvny21iIKky5YExiDXP+zbXzm3dUcFpkEeYNHgQ5fuG236JPq0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.1.tgz", + "integrity": "sha512-u09m3CuwLzShA0EYKMNiFgcjjzwqtUMLmuCJLeZWjjOYA3IT2Di09KaxGBTP9xVztWyIWjVdsB2E9goMjZvTQg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.1.tgz", + "integrity": "sha512-k+600V9Zl1CM7eZxJgMyTUzmrmhB/0XZnF4pRypKAlAgxmedUA+1v9R+XOFv56W4SlHEzfeMtzujLJD22Uz5zg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.1.tgz", + "integrity": "sha512-lWMnixq/QzxyhTV6NjQJ4SFo1J6PvOX8vUx5Wb4bBPsEb+8xZ89Bz6kOXpfXj9ak9AHTQVQzlgzBEc1SyM27xQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.10", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz", + "integrity": "sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/json-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/json-bigint/-/json-bigint-1.0.4.tgz", + "integrity": "sha512-ydHooXLbOmxBbubnA7Eh+RpBzuaIiQjh8WGJYQB50JFGFrdxW7JzVlyEV7fAXw0T2sqJ1ysTneJbiyNLqZRAag==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "20.11.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", + "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~5.26.4" + } + }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/yargs": { + "version": "17.0.35", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.35.tgz", + "integrity": "sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", + "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.2.0.tgz", + "integrity": "sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" + }, + "peerDependencies": { + "@babel/core": "^7.0.0 || ^8.0.0-0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.12", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.12.tgz", + "integrity": "sha512-qyq26DxfY4awP2gIRXhhLWfwzwI+N5Nxk6iQi8EFizIaWIjqicQTE4sLnZZVdeKPRcVNoJOkkpfzoIYuvCKaIQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/bignumber.js": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.28.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", + "update-browserslist-db": "^1.2.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/bundle-require": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bundle-require/-/bundle-require-5.1.0.tgz", + "integrity": "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "load-tsconfig": "^0.2.3" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "esbuild": ">=0.18" + } + }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001782", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001782.tgz", + "integrity": "sha512-dZcaJLJeDMh4rELYFw1tvSn1bhZWYFOt468FcbHHxx/Z/dFidd1I6ciyFdi3iwfQCyOjqo9upF6lGQYtMiJWxw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.3.tgz", + "integrity": "sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.3.tgz", + "integrity": "sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw==", + "dev": true, + "license": "MIT" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/consola": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.10.0" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dedent": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.2.tgz", + "integrity": "sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.329", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.329.tgz", + "integrity": "sha512-/4t+AS1l4S3ZC0Ja7PHFIWeBIxGA3QGqV8/yKsP36v7NcyUCl+bIcmw6s5zVuMIECWwBrAK/6QLzTmbJChBboQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/error-ex": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", + "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/esbuild": { + "version": "0.27.7", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.7.tgz", + "integrity": "sha512-IxpibTjyVnmrIQo5aqNpCgoACA/dTKLTlhMHihVHhdkxKyPO1uBBthumT0rdHmcsk9uMonIWS0m4FljWzILh3w==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.7", + "@esbuild/android-arm": "0.27.7", + "@esbuild/android-arm64": "0.27.7", + "@esbuild/android-x64": "0.27.7", + "@esbuild/darwin-arm64": "0.27.7", + "@esbuild/darwin-x64": "0.27.7", + "@esbuild/freebsd-arm64": "0.27.7", + "@esbuild/freebsd-x64": "0.27.7", + "@esbuild/linux-arm": "0.27.7", + "@esbuild/linux-arm64": "0.27.7", + "@esbuild/linux-ia32": "0.27.7", + "@esbuild/linux-loong64": "0.27.7", + "@esbuild/linux-mips64el": "0.27.7", + "@esbuild/linux-ppc64": "0.27.7", + "@esbuild/linux-riscv64": "0.27.7", + "@esbuild/linux-s390x": "0.27.7", + "@esbuild/linux-x64": "0.27.7", + "@esbuild/netbsd-arm64": "0.27.7", + "@esbuild/netbsd-x64": "0.27.7", + "@esbuild/openbsd-arm64": "0.27.7", + "@esbuild/openbsd-x64": "0.27.7", + "@esbuild/openharmony-arm64": "0.27.7", + "@esbuild/sunos-x64": "0.27.7", + "@esbuild/win32-arm64": "0.27.7", + "@esbuild/win32-ia32": "0.27.7", + "@esbuild/win32-x64": "0.27.7" + } + }, + "node_modules/esbuild-plugin-file-path-extensions": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/esbuild-plugin-file-path-extensions/-/esbuild-plugin-file-path-extensions-2.1.4.tgz", + "integrity": "sha512-lNjylaAsJMprYg28zjUyBivP3y0ms9b7RJZ5tdhDUFLa3sCbqZw4wDnbFUSmnyZYWhCYDPxxp7KkXM2TXGw3PQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=v14.0.0", + "npm": ">=7.0.0" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fix-dts-default-cjs-exports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fix-dts-default-cjs-exports/-/fix-dts-default-cjs-exports-1.0.1.tgz", + "integrity": "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "magic-string": "^0.30.17", + "mlly": "^1.7.4", + "rollup": "^4.34.8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true, + "license": "MIT" + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/import-local": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", + "integrity": "sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true, + "license": "MIT" + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.3.tgz", + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", + "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "license": "MIT", + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "3.14.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz", + "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/load-tsconfig": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/load-tsconfig/-/load-tsconfig-0.2.5.tgz", + "integrity": "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true, + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mlly": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz", + "integrity": "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.16.0", + "pathe": "^2.0.3", + "pkg-types": "^1.3.1", + "ufo": "^1.6.3" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-fetch-native-with-agent": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/node-fetch-native-with-agent/-/node-fetch-native-with-agent-1.7.2.tgz", + "integrity": "sha512-5MaOOCuJEvcckoz7/tjdx1M6OusOY6Xc5f459IaruGStWnKzlI1qpNgaAwmn4LmFYcsSlj+jBMk84wmmRxfk5g==", + "license": "MIT" + }, + "node_modules/node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.36", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.36.tgz", + "integrity": "sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", + "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/react-is": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", + "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.3.tgz", + "integrity": "sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/rollup": { + "version": "4.60.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.1.tgz", + "integrity": "sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.60.1", + "@rollup/rollup-android-arm64": "4.60.1", + "@rollup/rollup-darwin-arm64": "4.60.1", + "@rollup/rollup-darwin-x64": "4.60.1", + "@rollup/rollup-freebsd-arm64": "4.60.1", + "@rollup/rollup-freebsd-x64": "4.60.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.60.1", + "@rollup/rollup-linux-arm-musleabihf": "4.60.1", + "@rollup/rollup-linux-arm64-gnu": "4.60.1", + "@rollup/rollup-linux-arm64-musl": "4.60.1", + "@rollup/rollup-linux-loong64-gnu": "4.60.1", + "@rollup/rollup-linux-loong64-musl": "4.60.1", + "@rollup/rollup-linux-ppc64-gnu": "4.60.1", + "@rollup/rollup-linux-ppc64-musl": "4.60.1", + "@rollup/rollup-linux-riscv64-gnu": "4.60.1", + "@rollup/rollup-linux-riscv64-musl": "4.60.1", + "@rollup/rollup-linux-s390x-gnu": "4.60.1", + "@rollup/rollup-linux-x64-gnu": "4.60.1", + "@rollup/rollup-linux-x64-musl": "4.60.1", + "@rollup/rollup-openbsd-x64": "4.60.1", + "@rollup/rollup-openharmony-arm64": "4.60.1", + "@rollup/rollup-win32-arm64-msvc": "4.60.1", + "@rollup/rollup-win32-ia32-msvc": "4.60.1", + "@rollup/rollup-win32-x64-gnu": "4.60.1", + "@rollup/rollup-win32-x64-msvc": "4.60.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true, + "license": "MIT" + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true, + "license": "0BSD" + }, + "node_modules/tsup": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/tsup/-/tsup-8.5.1.tgz", + "integrity": "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing==", + "dev": true, + "license": "MIT", + "dependencies": { + "bundle-require": "^5.1.0", + "cac": "^6.7.14", + "chokidar": "^4.0.3", + "consola": "^3.4.0", + "debug": "^4.4.0", + "esbuild": "^0.27.0", + "fix-dts-default-cjs-exports": "^1.0.0", + "joycon": "^3.1.1", + "picocolors": "^1.1.1", + "postcss-load-config": "^6.0.1", + "resolve-from": "^5.0.0", + "rollup": "^4.34.8", + "source-map": "^0.7.6", + "sucrase": "^3.35.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.11", + "tree-kill": "^1.2.2" + }, + "bin": { + "tsup": "dist/cli-default.js", + "tsup-node": "dist/cli-node.js" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@microsoft/api-extractor": "^7.36.0", + "@swc/core": "^1", + "postcss": "^8.4.12", + "typescript": ">=4.5.0" + }, + "peerDependenciesMeta": { + "@microsoft/api-extractor": { + "optional": true + }, + "@swc/core": { + "optional": true + }, + "postcss": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/tsup/node_modules/source-map": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz", + "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">= 12" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", + "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/ufo": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", + "integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..6b06e984 --- /dev/null +++ b/package.json @@ -0,0 +1,57 @@ +{ + "name": "node-appwrite", + "homepage": "https://appwrite.io/support", + "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", + "version": "25.1.0", + "license": "BSD-3-Clause", + "main": "dist/index.js", + "type": "commonjs", + "scripts": { + "build": "tsup", + "test": "jest" + }, + "exports": { + ".": { + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "./file": { + "import": { + "types": "./dist/inputFile.d.mts", + "default": "./dist/inputFile.mjs" + }, + "require": { + "types": "./dist/inputFile.d.ts", + "default": "./dist/inputFile.js" + } + } + }, + "files": [ + "dist" + ], + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-node" + }, + "devDependencies": { + "@types/json-bigint": "1.0.4", + "@types/node": "20.11.25", + "tsup": "^8.5.1", + "esbuild-plugin-file-path-extensions": "^2.0.0", + "tslib": "2.6.2", + "typescript": "5.4.2", + "jest": "^29.7.0" + }, + "dependencies": { + "json-bigint": "1.0.0", + "node-fetch-native-with-agent": "1.7.2" + } +} diff --git a/src/client.ts b/src/client.ts new file mode 100644 index 00000000..37bb016a --- /dev/null +++ b/src/client.ts @@ -0,0 +1,573 @@ +import { fetch, FormData, File } from 'node-fetch-native-with-agent'; +import { createAgent } from 'node-fetch-native-with-agent/agent'; +import { Models } from './models'; +import { InputFile } from './inputFile'; +import JSONbigModule from 'json-bigint'; +const JSONbigParser = JSONbigModule({ storeAsString: false }); +const JSONbigSerializer = JSONbigModule({ useNativeBigInt: true }); + +const MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER); +const MIN_SAFE = BigInt(Number.MIN_SAFE_INTEGER); +const MAX_INT64 = BigInt('9223372036854775807'); +const MIN_INT64 = BigInt('-9223372036854775808'); + +function isBigNumber(value: any): boolean { + return value !== null + && typeof value === 'object' + && value._isBigNumber === true + && typeof value.isInteger === 'function' + && typeof value.toFixed === 'function' + && typeof value.toNumber === 'function'; +} + +function reviver(_key: string, value: any): any { + if (isBigNumber(value)) { + if (value.isInteger()) { + const str = value.toFixed(); + const bi = BigInt(str); + if (bi >= MIN_SAFE && bi <= MAX_SAFE) { + return Number(str); + } + if (bi >= MIN_INT64 && bi <= MAX_INT64) { + return bi; + } + return value.toNumber(); + } + return value.toNumber(); + } + return value; +} + +const JSONbig = { + parse: (text: string) => JSONbigParser.parse(text, reviver), + stringify: JSONbigSerializer.stringify +}; + +type Payload = { + [key: string]: any; +} + +type UploadProgress = { + $id: string; + progress: number; + sizeUploaded: number; + chunksTotal: number; + chunksUploaded: number; +} + +type Headers = { + [key: string]: string; +} + +class AppwriteException extends Error { + code: number; + response: string; + type: string; + constructor(message: string, code: number = 0, type: string = '', response: string = '') { + super(message); + this.name = 'AppwriteException'; + this.message = message; + this.code = code; + this.type = type; + this.response = response; + } +} + +function getUserAgent() { + let ua = 'AppwriteNodeJSSDK/25.1.0'; + + // `process` is a global in Node.js, but not fully available in all runtimes. + const platform: string[] = []; + if (typeof process !== 'undefined') { + if (typeof process.platform === 'string') platform.push(process.platform); + if (typeof process.arch === 'string') platform.push(process.arch); + } + if (platform.length > 0) { + ua += ` (${platform.join('; ')})`; + } + + // `navigator.userAgent` is available in Node.js 21 and later. + // It's also part of the WinterCG spec, so many edge runtimes provide it. + // https://common-min-api.proposal.wintercg.org/#requirements-for-navigatoruseragent + // @ts-ignore + if (typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string') { + // @ts-ignore + ua += ` ${navigator.userAgent}`; + + // @ts-ignore + } else if (typeof globalThis.EdgeRuntime === 'string') { + ua += ` EdgeRuntime`; + + // Older Node.js versions don't have `navigator.userAgent`, so we have to use `process.version`. + } else if (typeof process !== 'undefined' && typeof process.version === 'string') { + ua += ` Node.js/${process.version}`; + } + + return ua; +} + +class Client { + static CHUNK_SIZE = 1024 * 1024 * 5; + + config = { + endpoint: 'https://cloud.appwrite.io/v1', + selfSigned: false, + project: '', + key: '', + jwt: '', + locale: '', + session: '', + forwardeduseragent: '', + devkey: '', + cookie: '', + impersonateuserid: '', + impersonateuseremail: '', + impersonateuserphone: '', + }; + headers: Headers = { + 'x-sdk-name': 'Node.js', + 'x-sdk-platform': 'server', + 'x-sdk-language': 'nodejs', + 'x-sdk-version': '25.1.0', + 'user-agent' : getUserAgent(), + 'X-Appwrite-Response-Format': '1.9.5', + }; + + /** + * Set Endpoint + * + * Your project endpoint + * + * @param {string} endpoint + * + * @returns {this} + */ + setEndpoint(endpoint: string): this { + if (!endpoint || typeof endpoint !== 'string') { + throw new AppwriteException('Endpoint must be a valid string'); + } + + if (!endpoint.startsWith('http://') && !endpoint.startsWith('https://')) { + throw new AppwriteException('Invalid endpoint URL: ' + endpoint); + } + + this.config.endpoint = endpoint; + return this; + } + + /** + * Set self-signed + * + * @param {boolean} selfSigned + * + * @returns {this} + */ + setSelfSigned(selfSigned: boolean): this { + // @ts-ignore + if (typeof globalThis.EdgeRuntime !== 'undefined') { + console.warn('setSelfSigned is not supported in edge runtimes.'); + } + + this.config.selfSigned = selfSigned; + + return this; + } + + /** + * Add header + * + * @param {string} header + * @param {string} value + * + * @returns {this} + */ + addHeader(header: string, value: string): this { + this.headers[header.toLowerCase()] = value; + + return this; + } + + /** + * Get Headers + * + * Returns a copy of the current request headers, including any + * authentication headers. Handle with care. + * + * @returns {Headers} + */ + getHeaders(): Headers { + return { ...this.headers }; + } + + /** + * Set Project + * + * Your project ID + * + * @param value string + * + * @return {this} + */ + setProject(value: string): this { + this.headers['X-Appwrite-Project'] = value; + this.config.project = value; + return this; + } + /** + * Set Key + * + * Your secret API key + * + * @param value string + * + * @return {this} + */ + setKey(value: string): this { + this.headers['X-Appwrite-Key'] = value; + this.config.key = value; + return this; + } + /** + * Set JWT + * + * Your secret JSON Web Token + * + * @param value string + * + * @return {this} + */ + setJWT(value: string): this { + this.headers['X-Appwrite-JWT'] = value; + this.config.jwt = value; + return this; + } + /** + * Set Locale + * + * @param value string + * + * @return {this} + */ + setLocale(value: string): this { + this.headers['X-Appwrite-Locale'] = value; + this.config.locale = value; + return this; + } + /** + * Set Session + * + * The user session to authenticate with + * + * @param value string + * + * @return {this} + */ + setSession(value: string): this { + this.headers['X-Appwrite-Session'] = value; + this.config.session = value; + return this; + } + /** + * Set ForwardedUserAgent + * + * The user agent string of the client that made the request + * + * @param value string + * + * @return {this} + */ + setForwardedUserAgent(value: string): this { + this.headers['X-Forwarded-User-Agent'] = value; + this.config.forwardeduseragent = value; + return this; + } + /** + * Set DevKey + * + * Your secret dev API key + * + * @param value string + * + * @return {this} + */ + setDevKey(value: string): this { + this.headers['X-Appwrite-Dev-Key'] = value; + this.config.devkey = value; + return this; + } + /** + * Set Cookie + * + * The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes. + * + * @param value string + * + * @return {this} + */ + setCookie(value: string): this { + this.headers['Cookie'] = value; + this.config.cookie = value; + return this; + } + /** + * Set ImpersonateUserId + * + * Impersonate a user by ID on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param value string + * + * @return {this} + */ + setImpersonateUserId(value: string): this { + this.headers['X-Appwrite-Impersonate-User-Id'] = value; + this.config.impersonateuserid = value; + return this; + } + /** + * Set ImpersonateUserEmail + * + * Impersonate a user by email on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param value string + * + * @return {this} + */ + setImpersonateUserEmail(value: string): this { + this.headers['X-Appwrite-Impersonate-User-Email'] = value; + this.config.impersonateuseremail = value; + return this; + } + /** + * Set ImpersonateUserPhone + * + * Impersonate a user by phone on an already user-authenticated request. Requires the current request to be authenticated as a user with impersonator capability; X-Appwrite-Key alone is not sufficient. Impersonator users are intentionally granted users.read so they can discover a target before impersonation begins. Internal audit logs still attribute actions to the original impersonator and record the impersonated target only in internal audit payload data. + * + * @param value string + * + * @return {this} + */ + setImpersonateUserPhone(value: string): this { + this.headers['X-Appwrite-Impersonate-User-Phone'] = value; + this.config.impersonateuserphone = value; + return this; + } + + prepareRequest(method: string, url: URL, headers: Headers = {}, params: Payload = {}): { uri: string, options: RequestInit } { + method = method.toUpperCase(); + + headers = Object.assign({}, this.headers, headers); + + let options: RequestInit = { + method, + headers, + ...createAgent(this.config.endpoint, { rejectUnauthorized: !this.config.selfSigned }), + }; + + if (method === 'GET') { + for (const [key, value] of Object.entries(Client.flatten(params))) { + url.searchParams.append(key, value); + } + } else { + switch (headers['content-type']) { + case 'application/json': + options.body = JSONbig.stringify(params); + break; + + case 'multipart/form-data': + const formData = new FormData(); + + for (const [key, value] of Object.entries(params)) { + if (value instanceof File) { + formData.append(key, value, value.name); + } else if (Array.isArray(value)) { + for (const nestedValue of value) { + formData.append(`${key}[]`, nestedValue); + } + } else { + formData.append(key, value); + } + } + + options.body = formData; + delete headers['content-type']; + break; + } + } + + return { uri: url.toString(), options }; + } + + async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) { + const [fileParam, file] = Object.entries(originalPayload).find( + ([_, value]) => value instanceof File || value instanceof InputFile + ) ?? []; + + if (!file || !fileParam) { + throw new Error('File not found in payload'); + } + + if (file instanceof InputFile) { + const size = await file.size(); + + if (size <= Client.CHUNK_SIZE) { + const payload = { ...originalPayload }; + payload[fileParam] = await file.toFile(); + return await this.call(method, url, headers, payload); + } + + let start = 0; + let response = null; + + while (start < size) { + let end = start + Client.CHUNK_SIZE; + if (end >= size) { + end = size; + } + + headers['content-range'] = `bytes ${start}-${end - 1}/${size}`; + const chunk = await file.slice(start, end); + + const payload = { ...originalPayload }; + payload[fileParam] = new File([chunk], file.filename); + + response = await this.call(method, url, headers, payload); + + if (onProgress && typeof onProgress === 'function') { + onProgress({ + $id: response.$id, + progress: Math.round((end / size) * 100), + sizeUploaded: end, + chunksTotal: Math.ceil(size / Client.CHUNK_SIZE), + chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) + }); + } + + if (response && response.$id) { + headers['x-appwrite-id'] = response.$id; + } + + start = end; + } + + return response; + } + + if (file.size <= Client.CHUNK_SIZE) { + return await this.call(method, url, headers, originalPayload); + } + + let start = 0; + let response = null; + + while (start < file.size) { + let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk + if (end >= file.size) { + end = file.size; // Adjust for the last chunk to include the last byte + } + + headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`; + const chunk = file.slice(start, end); + + let payload = { ...originalPayload }; + payload[fileParam] = new File([chunk], file.name); + + response = await this.call(method, url, headers, payload); + + if (onProgress && typeof onProgress === 'function') { + onProgress({ + $id: response.$id, + progress: Math.round((end / file.size) * 100), + sizeUploaded: end, + chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE), + chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) + }); + } + + if (response && response.$id) { + headers['x-appwrite-id'] = response.$id; + } + + start = end; + } + + return response; + } + + async ping(): Promise<string> { + return this.call('GET', new URL(this.config.endpoint + '/ping')); + } + + async redirect(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<string> { + const { uri, options } = this.prepareRequest(method, url, headers, params); + + const response = await fetch(uri, { + ...options, + redirect: 'manual' + }); + + if (response.status !== 301 && response.status !== 302) { + throw new AppwriteException('Invalid redirect', response.status); + } + + return response.headers.get('location') || ''; + } + + async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> { + const { uri, options } = this.prepareRequest(method, url, headers, params); + + let data: any = null; + + const response = await fetch(uri, options); + + const warnings = response.headers.get('x-appwrite-warning'); + if (warnings) { + warnings.split(';').forEach((warning: string) => console.warn('Warning: ' + warning)); + } + + if (response.headers.get('content-type')?.includes('application/json')) { + data = JSONbig.parse(await response.text()); + } else if (responseType === 'arrayBuffer') { + data = await response.arrayBuffer(); + } else { + data = { + message: await response.text() + }; + } + + if (400 <= response.status) { + let responseText = ''; + if (response.headers.get('content-type')?.includes('application/json') || responseType === 'arrayBuffer') { + responseText = JSONbig.stringify(data); + } else { + responseText = data?.message; + } + throw new AppwriteException(data?.message, response.status, data?.type, responseText); + } + + if (data && typeof data === 'object') { + data.toString = () => JSONbig.stringify(data); + } + + return data; + } + + static flatten(data: Payload, prefix = ''): Payload { + let output: Payload = {}; + + for (const [key, value] of Object.entries(data)) { + let finalKey = prefix ? prefix + '[' + key +']' : key; + if (Array.isArray(value)) { + output = { ...output, ...Client.flatten(value, finalKey) }; + } else { + output[finalKey] = value; + } + } + + return output; + } +} + +export { Client, AppwriteException }; +export { Query } from './query'; +export type { Models, Payload, UploadProgress }; +export type { QueryTypes, QueryTypesList } from './query'; diff --git a/src/enums/adapter.ts b/src/enums/adapter.ts new file mode 100644 index 00000000..a3b1ae0c --- /dev/null +++ b/src/enums/adapter.ts @@ -0,0 +1,4 @@ +export enum Adapter { + Static = 'static', + Ssr = 'ssr', +} \ No newline at end of file diff --git a/src/enums/attribute-status.ts b/src/enums/attribute-status.ts new file mode 100644 index 00000000..ade1d36a --- /dev/null +++ b/src/enums/attribute-status.ts @@ -0,0 +1,7 @@ +export enum AttributeStatus { + Available = 'available', + Processing = 'processing', + Deleting = 'deleting', + Stuck = 'stuck', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/authentication-factor.ts b/src/enums/authentication-factor.ts new file mode 100644 index 00000000..928c4074 --- /dev/null +++ b/src/enums/authentication-factor.ts @@ -0,0 +1,6 @@ +export enum AuthenticationFactor { + Email = 'email', + Phone = 'phone', + Totp = 'totp', + Recoverycode = 'recoverycode', +} \ No newline at end of file diff --git a/src/enums/authenticator-type.ts b/src/enums/authenticator-type.ts new file mode 100644 index 00000000..34db0cca --- /dev/null +++ b/src/enums/authenticator-type.ts @@ -0,0 +1,3 @@ +export enum AuthenticatorType { + Totp = 'totp', +} \ No newline at end of file diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts new file mode 100644 index 00000000..bd0582ce --- /dev/null +++ b/src/enums/backup-services.ts @@ -0,0 +1,8 @@ +export enum BackupServices { + Databases = 'databases', + Tablesdb = 'tablesdb', + Documentsdb = 'documentsdb', + Vectorsdb = 'vectorsdb', + Functions = 'functions', + Storage = 'storage', +} \ No newline at end of file diff --git a/src/enums/browser-permission.ts b/src/enums/browser-permission.ts new file mode 100644 index 00000000..6e2c4cda --- /dev/null +++ b/src/enums/browser-permission.ts @@ -0,0 +1,22 @@ +export enum BrowserPermission { + Geolocation = 'geolocation', + Camera = 'camera', + Microphone = 'microphone', + Notifications = 'notifications', + Midi = 'midi', + Push = 'push', + Clipboardread = 'clipboard-read', + Clipboardwrite = 'clipboard-write', + Paymenthandler = 'payment-handler', + Usb = 'usb', + Bluetooth = 'bluetooth', + Accelerometer = 'accelerometer', + Gyroscope = 'gyroscope', + Magnetometer = 'magnetometer', + Ambientlightsensor = 'ambient-light-sensor', + Backgroundsync = 'background-sync', + Persistentstorage = 'persistent-storage', + Screenwakelock = 'screen-wake-lock', + Webshare = 'web-share', + Xrspatialtracking = 'xr-spatial-tracking', +} \ No newline at end of file diff --git a/src/enums/browser.ts b/src/enums/browser.ts new file mode 100644 index 00000000..cec52fb6 --- /dev/null +++ b/src/enums/browser.ts @@ -0,0 +1,16 @@ +export enum Browser { + AvantBrowser = 'aa', + AndroidWebViewBeta = 'an', + GoogleChrome = 'ch', + GoogleChromeIOS = 'ci', + GoogleChromeMobile = 'cm', + Chromium = 'cr', + MozillaFirefox = 'ff', + Safari = 'sf', + MobileSafari = 'mf', + MicrosoftEdge = 'ps', + MicrosoftEdgeIOS = 'oi', + OperaMini = 'om', + Opera = 'op', + OperaNext = 'on', +} \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts new file mode 100644 index 00000000..dddeeb2b --- /dev/null +++ b/src/enums/build-runtime.ts @@ -0,0 +1,94 @@ +export enum BuildRuntime { + Node145 = 'node-14.5', + Node160 = 'node-16.0', + Node180 = 'node-18.0', + Node190 = 'node-19.0', + Node200 = 'node-20.0', + Node210 = 'node-21.0', + Node22 = 'node-22', + Node23 = 'node-23', + Node24 = 'node-24', + Node25 = 'node-25', + Php80 = 'php-8.0', + Php81 = 'php-8.1', + Php82 = 'php-8.2', + Php83 = 'php-8.3', + Php84 = 'php-8.4', + Ruby30 = 'ruby-3.0', + Ruby31 = 'ruby-3.1', + Ruby32 = 'ruby-3.2', + Ruby33 = 'ruby-3.3', + Ruby34 = 'ruby-3.4', + Ruby40 = 'ruby-4.0', + Python38 = 'python-3.8', + Python39 = 'python-3.9', + Python310 = 'python-3.10', + Python311 = 'python-3.11', + Python312 = 'python-3.12', + Python313 = 'python-3.13', + Python314 = 'python-3.14', + Pythonml311 = 'python-ml-3.11', + Pythonml312 = 'python-ml-3.12', + Pythonml313 = 'python-ml-3.13', + Deno121 = 'deno-1.21', + Deno124 = 'deno-1.24', + Deno135 = 'deno-1.35', + Deno140 = 'deno-1.40', + Deno146 = 'deno-1.46', + Deno20 = 'deno-2.0', + Deno25 = 'deno-2.5', + Deno26 = 'deno-2.6', + Dart215 = 'dart-2.15', + Dart216 = 'dart-2.16', + Dart217 = 'dart-2.17', + Dart218 = 'dart-2.18', + Dart219 = 'dart-2.19', + Dart30 = 'dart-3.0', + Dart31 = 'dart-3.1', + Dart33 = 'dart-3.3', + Dart35 = 'dart-3.5', + Dart38 = 'dart-3.8', + Dart39 = 'dart-3.9', + Dart310 = 'dart-3.10', + Dart311 = 'dart-3.11', + Dotnet60 = 'dotnet-6.0', + Dotnet70 = 'dotnet-7.0', + Dotnet80 = 'dotnet-8.0', + Dotnet10 = 'dotnet-10', + Java80 = 'java-8.0', + Java110 = 'java-11.0', + Java170 = 'java-17.0', + Java180 = 'java-18.0', + Java210 = 'java-21.0', + Java22 = 'java-22', + Java25 = 'java-25', + Swift55 = 'swift-5.5', + Swift58 = 'swift-5.8', + Swift59 = 'swift-5.9', + Swift510 = 'swift-5.10', + Swift62 = 'swift-6.2', + Kotlin16 = 'kotlin-1.6', + Kotlin18 = 'kotlin-1.8', + Kotlin19 = 'kotlin-1.9', + Kotlin20 = 'kotlin-2.0', + Kotlin23 = 'kotlin-2.3', + Cpp17 = 'cpp-17', + Cpp20 = 'cpp-20', + Bun10 = 'bun-1.0', + Bun11 = 'bun-1.1', + Bun12 = 'bun-1.2', + Bun13 = 'bun-1.3', + Go123 = 'go-1.23', + Go124 = 'go-1.24', + Go125 = 'go-1.25', + Go126 = 'go-1.26', + Rust183 = 'rust-1.83', + Static1 = 'static-1', + Flutter324 = 'flutter-3.24', + Flutter327 = 'flutter-3.27', + Flutter329 = 'flutter-3.29', + Flutter332 = 'flutter-3.32', + Flutter335 = 'flutter-3.35', + Flutter338 = 'flutter-3.38', + Flutter341 = 'flutter-3.41', +} \ No newline at end of file diff --git a/src/enums/column-status.ts b/src/enums/column-status.ts new file mode 100644 index 00000000..f53e8a66 --- /dev/null +++ b/src/enums/column-status.ts @@ -0,0 +1,7 @@ +export enum ColumnStatus { + Available = 'available', + Processing = 'processing', + Deleting = 'deleting', + Stuck = 'stuck', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/compression.ts b/src/enums/compression.ts new file mode 100644 index 00000000..1bec0e78 --- /dev/null +++ b/src/enums/compression.ts @@ -0,0 +1,5 @@ +export enum Compression { + None = 'none', + Gzip = 'gzip', + Zstd = 'zstd', +} \ No newline at end of file diff --git a/src/enums/credit-card.ts b/src/enums/credit-card.ts new file mode 100644 index 00000000..e6ce2429 --- /dev/null +++ b/src/enums/credit-card.ts @@ -0,0 +1,19 @@ +export enum CreditCard { + AmericanExpress = 'amex', + Argencard = 'argencard', + Cabal = 'cabal', + Cencosud = 'cencosud', + DinersClub = 'diners', + Discover = 'discover', + Elo = 'elo', + Hipercard = 'hipercard', + JCB = 'jcb', + Mastercard = 'mastercard', + Naranja = 'naranja', + TarjetaShopping = 'targeta-shopping', + UnionPay = 'unionpay', + Visa = 'visa', + MIR = 'mir', + Maestro = 'maestro', + Rupay = 'rupay', +} \ No newline at end of file diff --git a/src/enums/database-type.ts b/src/enums/database-type.ts new file mode 100644 index 00000000..8ccd9699 --- /dev/null +++ b/src/enums/database-type.ts @@ -0,0 +1,6 @@ +export enum DatabaseType { + Legacy = 'legacy', + Tablesdb = 'tablesdb', + Documentsdb = 'documentsdb', + Vectorsdb = 'vectorsdb', +} \ No newline at end of file diff --git a/src/enums/databases-index-type.ts b/src/enums/databases-index-type.ts new file mode 100644 index 00000000..85ccf867 --- /dev/null +++ b/src/enums/databases-index-type.ts @@ -0,0 +1,6 @@ +export enum DatabasesIndexType { + Key = 'key', + Fulltext = 'fulltext', + Unique = 'unique', + Spatial = 'spatial', +} \ No newline at end of file diff --git a/src/enums/deployment-download-type.ts b/src/enums/deployment-download-type.ts new file mode 100644 index 00000000..538709bc --- /dev/null +++ b/src/enums/deployment-download-type.ts @@ -0,0 +1,4 @@ +export enum DeploymentDownloadType { + Source = 'source', + Output = 'output', +} \ No newline at end of file diff --git a/src/enums/deployment-status.ts b/src/enums/deployment-status.ts new file mode 100644 index 00000000..7e8f4a1b --- /dev/null +++ b/src/enums/deployment-status.ts @@ -0,0 +1,8 @@ +export enum DeploymentStatus { + Waiting = 'waiting', + Processing = 'processing', + Building = 'building', + Ready = 'ready', + Canceled = 'canceled', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/execution-method.ts b/src/enums/execution-method.ts new file mode 100644 index 00000000..39d4c1e8 --- /dev/null +++ b/src/enums/execution-method.ts @@ -0,0 +1,9 @@ +export enum ExecutionMethod { + GET = 'GET', + POST = 'POST', + PUT = 'PUT', + PATCH = 'PATCH', + DELETE = 'DELETE', + OPTIONS = 'OPTIONS', + HEAD = 'HEAD', +} \ No newline at end of file diff --git a/src/enums/execution-status.ts b/src/enums/execution-status.ts new file mode 100644 index 00000000..992d987d --- /dev/null +++ b/src/enums/execution-status.ts @@ -0,0 +1,7 @@ +export enum ExecutionStatus { + Waiting = 'waiting', + Processing = 'processing', + Completed = 'completed', + Failed = 'failed', + Scheduled = 'scheduled', +} \ No newline at end of file diff --git a/src/enums/execution-trigger.ts b/src/enums/execution-trigger.ts new file mode 100644 index 00000000..1829d514 --- /dev/null +++ b/src/enums/execution-trigger.ts @@ -0,0 +1,5 @@ +export enum ExecutionTrigger { + Http = 'http', + Schedule = 'schedule', + Event = 'event', +} \ No newline at end of file diff --git a/src/enums/flag.ts b/src/enums/flag.ts new file mode 100644 index 00000000..7e1d8781 --- /dev/null +++ b/src/enums/flag.ts @@ -0,0 +1,197 @@ +export enum Flag { + Afghanistan = 'af', + Angola = 'ao', + Albania = 'al', + Andorra = 'ad', + UnitedArabEmirates = 'ae', + Argentina = 'ar', + Armenia = 'am', + AntiguaAndBarbuda = 'ag', + Australia = 'au', + Austria = 'at', + Azerbaijan = 'az', + Burundi = 'bi', + Belgium = 'be', + Benin = 'bj', + BurkinaFaso = 'bf', + Bangladesh = 'bd', + Bulgaria = 'bg', + Bahrain = 'bh', + Bahamas = 'bs', + BosniaAndHerzegovina = 'ba', + Belarus = 'by', + Belize = 'bz', + Bolivia = 'bo', + Brazil = 'br', + Barbados = 'bb', + BruneiDarussalam = 'bn', + Bhutan = 'bt', + Botswana = 'bw', + CentralAfricanRepublic = 'cf', + Canada = 'ca', + Switzerland = 'ch', + Chile = 'cl', + China = 'cn', + CoteDIvoire = 'ci', + Cameroon = 'cm', + DemocraticRepublicOfTheCongo = 'cd', + RepublicOfTheCongo = 'cg', + Colombia = 'co', + Comoros = 'km', + CapeVerde = 'cv', + CostaRica = 'cr', + Cuba = 'cu', + Cyprus = 'cy', + CzechRepublic = 'cz', + Germany = 'de', + Djibouti = 'dj', + Dominica = 'dm', + Denmark = 'dk', + DominicanRepublic = 'do', + Algeria = 'dz', + Ecuador = 'ec', + Egypt = 'eg', + Eritrea = 'er', + Spain = 'es', + Estonia = 'ee', + Ethiopia = 'et', + Finland = 'fi', + Fiji = 'fj', + France = 'fr', + MicronesiaFederatedStatesOf = 'fm', + Gabon = 'ga', + UnitedKingdom = 'gb', + Georgia = 'ge', + Ghana = 'gh', + Guinea = 'gn', + Gambia = 'gm', + GuineaBissau = 'gw', + EquatorialGuinea = 'gq', + Greece = 'gr', + Grenada = 'gd', + Guatemala = 'gt', + Guyana = 'gy', + Honduras = 'hn', + Croatia = 'hr', + Haiti = 'ht', + Hungary = 'hu', + Indonesia = 'id', + India = 'in', + Ireland = 'ie', + IranIslamicRepublicOf = 'ir', + Iraq = 'iq', + Iceland = 'is', + Israel = 'il', + Italy = 'it', + Jamaica = 'jm', + Jordan = 'jo', + Japan = 'jp', + Kazakhstan = 'kz', + Kenya = 'ke', + Kyrgyzstan = 'kg', + Cambodia = 'kh', + Kiribati = 'ki', + SaintKittsAndNevis = 'kn', + SouthKorea = 'kr', + Kuwait = 'kw', + LaoPeopleSDemocraticRepublic = 'la', + Lebanon = 'lb', + Liberia = 'lr', + Libya = 'ly', + SaintLucia = 'lc', + Liechtenstein = 'li', + SriLanka = 'lk', + Lesotho = 'ls', + Lithuania = 'lt', + Luxembourg = 'lu', + Latvia = 'lv', + Morocco = 'ma', + Monaco = 'mc', + Moldova = 'md', + Madagascar = 'mg', + Maldives = 'mv', + Mexico = 'mx', + MarshallIslands = 'mh', + NorthMacedonia = 'mk', + Mali = 'ml', + Malta = 'mt', + Myanmar = 'mm', + Montenegro = 'me', + Mongolia = 'mn', + Mozambique = 'mz', + Mauritania = 'mr', + Mauritius = 'mu', + Malawi = 'mw', + Malaysia = 'my', + Namibia = 'na', + Niger = 'ne', + Nigeria = 'ng', + Nicaragua = 'ni', + Netherlands = 'nl', + Norway = 'no', + Nepal = 'np', + Nauru = 'nr', + NewZealand = 'nz', + Oman = 'om', + Pakistan = 'pk', + Panama = 'pa', + Peru = 'pe', + Philippines = 'ph', + Palau = 'pw', + PapuaNewGuinea = 'pg', + Poland = 'pl', + FrenchPolynesia = 'pf', + NorthKorea = 'kp', + Portugal = 'pt', + Paraguay = 'py', + Qatar = 'qa', + Romania = 'ro', + Russia = 'ru', + Rwanda = 'rw', + SaudiArabia = 'sa', + Sudan = 'sd', + Senegal = 'sn', + Singapore = 'sg', + SolomonIslands = 'sb', + SierraLeone = 'sl', + ElSalvador = 'sv', + SanMarino = 'sm', + Somalia = 'so', + Serbia = 'rs', + SouthSudan = 'ss', + SaoTomeAndPrincipe = 'st', + Suriname = 'sr', + Slovakia = 'sk', + Slovenia = 'si', + Sweden = 'se', + Eswatini = 'sz', + Seychelles = 'sc', + Syria = 'sy', + Chad = 'td', + Togo = 'tg', + Thailand = 'th', + Tajikistan = 'tj', + Turkmenistan = 'tm', + TimorLeste = 'tl', + Tonga = 'to', + TrinidadAndTobago = 'tt', + Tunisia = 'tn', + Turkey = 'tr', + Tuvalu = 'tv', + Tanzania = 'tz', + Uganda = 'ug', + Ukraine = 'ua', + Uruguay = 'uy', + UnitedStates = 'us', + Uzbekistan = 'uz', + VaticanCity = 'va', + SaintVincentAndTheGrenadines = 'vc', + Venezuela = 've', + Vietnam = 'vn', + Vanuatu = 'vu', + Samoa = 'ws', + Yemen = 'ye', + SouthAfrica = 'za', + Zambia = 'zm', + Zimbabwe = 'zw', +} \ No newline at end of file diff --git a/src/enums/framework.ts b/src/enums/framework.ts new file mode 100644 index 00000000..7093da33 --- /dev/null +++ b/src/enums/framework.ts @@ -0,0 +1,17 @@ +export enum Framework { + Analog = 'analog', + Angular = 'angular', + Nextjs = 'nextjs', + React = 'react', + Nuxt = 'nuxt', + Vue = 'vue', + Sveltekit = 'sveltekit', + Astro = 'astro', + Tanstackstart = 'tanstack-start', + Remix = 'remix', + Lynx = 'lynx', + Flutter = 'flutter', + Reactnative = 'react-native', + Vite = 'vite', + Other = 'other', +} \ No newline at end of file diff --git a/src/enums/health-antivirus-status.ts b/src/enums/health-antivirus-status.ts new file mode 100644 index 00000000..d4da4c4f --- /dev/null +++ b/src/enums/health-antivirus-status.ts @@ -0,0 +1,5 @@ +export enum HealthAntivirusStatus { + Disabled = 'disabled', + Offline = 'offline', + Online = 'online', +} \ No newline at end of file diff --git a/src/enums/health-check-status.ts b/src/enums/health-check-status.ts new file mode 100644 index 00000000..9dbc6810 --- /dev/null +++ b/src/enums/health-check-status.ts @@ -0,0 +1,4 @@ +export enum HealthCheckStatus { + Pass = 'pass', + Fail = 'fail', +} \ No newline at end of file diff --git a/src/enums/image-format.ts b/src/enums/image-format.ts new file mode 100644 index 00000000..758fad74 --- /dev/null +++ b/src/enums/image-format.ts @@ -0,0 +1,9 @@ +export enum ImageFormat { + Jpg = 'jpg', + Jpeg = 'jpeg', + Png = 'png', + Webp = 'webp', + Heic = 'heic', + Avif = 'avif', + Gif = 'gif', +} \ No newline at end of file diff --git a/src/enums/image-gravity.ts b/src/enums/image-gravity.ts new file mode 100644 index 00000000..815095dd --- /dev/null +++ b/src/enums/image-gravity.ts @@ -0,0 +1,11 @@ +export enum ImageGravity { + Center = 'center', + Topleft = 'top-left', + Top = 'top', + Topright = 'top-right', + Left = 'left', + Right = 'right', + Bottomleft = 'bottom-left', + Bottom = 'bottom', + Bottomright = 'bottom-right', +} \ No newline at end of file diff --git a/src/enums/index-status.ts b/src/enums/index-status.ts new file mode 100644 index 00000000..6ce90ac8 --- /dev/null +++ b/src/enums/index-status.ts @@ -0,0 +1,7 @@ +export enum IndexStatus { + Available = 'available', + Processing = 'processing', + Deleting = 'deleting', + Stuck = 'stuck', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/message-priority.ts b/src/enums/message-priority.ts new file mode 100644 index 00000000..f3113a85 --- /dev/null +++ b/src/enums/message-priority.ts @@ -0,0 +1,4 @@ +export enum MessagePriority { + Normal = 'normal', + High = 'high', +} \ No newline at end of file diff --git a/src/enums/message-status.ts b/src/enums/message-status.ts new file mode 100644 index 00000000..08bd483b --- /dev/null +++ b/src/enums/message-status.ts @@ -0,0 +1,7 @@ +export enum MessageStatus { + Draft = 'draft', + Processing = 'processing', + Scheduled = 'scheduled', + Sent = 'sent', + Failed = 'failed', +} \ No newline at end of file diff --git a/src/enums/messaging-provider-type.ts b/src/enums/messaging-provider-type.ts new file mode 100644 index 00000000..18c9929b --- /dev/null +++ b/src/enums/messaging-provider-type.ts @@ -0,0 +1,5 @@ +export enum MessagingProviderType { + Email = 'email', + Sms = 'sms', + Push = 'push', +} \ No newline at end of file diff --git a/src/enums/name.ts b/src/enums/name.ts new file mode 100644 index 00000000..8cd297bc --- /dev/null +++ b/src/enums/name.ts @@ -0,0 +1,15 @@ +export enum Name { + V1database = 'v1-database', + V1deletes = 'v1-deletes', + V1audits = 'v1-audits', + V1mails = 'v1-mails', + V1functions = 'v1-functions', + V1statsresources = 'v1-stats-resources', + V1statsusage = 'v1-stats-usage', + V1webhooks = 'v1-webhooks', + V1certificates = 'v1-certificates', + V1builds = 'v1-builds', + V1screenshots = 'v1-screenshots', + V1messaging = 'v1-messaging', + V1migrations = 'v1-migrations', +} \ No newline at end of file diff --git a/src/enums/o-auth-2-google-prompt.ts b/src/enums/o-auth-2-google-prompt.ts new file mode 100644 index 00000000..f8e98e12 --- /dev/null +++ b/src/enums/o-auth-2-google-prompt.ts @@ -0,0 +1,5 @@ +export enum OAuth2GooglePrompt { + None = 'none', + Consent = 'consent', + SelectAccount = 'select_account', +} \ No newline at end of file diff --git a/src/enums/o-auth-provider.ts b/src/enums/o-auth-provider.ts new file mode 100644 index 00000000..cc9e340b --- /dev/null +++ b/src/enums/o-auth-provider.ts @@ -0,0 +1,45 @@ +export enum OAuthProvider { + Amazon = 'amazon', + Apple = 'apple', + Auth0 = 'auth0', + Authentik = 'authentik', + Autodesk = 'autodesk', + Bitbucket = 'bitbucket', + Bitly = 'bitly', + Box = 'box', + Dailymotion = 'dailymotion', + Discord = 'discord', + Disqus = 'disqus', + Dropbox = 'dropbox', + Etsy = 'etsy', + Facebook = 'facebook', + Figma = 'figma', + Fusionauth = 'fusionauth', + Github = 'github', + Gitlab = 'gitlab', + Google = 'google', + Keycloak = 'keycloak', + Kick = 'kick', + Linkedin = 'linkedin', + Microsoft = 'microsoft', + Notion = 'notion', + Oidc = 'oidc', + Okta = 'okta', + Paypal = 'paypal', + PaypalSandbox = 'paypalSandbox', + Podio = 'podio', + Salesforce = 'salesforce', + Slack = 'slack', + Spotify = 'spotify', + Stripe = 'stripe', + Tradeshift = 'tradeshift', + TradeshiftBox = 'tradeshiftBox', + Twitch = 'twitch', + Wordpress = 'wordpress', + X = 'x', + Yahoo = 'yahoo', + Yammer = 'yammer', + Yandex = 'yandex', + Zoho = 'zoho', + Zoom = 'zoom', +} \ No newline at end of file diff --git a/src/enums/order-by.ts b/src/enums/order-by.ts new file mode 100644 index 00000000..62dffb98 --- /dev/null +++ b/src/enums/order-by.ts @@ -0,0 +1,4 @@ +export enum OrderBy { + Asc = 'asc', + Desc = 'desc', +} \ No newline at end of file diff --git a/src/enums/password-hash.ts b/src/enums/password-hash.ts new file mode 100644 index 00000000..76834af4 --- /dev/null +++ b/src/enums/password-hash.ts @@ -0,0 +1,13 @@ +export enum PasswordHash { + Sha1 = 'sha1', + Sha224 = 'sha224', + Sha256 = 'sha256', + Sha384 = 'sha384', + Sha512224 = 'sha512/224', + Sha512256 = 'sha512/256', + Sha512 = 'sha512', + Sha3224 = 'sha3-224', + Sha3256 = 'sha3-256', + Sha3384 = 'sha3-384', + Sha3512 = 'sha3-512', +} \ No newline at end of file diff --git a/src/enums/platform-type.ts b/src/enums/platform-type.ts new file mode 100644 index 00000000..bde1d30f --- /dev/null +++ b/src/enums/platform-type.ts @@ -0,0 +1,7 @@ +export enum PlatformType { + Windows = 'windows', + Apple = 'apple', + Android = 'android', + Linux = 'linux', + Web = 'web', +} \ No newline at end of file diff --git a/src/enums/project-auth-method-id.ts b/src/enums/project-auth-method-id.ts new file mode 100644 index 00000000..a05c217e --- /dev/null +++ b/src/enums/project-auth-method-id.ts @@ -0,0 +1,9 @@ +export enum ProjectAuthMethodId { + Emailpassword = 'email-password', + Magicurl = 'magic-url', + Emailotp = 'email-otp', + Anonymous = 'anonymous', + Invites = 'invites', + Jwt = 'jwt', + Phone = 'phone', +} \ No newline at end of file diff --git a/src/enums/project-email-template-id.ts b/src/enums/project-email-template-id.ts new file mode 100644 index 00000000..b5aba1a6 --- /dev/null +++ b/src/enums/project-email-template-id.ts @@ -0,0 +1,9 @@ +export enum ProjectEmailTemplateId { + Verification = 'verification', + MagicSession = 'magicSession', + Recovery = 'recovery', + Invitation = 'invitation', + MfaChallenge = 'mfaChallenge', + SessionAlert = 'sessionAlert', + OtpSession = 'otpSession', +} \ No newline at end of file diff --git a/src/enums/project-email-template-locale.ts b/src/enums/project-email-template-locale.ts new file mode 100644 index 00000000..b5bb7cf8 --- /dev/null +++ b/src/enums/project-email-template-locale.ts @@ -0,0 +1,133 @@ +export enum ProjectEmailTemplateLocale { + Af = 'af', + Arae = 'ar-ae', + Arbh = 'ar-bh', + Ardz = 'ar-dz', + Areg = 'ar-eg', + Ariq = 'ar-iq', + Arjo = 'ar-jo', + Arkw = 'ar-kw', + Arlb = 'ar-lb', + Arly = 'ar-ly', + Arma = 'ar-ma', + Arom = 'ar-om', + Arqa = 'ar-qa', + Arsa = 'ar-sa', + Arsy = 'ar-sy', + Artn = 'ar-tn', + Arye = 'ar-ye', + As = 'as', + Az = 'az', + Be = 'be', + Bg = 'bg', + Bh = 'bh', + Bn = 'bn', + Bs = 'bs', + Ca = 'ca', + Cs = 'cs', + Cy = 'cy', + Da = 'da', + De = 'de', + Deat = 'de-at', + Dech = 'de-ch', + Deli = 'de-li', + Delu = 'de-lu', + El = 'el', + En = 'en', + Enau = 'en-au', + Enbz = 'en-bz', + Enca = 'en-ca', + Engb = 'en-gb', + Enie = 'en-ie', + Enjm = 'en-jm', + Ennz = 'en-nz', + Entt = 'en-tt', + Enus = 'en-us', + Enza = 'en-za', + Eo = 'eo', + Es = 'es', + Esar = 'es-ar', + Esbo = 'es-bo', + Escl = 'es-cl', + Esco = 'es-co', + Escr = 'es-cr', + Esdo = 'es-do', + Esec = 'es-ec', + Esgt = 'es-gt', + Eshn = 'es-hn', + Esmx = 'es-mx', + Esni = 'es-ni', + Espa = 'es-pa', + Espe = 'es-pe', + Espr = 'es-pr', + Espy = 'es-py', + Essv = 'es-sv', + Esuy = 'es-uy', + Esve = 'es-ve', + Et = 'et', + Eu = 'eu', + Fa = 'fa', + Fi = 'fi', + Fo = 'fo', + Fr = 'fr', + Frbe = 'fr-be', + Frca = 'fr-ca', + Frch = 'fr-ch', + Frlu = 'fr-lu', + Ga = 'ga', + Gd = 'gd', + He = 'he', + Hi = 'hi', + Hr = 'hr', + Hu = 'hu', + Id = 'id', + Is = 'is', + It = 'it', + Itch = 'it-ch', + Ja = 'ja', + Ji = 'ji', + Ko = 'ko', + Ku = 'ku', + Lt = 'lt', + Lv = 'lv', + Mk = 'mk', + Ml = 'ml', + Ms = 'ms', + Mt = 'mt', + Nb = 'nb', + Ne = 'ne', + Nl = 'nl', + Nlbe = 'nl-be', + Nn = 'nn', + No = 'no', + Pa = 'pa', + Pl = 'pl', + Pt = 'pt', + Ptbr = 'pt-br', + Rm = 'rm', + Ro = 'ro', + Romd = 'ro-md', + Ru = 'ru', + Rumd = 'ru-md', + Sb = 'sb', + Sk = 'sk', + Sl = 'sl', + Sq = 'sq', + Sr = 'sr', + Sv = 'sv', + Svfi = 'sv-fi', + Th = 'th', + Tn = 'tn', + Tr = 'tr', + Ts = 'ts', + Ua = 'ua', + Ur = 'ur', + Ve = 've', + Vi = 'vi', + Xh = 'xh', + Zhcn = 'zh-cn', + Zhhk = 'zh-hk', + Zhsg = 'zh-sg', + Zhtw = 'zh-tw', + Zu = 'zu', +} \ No newline at end of file diff --git a/src/enums/project-key-scopes.ts b/src/enums/project-key-scopes.ts new file mode 100644 index 00000000..fe019965 --- /dev/null +++ b/src/enums/project-key-scopes.ts @@ -0,0 +1,96 @@ +export enum ProjectKeyScopes { + ProjectRead = 'project.read', + ProjectWrite = 'project.write', + KeysRead = 'keys.read', + KeysWrite = 'keys.write', + PlatformsRead = 'platforms.read', + PlatformsWrite = 'platforms.write', + MocksRead = 'mocks.read', + MocksWrite = 'mocks.write', + PoliciesRead = 'policies.read', + PoliciesWrite = 'policies.write', + ProjectPoliciesRead = 'project.policies.read', + ProjectPoliciesWrite = 'project.policies.write', + TemplatesRead = 'templates.read', + TemplatesWrite = 'templates.write', + Oauth2Read = 'oauth2.read', + Oauth2Write = 'oauth2.write', + UsersRead = 'users.read', + UsersWrite = 'users.write', + SessionsRead = 'sessions.read', + SessionsWrite = 'sessions.write', + TeamsRead = 'teams.read', + TeamsWrite = 'teams.write', + DatabasesRead = 'databases.read', + DatabasesWrite = 'databases.write', + TablesRead = 'tables.read', + TablesWrite = 'tables.write', + ColumnsRead = 'columns.read', + ColumnsWrite = 'columns.write', + IndexesRead = 'indexes.read', + IndexesWrite = 'indexes.write', + RowsRead = 'rows.read', + RowsWrite = 'rows.write', + CollectionsRead = 'collections.read', + CollectionsWrite = 'collections.write', + AttributesRead = 'attributes.read', + AttributesWrite = 'attributes.write', + DocumentsRead = 'documents.read', + DocumentsWrite = 'documents.write', + BucketsRead = 'buckets.read', + BucketsWrite = 'buckets.write', + FilesRead = 'files.read', + FilesWrite = 'files.write', + TokensRead = 'tokens.read', + TokensWrite = 'tokens.write', + FunctionsRead = 'functions.read', + FunctionsWrite = 'functions.write', + ExecutionsRead = 'executions.read', + ExecutionsWrite = 'executions.write', + ExecutionRead = 'execution.read', + ExecutionWrite = 'execution.write', + SitesRead = 'sites.read', + SitesWrite = 'sites.write', + LogRead = 'log.read', + LogWrite = 'log.write', + ProvidersRead = 'providers.read', + ProvidersWrite = 'providers.write', + TopicsRead = 'topics.read', + TopicsWrite = 'topics.write', + SubscribersRead = 'subscribers.read', + SubscribersWrite = 'subscribers.write', + TargetsRead = 'targets.read', + TargetsWrite = 'targets.write', + MessagesRead = 'messages.read', + MessagesWrite = 'messages.write', + RulesRead = 'rules.read', + RulesWrite = 'rules.write', + WebhooksRead = 'webhooks.read', + WebhooksWrite = 'webhooks.write', + LocaleRead = 'locale.read', + AvatarsRead = 'avatars.read', + HealthRead = 'health.read', + AssistantRead = 'assistant.read', + MigrationsRead = 'migrations.read', + MigrationsWrite = 'migrations.write', + SchedulesRead = 'schedules.read', + SchedulesWrite = 'schedules.write', + VcsRead = 'vcs.read', + VcsWrite = 'vcs.write', + InsightsRead = 'insights.read', + InsightsWrite = 'insights.write', + ReportsRead = 'reports.read', + ReportsWrite = 'reports.write', + PresencesRead = 'presences.read', + PresencesWrite = 'presences.write', + BackupsPoliciesRead = 'backups.policies.read', + BackupsPoliciesWrite = 'backups.policies.write', + ArchivesRead = 'archives.read', + ArchivesWrite = 'archives.write', + RestorationsRead = 'restorations.read', + RestorationsWrite = 'restorations.write', + DomainsRead = 'domains.read', + DomainsWrite = 'domains.write', + EventsRead = 'events.read', + UsageRead = 'usage.read', +} \ No newline at end of file diff --git a/src/enums/project-o-auth-2-google-prompt.ts b/src/enums/project-o-auth-2-google-prompt.ts new file mode 100644 index 00000000..75db98ec --- /dev/null +++ b/src/enums/project-o-auth-2-google-prompt.ts @@ -0,0 +1,5 @@ +export enum ProjectOAuth2GooglePrompt { + None = 'none', + Consent = 'consent', + SelectAccount = 'select_account', +} \ No newline at end of file diff --git a/src/enums/project-o-auth-provider-id.ts b/src/enums/project-o-auth-provider-id.ts new file mode 100644 index 00000000..e35d6ef0 --- /dev/null +++ b/src/enums/project-o-auth-provider-id.ts @@ -0,0 +1,47 @@ +export enum ProjectOAuthProviderId { + Amazon = 'amazon', + Apple = 'apple', + Auth0 = 'auth0', + Authentik = 'authentik', + Autodesk = 'autodesk', + Bitbucket = 'bitbucket', + Bitly = 'bitly', + Box = 'box', + Dailymotion = 'dailymotion', + Discord = 'discord', + Disqus = 'disqus', + Dropbox = 'dropbox', + Etsy = 'etsy', + Facebook = 'facebook', + Figma = 'figma', + Fusionauth = 'fusionauth', + Github = 'github', + Gitlab = 'gitlab', + Google = 'google', + Keycloak = 'keycloak', + Kick = 'kick', + Linkedin = 'linkedin', + Microsoft = 'microsoft', + Notion = 'notion', + Oidc = 'oidc', + Okta = 'okta', + Paypal = 'paypal', + PaypalSandbox = 'paypalSandbox', + Podio = 'podio', + Salesforce = 'salesforce', + Slack = 'slack', + Spotify = 'spotify', + Stripe = 'stripe', + Tradeshift = 'tradeshift', + TradeshiftBox = 'tradeshiftBox', + Twitch = 'twitch', + Wordpress = 'wordpress', + X = 'x', + Yahoo = 'yahoo', + Yammer = 'yammer', + Yandex = 'yandex', + Zoho = 'zoho', + Zoom = 'zoom', + GithubImagine = 'githubImagine', + GoogleImagine = 'googleImagine', +} \ No newline at end of file diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts new file mode 100644 index 00000000..2031ce9b --- /dev/null +++ b/src/enums/project-policy-id.ts @@ -0,0 +1,11 @@ +export enum ProjectPolicyId { + Passworddictionary = 'password-dictionary', + Passwordhistory = 'password-history', + Passwordpersonaldata = 'password-personal-data', + Sessionalert = 'session-alert', + Sessionduration = 'session-duration', + Sessioninvalidation = 'session-invalidation', + Sessionlimit = 'session-limit', + Userlimit = 'user-limit', + Membershipprivacy = 'membership-privacy', +} \ No newline at end of file diff --git a/src/enums/project-protocol-id.ts b/src/enums/project-protocol-id.ts new file mode 100644 index 00000000..10a89c21 --- /dev/null +++ b/src/enums/project-protocol-id.ts @@ -0,0 +1,5 @@ +export enum ProjectProtocolId { + Rest = 'rest', + Graphql = 'graphql', + Websocket = 'websocket', +} \ No newline at end of file diff --git a/src/enums/project-service-id.ts b/src/enums/project-service-id.ts new file mode 100644 index 00000000..01f844a8 --- /dev/null +++ b/src/enums/project-service-id.ts @@ -0,0 +1,20 @@ +export enum ProjectServiceId { + Account = 'account', + Avatars = 'avatars', + Databases = 'databases', + Tablesdb = 'tablesdb', + Locale = 'locale', + Health = 'health', + Project = 'project', + Storage = 'storage', + Teams = 'teams', + Users = 'users', + Vcs = 'vcs', + Sites = 'sites', + Functions = 'functions', + Proxy = 'proxy', + Graphql = 'graphql', + Migrations = 'migrations', + Messaging = 'messaging', + Advisor = 'advisor', +} \ No newline at end of file diff --git a/src/enums/project-smtp-secure.ts b/src/enums/project-smtp-secure.ts new file mode 100644 index 00000000..d3d37687 --- /dev/null +++ b/src/enums/project-smtp-secure.ts @@ -0,0 +1,4 @@ +export enum ProjectSMTPSecure { + Tls = 'tls', + Ssl = 'ssl', +} \ No newline at end of file diff --git a/src/enums/proxy-resource-type.ts b/src/enums/proxy-resource-type.ts new file mode 100644 index 00000000..e04c8046 --- /dev/null +++ b/src/enums/proxy-resource-type.ts @@ -0,0 +1,4 @@ +export enum ProxyResourceType { + Site = 'site', + Function = 'function', +} \ No newline at end of file diff --git a/src/enums/proxy-rule-deployment-resource-type.ts b/src/enums/proxy-rule-deployment-resource-type.ts new file mode 100644 index 00000000..89236c74 --- /dev/null +++ b/src/enums/proxy-rule-deployment-resource-type.ts @@ -0,0 +1,4 @@ +export enum ProxyRuleDeploymentResourceType { + Function = 'function', + Site = 'site', +} \ No newline at end of file diff --git a/src/enums/proxy-rule-status.ts b/src/enums/proxy-rule-status.ts new file mode 100644 index 00000000..67b8e4cb --- /dev/null +++ b/src/enums/proxy-rule-status.ts @@ -0,0 +1,5 @@ +export enum ProxyRuleStatus { + Unverified = 'unverified', + Verifying = 'verifying', + Verified = 'verified', +} \ No newline at end of file diff --git a/src/enums/relation-mutate.ts b/src/enums/relation-mutate.ts new file mode 100644 index 00000000..722a7572 --- /dev/null +++ b/src/enums/relation-mutate.ts @@ -0,0 +1,5 @@ +export enum RelationMutate { + Cascade = 'cascade', + Restrict = 'restrict', + SetNull = 'setNull', +} \ No newline at end of file diff --git a/src/enums/relationship-type.ts b/src/enums/relationship-type.ts new file mode 100644 index 00000000..532015af --- /dev/null +++ b/src/enums/relationship-type.ts @@ -0,0 +1,6 @@ +export enum RelationshipType { + OneToOne = 'oneToOne', + ManyToOne = 'manyToOne', + ManyToMany = 'manyToMany', + OneToMany = 'oneToMany', +} \ No newline at end of file diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts new file mode 100644 index 00000000..a2b22ef0 --- /dev/null +++ b/src/enums/runtime.ts @@ -0,0 +1,94 @@ +export enum Runtime { + Node145 = 'node-14.5', + Node160 = 'node-16.0', + Node180 = 'node-18.0', + Node190 = 'node-19.0', + Node200 = 'node-20.0', + Node210 = 'node-21.0', + Node22 = 'node-22', + Node23 = 'node-23', + Node24 = 'node-24', + Node25 = 'node-25', + Php80 = 'php-8.0', + Php81 = 'php-8.1', + Php82 = 'php-8.2', + Php83 = 'php-8.3', + Php84 = 'php-8.4', + Ruby30 = 'ruby-3.0', + Ruby31 = 'ruby-3.1', + Ruby32 = 'ruby-3.2', + Ruby33 = 'ruby-3.3', + Ruby34 = 'ruby-3.4', + Ruby40 = 'ruby-4.0', + Python38 = 'python-3.8', + Python39 = 'python-3.9', + Python310 = 'python-3.10', + Python311 = 'python-3.11', + Python312 = 'python-3.12', + Python313 = 'python-3.13', + Python314 = 'python-3.14', + Pythonml311 = 'python-ml-3.11', + Pythonml312 = 'python-ml-3.12', + Pythonml313 = 'python-ml-3.13', + Deno121 = 'deno-1.21', + Deno124 = 'deno-1.24', + Deno135 = 'deno-1.35', + Deno140 = 'deno-1.40', + Deno146 = 'deno-1.46', + Deno20 = 'deno-2.0', + Deno25 = 'deno-2.5', + Deno26 = 'deno-2.6', + Dart215 = 'dart-2.15', + Dart216 = 'dart-2.16', + Dart217 = 'dart-2.17', + Dart218 = 'dart-2.18', + Dart219 = 'dart-2.19', + Dart30 = 'dart-3.0', + Dart31 = 'dart-3.1', + Dart33 = 'dart-3.3', + Dart35 = 'dart-3.5', + Dart38 = 'dart-3.8', + Dart39 = 'dart-3.9', + Dart310 = 'dart-3.10', + Dart311 = 'dart-3.11', + Dotnet60 = 'dotnet-6.0', + Dotnet70 = 'dotnet-7.0', + Dotnet80 = 'dotnet-8.0', + Dotnet10 = 'dotnet-10', + Java80 = 'java-8.0', + Java110 = 'java-11.0', + Java170 = 'java-17.0', + Java180 = 'java-18.0', + Java210 = 'java-21.0', + Java22 = 'java-22', + Java25 = 'java-25', + Swift55 = 'swift-5.5', + Swift58 = 'swift-5.8', + Swift59 = 'swift-5.9', + Swift510 = 'swift-5.10', + Swift62 = 'swift-6.2', + Kotlin16 = 'kotlin-1.6', + Kotlin18 = 'kotlin-1.8', + Kotlin19 = 'kotlin-1.9', + Kotlin20 = 'kotlin-2.0', + Kotlin23 = 'kotlin-2.3', + Cpp17 = 'cpp-17', + Cpp20 = 'cpp-20', + Bun10 = 'bun-1.0', + Bun11 = 'bun-1.1', + Bun12 = 'bun-1.2', + Bun13 = 'bun-1.3', + Go123 = 'go-1.23', + Go124 = 'go-1.24', + Go125 = 'go-1.25', + Go126 = 'go-1.26', + Rust183 = 'rust-1.83', + Static1 = 'static-1', + Flutter324 = 'flutter-3.24', + Flutter327 = 'flutter-3.27', + Flutter329 = 'flutter-3.29', + Flutter332 = 'flutter-3.32', + Flutter335 = 'flutter-3.35', + Flutter338 = 'flutter-3.38', + Flutter341 = 'flutter-3.41', +} \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts new file mode 100644 index 00000000..54e9cb31 --- /dev/null +++ b/src/enums/scopes.ts @@ -0,0 +1,96 @@ +export enum Scopes { + ProjectRead = 'project.read', + ProjectWrite = 'project.write', + KeysRead = 'keys.read', + KeysWrite = 'keys.write', + PlatformsRead = 'platforms.read', + PlatformsWrite = 'platforms.write', + MocksRead = 'mocks.read', + MocksWrite = 'mocks.write', + PoliciesRead = 'policies.read', + PoliciesWrite = 'policies.write', + ProjectPoliciesRead = 'project.policies.read', + ProjectPoliciesWrite = 'project.policies.write', + TemplatesRead = 'templates.read', + TemplatesWrite = 'templates.write', + Oauth2Read = 'oauth2.read', + Oauth2Write = 'oauth2.write', + UsersRead = 'users.read', + UsersWrite = 'users.write', + SessionsRead = 'sessions.read', + SessionsWrite = 'sessions.write', + TeamsRead = 'teams.read', + TeamsWrite = 'teams.write', + DatabasesRead = 'databases.read', + DatabasesWrite = 'databases.write', + TablesRead = 'tables.read', + TablesWrite = 'tables.write', + ColumnsRead = 'columns.read', + ColumnsWrite = 'columns.write', + IndexesRead = 'indexes.read', + IndexesWrite = 'indexes.write', + RowsRead = 'rows.read', + RowsWrite = 'rows.write', + CollectionsRead = 'collections.read', + CollectionsWrite = 'collections.write', + AttributesRead = 'attributes.read', + AttributesWrite = 'attributes.write', + DocumentsRead = 'documents.read', + DocumentsWrite = 'documents.write', + BucketsRead = 'buckets.read', + BucketsWrite = 'buckets.write', + FilesRead = 'files.read', + FilesWrite = 'files.write', + TokensRead = 'tokens.read', + TokensWrite = 'tokens.write', + FunctionsRead = 'functions.read', + FunctionsWrite = 'functions.write', + ExecutionsRead = 'executions.read', + ExecutionsWrite = 'executions.write', + ExecutionRead = 'execution.read', + ExecutionWrite = 'execution.write', + SitesRead = 'sites.read', + SitesWrite = 'sites.write', + LogRead = 'log.read', + LogWrite = 'log.write', + ProvidersRead = 'providers.read', + ProvidersWrite = 'providers.write', + TopicsRead = 'topics.read', + TopicsWrite = 'topics.write', + SubscribersRead = 'subscribers.read', + SubscribersWrite = 'subscribers.write', + TargetsRead = 'targets.read', + TargetsWrite = 'targets.write', + MessagesRead = 'messages.read', + MessagesWrite = 'messages.write', + RulesRead = 'rules.read', + RulesWrite = 'rules.write', + WebhooksRead = 'webhooks.read', + WebhooksWrite = 'webhooks.write', + LocaleRead = 'locale.read', + AvatarsRead = 'avatars.read', + HealthRead = 'health.read', + AssistantRead = 'assistant.read', + MigrationsRead = 'migrations.read', + MigrationsWrite = 'migrations.write', + SchedulesRead = 'schedules.read', + SchedulesWrite = 'schedules.write', + VcsRead = 'vcs.read', + VcsWrite = 'vcs.write', + InsightsRead = 'insights.read', + InsightsWrite = 'insights.write', + ReportsRead = 'reports.read', + ReportsWrite = 'reports.write', + PresencesRead = 'presences.read', + PresencesWrite = 'presences.write', + BackupsPoliciesRead = 'backups.policies.read', + BackupsPoliciesWrite = 'backups.policies.write', + ArchivesRead = 'archives.read', + ArchivesWrite = 'archives.write', + RestorationsRead = 'restorations.read', + RestorationsWrite = 'restorations.write', + DomainsRead = 'domains.read', + DomainsWrite = 'domains.write', + EventsRead = 'events.read', + UsageRead = 'usage.read', +} \ No newline at end of file diff --git a/src/enums/smtp-encryption.ts b/src/enums/smtp-encryption.ts new file mode 100644 index 00000000..876177b6 --- /dev/null +++ b/src/enums/smtp-encryption.ts @@ -0,0 +1,5 @@ +export enum SmtpEncryption { + None = 'none', + Ssl = 'ssl', + Tls = 'tls', +} \ No newline at end of file diff --git a/src/enums/status-code.ts b/src/enums/status-code.ts new file mode 100644 index 00000000..1f3adf8b --- /dev/null +++ b/src/enums/status-code.ts @@ -0,0 +1,6 @@ +export enum StatusCode { + MovedPermanently301 = '301', + Found302 = '302', + TemporaryRedirect307 = '307', + PermanentRedirect308 = '308', +} \ No newline at end of file diff --git a/src/enums/tables-db-index-type.ts b/src/enums/tables-db-index-type.ts new file mode 100644 index 00000000..a199cd9c --- /dev/null +++ b/src/enums/tables-db-index-type.ts @@ -0,0 +1,6 @@ +export enum TablesDBIndexType { + Key = 'key', + Fulltext = 'fulltext', + Unique = 'unique', + Spatial = 'spatial', +} \ No newline at end of file diff --git a/src/enums/template-reference-type.ts b/src/enums/template-reference-type.ts new file mode 100644 index 00000000..bd72cfb5 --- /dev/null +++ b/src/enums/template-reference-type.ts @@ -0,0 +1,5 @@ +export enum TemplateReferenceType { + Commit = 'commit', + Branch = 'branch', + Tag = 'tag', +} \ No newline at end of file diff --git a/src/enums/theme.ts b/src/enums/theme.ts new file mode 100644 index 00000000..5e823a9b --- /dev/null +++ b/src/enums/theme.ts @@ -0,0 +1,4 @@ +export enum Theme { + Light = 'light', + Dark = 'dark', +} \ No newline at end of file diff --git a/src/enums/timezone.ts b/src/enums/timezone.ts new file mode 100644 index 00000000..207298a8 --- /dev/null +++ b/src/enums/timezone.ts @@ -0,0 +1,421 @@ +export enum Timezone { + AfricaAbidjan = 'africa/abidjan', + AfricaAccra = 'africa/accra', + AfricaAddisAbaba = 'africa/addis_ababa', + AfricaAlgiers = 'africa/algiers', + AfricaAsmara = 'africa/asmara', + AfricaBamako = 'africa/bamako', + AfricaBangui = 'africa/bangui', + AfricaBanjul = 'africa/banjul', + AfricaBissau = 'africa/bissau', + AfricaBlantyre = 'africa/blantyre', + AfricaBrazzaville = 'africa/brazzaville', + AfricaBujumbura = 'africa/bujumbura', + AfricaCairo = 'africa/cairo', + AfricaCasablanca = 'africa/casablanca', + AfricaCeuta = 'africa/ceuta', + AfricaConakry = 'africa/conakry', + AfricaDakar = 'africa/dakar', + AfricaDarEsSalaam = 'africa/dar_es_salaam', + AfricaDjibouti = 'africa/djibouti', + AfricaDouala = 'africa/douala', + AfricaElAaiun = 'africa/el_aaiun', + AfricaFreetown = 'africa/freetown', + AfricaGaborone = 'africa/gaborone', + AfricaHarare = 'africa/harare', + AfricaJohannesburg = 'africa/johannesburg', + AfricaJuba = 'africa/juba', + AfricaKampala = 'africa/kampala', + AfricaKhartoum = 'africa/khartoum', + AfricaKigali = 'africa/kigali', + AfricaKinshasa = 'africa/kinshasa', + AfricaLagos = 'africa/lagos', + AfricaLibreville = 'africa/libreville', + AfricaLome = 'africa/lome', + AfricaLuanda = 'africa/luanda', + AfricaLubumbashi = 'africa/lubumbashi', + AfricaLusaka = 'africa/lusaka', + AfricaMalabo = 'africa/malabo', + AfricaMaputo = 'africa/maputo', + AfricaMaseru = 'africa/maseru', + AfricaMbabane = 'africa/mbabane', + AfricaMogadishu = 'africa/mogadishu', + AfricaMonrovia = 'africa/monrovia', + AfricaNairobi = 'africa/nairobi', + AfricaNdjamena = 'africa/ndjamena', + AfricaNiamey = 'africa/niamey', + AfricaNouakchott = 'africa/nouakchott', + AfricaOuagadougou = 'africa/ouagadougou', + AfricaPortonovo = 'africa/porto-novo', + AfricaSaoTome = 'africa/sao_tome', + AfricaTripoli = 'africa/tripoli', + AfricaTunis = 'africa/tunis', + AfricaWindhoek = 'africa/windhoek', + AmericaAdak = 'america/adak', + AmericaAnchorage = 'america/anchorage', + AmericaAnguilla = 'america/anguilla', + AmericaAntigua = 'america/antigua', + AmericaAraguaina = 'america/araguaina', + AmericaArgentinaBuenosAires = 'america/argentina/buenos_aires', + AmericaArgentinaCatamarca = 'america/argentina/catamarca', + AmericaArgentinaCordoba = 'america/argentina/cordoba', + AmericaArgentinaJujuy = 'america/argentina/jujuy', + AmericaArgentinaLaRioja = 'america/argentina/la_rioja', + AmericaArgentinaMendoza = 'america/argentina/mendoza', + AmericaArgentinaRioGallegos = 'america/argentina/rio_gallegos', + AmericaArgentinaSalta = 'america/argentina/salta', + AmericaArgentinaSanJuan = 'america/argentina/san_juan', + AmericaArgentinaSanLuis = 'america/argentina/san_luis', + AmericaArgentinaTucuman = 'america/argentina/tucuman', + AmericaArgentinaUshuaia = 'america/argentina/ushuaia', + AmericaAruba = 'america/aruba', + AmericaAsuncion = 'america/asuncion', + AmericaAtikokan = 'america/atikokan', + AmericaBahia = 'america/bahia', + AmericaBahiaBanderas = 'america/bahia_banderas', + AmericaBarbados = 'america/barbados', + AmericaBelem = 'america/belem', + AmericaBelize = 'america/belize', + AmericaBlancsablon = 'america/blanc-sablon', + AmericaBoaVista = 'america/boa_vista', + AmericaBogota = 'america/bogota', + AmericaBoise = 'america/boise', + AmericaCambridgeBay = 'america/cambridge_bay', + AmericaCampoGrande = 'america/campo_grande', + AmericaCancun = 'america/cancun', + AmericaCaracas = 'america/caracas', + AmericaCayenne = 'america/cayenne', + AmericaCayman = 'america/cayman', + AmericaChicago = 'america/chicago', + AmericaChihuahua = 'america/chihuahua', + AmericaCiudadJuarez = 'america/ciudad_juarez', + AmericaCostaRica = 'america/costa_rica', + AmericaCoyhaique = 'america/coyhaique', + AmericaCreston = 'america/creston', + AmericaCuiaba = 'america/cuiaba', + AmericaCuracao = 'america/curacao', + AmericaDanmarkshavn = 'america/danmarkshavn', + AmericaDawson = 'america/dawson', + AmericaDawsonCreek = 'america/dawson_creek', + AmericaDenver = 'america/denver', + AmericaDetroit = 'america/detroit', + AmericaDominica = 'america/dominica', + AmericaEdmonton = 'america/edmonton', + AmericaEirunepe = 'america/eirunepe', + AmericaElSalvador = 'america/el_salvador', + AmericaFortNelson = 'america/fort_nelson', + AmericaFortaleza = 'america/fortaleza', + AmericaGlaceBay = 'america/glace_bay', + AmericaGooseBay = 'america/goose_bay', + AmericaGrandTurk = 'america/grand_turk', + AmericaGrenada = 'america/grenada', + AmericaGuadeloupe = 'america/guadeloupe', + AmericaGuatemala = 'america/guatemala', + AmericaGuayaquil = 'america/guayaquil', + AmericaGuyana = 'america/guyana', + AmericaHalifax = 'america/halifax', + AmericaHavana = 'america/havana', + AmericaHermosillo = 'america/hermosillo', + AmericaIndianaIndianapolis = 'america/indiana/indianapolis', + AmericaIndianaKnox = 'america/indiana/knox', + AmericaIndianaMarengo = 'america/indiana/marengo', + AmericaIndianaPetersburg = 'america/indiana/petersburg', + AmericaIndianaTellCity = 'america/indiana/tell_city', + AmericaIndianaVevay = 'america/indiana/vevay', + AmericaIndianaVincennes = 'america/indiana/vincennes', + AmericaIndianaWinamac = 'america/indiana/winamac', + AmericaInuvik = 'america/inuvik', + AmericaIqaluit = 'america/iqaluit', + AmericaJamaica = 'america/jamaica', + AmericaJuneau = 'america/juneau', + AmericaKentuckyLouisville = 'america/kentucky/louisville', + AmericaKentuckyMonticello = 'america/kentucky/monticello', + AmericaKralendijk = 'america/kralendijk', + AmericaLaPaz = 'america/la_paz', + AmericaLima = 'america/lima', + AmericaLosAngeles = 'america/los_angeles', + AmericaLowerPrinces = 'america/lower_princes', + AmericaMaceio = 'america/maceio', + AmericaManagua = 'america/managua', + AmericaManaus = 'america/manaus', + AmericaMarigot = 'america/marigot', + AmericaMartinique = 'america/martinique', + AmericaMatamoros = 'america/matamoros', + AmericaMazatlan = 'america/mazatlan', + AmericaMenominee = 'america/menominee', + AmericaMerida = 'america/merida', + AmericaMetlakatla = 'america/metlakatla', + AmericaMexicoCity = 'america/mexico_city', + AmericaMiquelon = 'america/miquelon', + AmericaMoncton = 'america/moncton', + AmericaMonterrey = 'america/monterrey', + AmericaMontevideo = 'america/montevideo', + AmericaMontserrat = 'america/montserrat', + AmericaNassau = 'america/nassau', + AmericaNewYork = 'america/new_york', + AmericaNome = 'america/nome', + AmericaNoronha = 'america/noronha', + AmericaNorthDakotaBeulah = 'america/north_dakota/beulah', + AmericaNorthDakotaCenter = 'america/north_dakota/center', + AmericaNorthDakotaNewSalem = 'america/north_dakota/new_salem', + AmericaNuuk = 'america/nuuk', + AmericaOjinaga = 'america/ojinaga', + AmericaPanama = 'america/panama', + AmericaParamaribo = 'america/paramaribo', + AmericaPhoenix = 'america/phoenix', + AmericaPortauprince = 'america/port-au-prince', + AmericaPortOfSpain = 'america/port_of_spain', + AmericaPortoVelho = 'america/porto_velho', + AmericaPuertoRico = 'america/puerto_rico', + AmericaPuntaArenas = 'america/punta_arenas', + AmericaRankinInlet = 'america/rankin_inlet', + AmericaRecife = 'america/recife', + AmericaRegina = 'america/regina', + AmericaResolute = 'america/resolute', + AmericaRioBranco = 'america/rio_branco', + AmericaSantarem = 'america/santarem', + AmericaSantiago = 'america/santiago', + AmericaSantoDomingo = 'america/santo_domingo', + AmericaSaoPaulo = 'america/sao_paulo', + AmericaScoresbysund = 'america/scoresbysund', + AmericaSitka = 'america/sitka', + AmericaStBarthelemy = 'america/st_barthelemy', + AmericaStJohns = 'america/st_johns', + AmericaStKitts = 'america/st_kitts', + AmericaStLucia = 'america/st_lucia', + AmericaStThomas = 'america/st_thomas', + AmericaStVincent = 'america/st_vincent', + AmericaSwiftCurrent = 'america/swift_current', + AmericaTegucigalpa = 'america/tegucigalpa', + AmericaThule = 'america/thule', + AmericaTijuana = 'america/tijuana', + AmericaToronto = 'america/toronto', + AmericaTortola = 'america/tortola', + AmericaVancouver = 'america/vancouver', + AmericaWhitehorse = 'america/whitehorse', + AmericaWinnipeg = 'america/winnipeg', + AmericaYakutat = 'america/yakutat', + AntarcticaCasey = 'antarctica/casey', + AntarcticaDavis = 'antarctica/davis', + AntarcticaDumontdurville = 'antarctica/dumontdurville', + AntarcticaMacquarie = 'antarctica/macquarie', + AntarcticaMawson = 'antarctica/mawson', + AntarcticaMcmurdo = 'antarctica/mcmurdo', + AntarcticaPalmer = 'antarctica/palmer', + AntarcticaRothera = 'antarctica/rothera', + AntarcticaSyowa = 'antarctica/syowa', + AntarcticaTroll = 'antarctica/troll', + AntarcticaVostok = 'antarctica/vostok', + ArcticLongyearbyen = 'arctic/longyearbyen', + AsiaAden = 'asia/aden', + AsiaAlmaty = 'asia/almaty', + AsiaAmman = 'asia/amman', + AsiaAnadyr = 'asia/anadyr', + AsiaAqtau = 'asia/aqtau', + AsiaAqtobe = 'asia/aqtobe', + AsiaAshgabat = 'asia/ashgabat', + AsiaAtyrau = 'asia/atyrau', + AsiaBaghdad = 'asia/baghdad', + AsiaBahrain = 'asia/bahrain', + AsiaBaku = 'asia/baku', + AsiaBangkok = 'asia/bangkok', + AsiaBarnaul = 'asia/barnaul', + AsiaBeirut = 'asia/beirut', + AsiaBishkek = 'asia/bishkek', + AsiaBrunei = 'asia/brunei', + AsiaChita = 'asia/chita', + AsiaColombo = 'asia/colombo', + AsiaDamascus = 'asia/damascus', + AsiaDhaka = 'asia/dhaka', + AsiaDili = 'asia/dili', + AsiaDubai = 'asia/dubai', + AsiaDushanbe = 'asia/dushanbe', + AsiaFamagusta = 'asia/famagusta', + AsiaGaza = 'asia/gaza', + AsiaHebron = 'asia/hebron', + AsiaHoChiMinh = 'asia/ho_chi_minh', + AsiaHongKong = 'asia/hong_kong', + AsiaHovd = 'asia/hovd', + AsiaIrkutsk = 'asia/irkutsk', + AsiaJakarta = 'asia/jakarta', + AsiaJayapura = 'asia/jayapura', + AsiaJerusalem = 'asia/jerusalem', + AsiaKabul = 'asia/kabul', + AsiaKamchatka = 'asia/kamchatka', + AsiaKarachi = 'asia/karachi', + AsiaKathmandu = 'asia/kathmandu', + AsiaKhandyga = 'asia/khandyga', + AsiaKolkata = 'asia/kolkata', + AsiaKrasnoyarsk = 'asia/krasnoyarsk', + AsiaKualaLumpur = 'asia/kuala_lumpur', + AsiaKuching = 'asia/kuching', + AsiaKuwait = 'asia/kuwait', + AsiaMacau = 'asia/macau', + AsiaMagadan = 'asia/magadan', + AsiaMakassar = 'asia/makassar', + AsiaManila = 'asia/manila', + AsiaMuscat = 'asia/muscat', + AsiaNicosia = 'asia/nicosia', + AsiaNovokuznetsk = 'asia/novokuznetsk', + AsiaNovosibirsk = 'asia/novosibirsk', + AsiaOmsk = 'asia/omsk', + AsiaOral = 'asia/oral', + AsiaPhnomPenh = 'asia/phnom_penh', + AsiaPontianak = 'asia/pontianak', + AsiaPyongyang = 'asia/pyongyang', + AsiaQatar = 'asia/qatar', + AsiaQostanay = 'asia/qostanay', + AsiaQyzylorda = 'asia/qyzylorda', + AsiaRiyadh = 'asia/riyadh', + AsiaSakhalin = 'asia/sakhalin', + AsiaSamarkand = 'asia/samarkand', + AsiaSeoul = 'asia/seoul', + AsiaShanghai = 'asia/shanghai', + AsiaSingapore = 'asia/singapore', + AsiaSrednekolymsk = 'asia/srednekolymsk', + AsiaTaipei = 'asia/taipei', + AsiaTashkent = 'asia/tashkent', + AsiaTbilisi = 'asia/tbilisi', + AsiaTehran = 'asia/tehran', + AsiaThimphu = 'asia/thimphu', + AsiaTokyo = 'asia/tokyo', + AsiaTomsk = 'asia/tomsk', + AsiaUlaanbaatar = 'asia/ulaanbaatar', + AsiaUrumqi = 'asia/urumqi', + AsiaUstnera = 'asia/ust-nera', + AsiaVientiane = 'asia/vientiane', + AsiaVladivostok = 'asia/vladivostok', + AsiaYakutsk = 'asia/yakutsk', + AsiaYangon = 'asia/yangon', + AsiaYekaterinburg = 'asia/yekaterinburg', + AsiaYerevan = 'asia/yerevan', + AtlanticAzores = 'atlantic/azores', + AtlanticBermuda = 'atlantic/bermuda', + AtlanticCanary = 'atlantic/canary', + AtlanticCapeVerde = 'atlantic/cape_verde', + AtlanticFaroe = 'atlantic/faroe', + AtlanticMadeira = 'atlantic/madeira', + AtlanticReykjavik = 'atlantic/reykjavik', + AtlanticSouthGeorgia = 'atlantic/south_georgia', + AtlanticStHelena = 'atlantic/st_helena', + AtlanticStanley = 'atlantic/stanley', + AustraliaAdelaide = 'australia/adelaide', + AustraliaBrisbane = 'australia/brisbane', + AustraliaBrokenHill = 'australia/broken_hill', + AustraliaDarwin = 'australia/darwin', + AustraliaEucla = 'australia/eucla', + AustraliaHobart = 'australia/hobart', + AustraliaLindeman = 'australia/lindeman', + AustraliaLordHowe = 'australia/lord_howe', + AustraliaMelbourne = 'australia/melbourne', + AustraliaPerth = 'australia/perth', + AustraliaSydney = 'australia/sydney', + EuropeAmsterdam = 'europe/amsterdam', + EuropeAndorra = 'europe/andorra', + EuropeAstrakhan = 'europe/astrakhan', + EuropeAthens = 'europe/athens', + EuropeBelgrade = 'europe/belgrade', + EuropeBerlin = 'europe/berlin', + EuropeBratislava = 'europe/bratislava', + EuropeBrussels = 'europe/brussels', + EuropeBucharest = 'europe/bucharest', + EuropeBudapest = 'europe/budapest', + EuropeBusingen = 'europe/busingen', + EuropeChisinau = 'europe/chisinau', + EuropeCopenhagen = 'europe/copenhagen', + EuropeDublin = 'europe/dublin', + EuropeGibraltar = 'europe/gibraltar', + EuropeGuernsey = 'europe/guernsey', + EuropeHelsinki = 'europe/helsinki', + EuropeIsleOfMan = 'europe/isle_of_man', + EuropeIstanbul = 'europe/istanbul', + EuropeJersey = 'europe/jersey', + EuropeKaliningrad = 'europe/kaliningrad', + EuropeKirov = 'europe/kirov', + EuropeKyiv = 'europe/kyiv', + EuropeLisbon = 'europe/lisbon', + EuropeLjubljana = 'europe/ljubljana', + EuropeLondon = 'europe/london', + EuropeLuxembourg = 'europe/luxembourg', + EuropeMadrid = 'europe/madrid', + EuropeMalta = 'europe/malta', + EuropeMariehamn = 'europe/mariehamn', + EuropeMinsk = 'europe/minsk', + EuropeMonaco = 'europe/monaco', + EuropeMoscow = 'europe/moscow', + EuropeOslo = 'europe/oslo', + EuropeParis = 'europe/paris', + EuropePodgorica = 'europe/podgorica', + EuropePrague = 'europe/prague', + EuropeRiga = 'europe/riga', + EuropeRome = 'europe/rome', + EuropeSamara = 'europe/samara', + EuropeSanMarino = 'europe/san_marino', + EuropeSarajevo = 'europe/sarajevo', + EuropeSaratov = 'europe/saratov', + EuropeSimferopol = 'europe/simferopol', + EuropeSkopje = 'europe/skopje', + EuropeSofia = 'europe/sofia', + EuropeStockholm = 'europe/stockholm', + EuropeTallinn = 'europe/tallinn', + EuropeTirane = 'europe/tirane', + EuropeUlyanovsk = 'europe/ulyanovsk', + EuropeVaduz = 'europe/vaduz', + EuropeVatican = 'europe/vatican', + EuropeVienna = 'europe/vienna', + EuropeVilnius = 'europe/vilnius', + EuropeVolgograd = 'europe/volgograd', + EuropeWarsaw = 'europe/warsaw', + EuropeZagreb = 'europe/zagreb', + EuropeZurich = 'europe/zurich', + IndianAntananarivo = 'indian/antananarivo', + IndianChagos = 'indian/chagos', + IndianChristmas = 'indian/christmas', + IndianCocos = 'indian/cocos', + IndianComoro = 'indian/comoro', + IndianKerguelen = 'indian/kerguelen', + IndianMahe = 'indian/mahe', + IndianMaldives = 'indian/maldives', + IndianMauritius = 'indian/mauritius', + IndianMayotte = 'indian/mayotte', + IndianReunion = 'indian/reunion', + PacificApia = 'pacific/apia', + PacificAuckland = 'pacific/auckland', + PacificBougainville = 'pacific/bougainville', + PacificChatham = 'pacific/chatham', + PacificChuuk = 'pacific/chuuk', + PacificEaster = 'pacific/easter', + PacificEfate = 'pacific/efate', + PacificFakaofo = 'pacific/fakaofo', + PacificFiji = 'pacific/fiji', + PacificFunafuti = 'pacific/funafuti', + PacificGalapagos = 'pacific/galapagos', + PacificGambier = 'pacific/gambier', + PacificGuadalcanal = 'pacific/guadalcanal', + PacificGuam = 'pacific/guam', + PacificHonolulu = 'pacific/honolulu', + PacificKanton = 'pacific/kanton', + PacificKiritimati = 'pacific/kiritimati', + PacificKosrae = 'pacific/kosrae', + PacificKwajalein = 'pacific/kwajalein', + PacificMajuro = 'pacific/majuro', + PacificMarquesas = 'pacific/marquesas', + PacificMidway = 'pacific/midway', + PacificNauru = 'pacific/nauru', + PacificNiue = 'pacific/niue', + PacificNorfolk = 'pacific/norfolk', + PacificNoumea = 'pacific/noumea', + PacificPagoPago = 'pacific/pago_pago', + PacificPalau = 'pacific/palau', + PacificPitcairn = 'pacific/pitcairn', + PacificPohnpei = 'pacific/pohnpei', + PacificPortMoresby = 'pacific/port_moresby', + PacificRarotonga = 'pacific/rarotonga', + PacificSaipan = 'pacific/saipan', + PacificTahiti = 'pacific/tahiti', + PacificTarawa = 'pacific/tarawa', + PacificTongatapu = 'pacific/tongatapu', + PacificWake = 'pacific/wake', + PacificWallis = 'pacific/wallis', + Utc = 'utc', +} \ No newline at end of file diff --git a/src/enums/vcs-reference-type.ts b/src/enums/vcs-reference-type.ts new file mode 100644 index 00000000..cb5270f5 --- /dev/null +++ b/src/enums/vcs-reference-type.ts @@ -0,0 +1,5 @@ +export enum VCSReferenceType { + Branch = 'branch', + Commit = 'commit', + Tag = 'tag', +} \ No newline at end of file diff --git a/src/id.ts b/src/id.ts new file mode 100644 index 00000000..33495cc8 --- /dev/null +++ b/src/id.ts @@ -0,0 +1,47 @@ +/** + * Helper class to generate ID strings for resources. + */ +export class ID { + /** + * Generate an hex ID based on timestamp. + * Recreated from https://www.php.net/manual/en/function.uniqid.php + * + * @returns {string} + */ + static #hexTimestamp(): string { + const now = new Date(); + const sec = Math.floor(now.getTime() / 1000); + const msec = now.getMilliseconds(); + + // Convert to hexadecimal + const hexTimestamp = sec.toString(16) + msec.toString(16).padStart(5, '0'); + return hexTimestamp; + } + + /** + * Uses the provided ID as the ID for the resource. + * + * @param {string} id + * @returns {string} + */ + public static custom(id: string): string { + return id + } + + /** + * Have Appwrite generate a unique ID for you. + * + * @param {number} padding. Default is 7. + * @returns {string} + */ + public static unique(padding: number = 7): string { + // Generate a unique ID with padding to have a longer ID + const baseId = ID.#hexTimestamp(); + let randomPadding = ''; + for (let i = 0; i < padding; i++) { + const randomHexDigit = Math.floor(Math.random() * 16).toString(16); + randomPadding += randomHexDigit; + } + return baseId + randomPadding; + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..1932e75b --- /dev/null +++ b/src/index.ts @@ -0,0 +1,87 @@ +export { Client, Query, AppwriteException } from './client'; +export { Account } from './services/account'; +export { Activities } from './services/activities'; +export { Avatars } from './services/avatars'; +export { Backups } from './services/backups'; +export { Databases } from './services/databases'; +export { Functions } from './services/functions'; +export { Graphql } from './services/graphql'; +export { Health } from './services/health'; +export { Locale } from './services/locale'; +export { Messaging } from './services/messaging'; +export { Presences } from './services/presences'; +export { Project } from './services/project'; +export { Proxy } from './services/proxy'; +export { Advisor } from './services/advisor'; +export { Sites } from './services/sites'; +export { Storage } from './services/storage'; +export { TablesDB } from './services/tables-db'; +export { Teams } from './services/teams'; +export { Tokens } from './services/tokens'; +export { Usage } from './services/usage'; +export { Users } from './services/users'; +export { Webhooks } from './services/webhooks'; +export type { Models, Payload, UploadProgress } from './client'; +export type { QueryTypes, QueryTypesList } from './query'; +export { Permission } from './permission'; +export { Role } from './role'; +export { ID } from './id'; +export { Operator, Condition } from './operator'; +export { AuthenticatorType } from './enums/authenticator-type'; +export { AuthenticationFactor } from './enums/authentication-factor'; +export { OAuthProvider } from './enums/o-auth-provider'; +export { Browser } from './enums/browser'; +export { CreditCard } from './enums/credit-card'; +export { Flag } from './enums/flag'; +export { Theme } from './enums/theme'; +export { Timezone } from './enums/timezone'; +export { BrowserPermission } from './enums/browser-permission'; +export { ImageFormat } from './enums/image-format'; +export { BackupServices } from './enums/backup-services'; +export { RelationshipType } from './enums/relationship-type'; +export { RelationMutate } from './enums/relation-mutate'; +export { DatabasesIndexType } from './enums/databases-index-type'; +export { OrderBy } from './enums/order-by'; +export { Runtime } from './enums/runtime'; +export { Scopes } from './enums/scopes'; +export { TemplateReferenceType } from './enums/template-reference-type'; +export { VCSReferenceType } from './enums/vcs-reference-type'; +export { DeploymentDownloadType } from './enums/deployment-download-type'; +export { ExecutionMethod } from './enums/execution-method'; +export { Name } from './enums/name'; +export { MessagePriority } from './enums/message-priority'; +export { SmtpEncryption } from './enums/smtp-encryption'; +export { ProjectAuthMethodId } from './enums/project-auth-method-id'; +export { ProjectKeyScopes } from './enums/project-key-scopes'; +export { ProjectOAuth2GooglePrompt } from './enums/project-o-auth-2-google-prompt'; +export { ProjectOAuthProviderId } from './enums/project-o-auth-provider-id'; +export { ProjectPolicyId } from './enums/project-policy-id'; +export { ProjectProtocolId } from './enums/project-protocol-id'; +export { ProjectServiceId } from './enums/project-service-id'; +export { ProjectSMTPSecure } from './enums/project-smtp-secure'; +export { ProjectEmailTemplateId } from './enums/project-email-template-id'; +export { ProjectEmailTemplateLocale } from './enums/project-email-template-locale'; +export { StatusCode } from './enums/status-code'; +export { ProxyResourceType } from './enums/proxy-resource-type'; +export { Framework } from './enums/framework'; +export { BuildRuntime } from './enums/build-runtime'; +export { Adapter } from './enums/adapter'; +export { Compression } from './enums/compression'; +export { ImageGravity } from './enums/image-gravity'; +export { TablesDBIndexType } from './enums/tables-db-index-type'; +export { PasswordHash } from './enums/password-hash'; +export { MessagingProviderType } from './enums/messaging-provider-type'; +export { DatabaseType } from './enums/database-type'; +export { AttributeStatus } from './enums/attribute-status'; +export { ColumnStatus } from './enums/column-status'; +export { IndexStatus } from './enums/index-status'; +export { DeploymentStatus } from './enums/deployment-status'; +export { ExecutionTrigger } from './enums/execution-trigger'; +export { ExecutionStatus } from './enums/execution-status'; +export { OAuth2GooglePrompt } from './enums/o-auth-2-google-prompt'; +export { PlatformType } from './enums/platform-type'; +export { HealthAntivirusStatus } from './enums/health-antivirus-status'; +export { HealthCheckStatus } from './enums/health-check-status'; +export { ProxyRuleDeploymentResourceType } from './enums/proxy-rule-deployment-resource-type'; +export { ProxyRuleStatus } from './enums/proxy-rule-status'; +export { MessageStatus } from './enums/message-status'; diff --git a/src/inputFile.ts b/src/inputFile.ts new file mode 100644 index 00000000..94afbe23 --- /dev/null +++ b/src/inputFile.ts @@ -0,0 +1,144 @@ +import { File } from "node-fetch-native-with-agent"; + +type FsPromises = { + stat: (path: string) => Promise<{ size: number }>; + open: (path: string, flags: string) => Promise<{ + read: (buffer: Uint8Array, offset: number, length: number, position: number) => Promise<{ bytesRead: number }>; + close: () => Promise<void>; + }>; + readFile: (path: string) => Promise<Uint8Array>; +}; + +function isEdgeRuntime(): boolean { + return typeof globalThis !== 'undefined' && typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime !== 'undefined'; +} + +function assertFileSystemAvailable(): void { + if (isEdgeRuntime()) { + throw new Error('File system operations are not supported in edge runtimes. Please use InputFile.fromBuffer instead.'); + } +} + +async function getFs(): Promise<FsPromises> { + assertFileSystemAvailable(); + + try { + const fs = await import('fs'); + return fs.promises; + } catch { + throw new Error('File system operations are not available in this runtime. Please use InputFile.fromBuffer instead.'); + } +} + +function getFilename(path: string): string { + const segments = path.replace(/\\/g, '/').split('/').filter(Boolean); + return segments.pop() ?? 'file'; +} + +type BlobLike = { + size: number; + slice: (start: number, end: number) => BlobLike; + arrayBuffer: () => Promise<ArrayBuffer>; +}; + +type InputFileSource = + | { type: 'path'; path: string } + | { type: 'buffer'; data: Uint8Array } + | { type: 'blob'; data: BlobLike }; + +export class InputFile { + private source: InputFileSource; + filename: string; + + private constructor(source: InputFileSource, filename: string) { + this.source = source; + this.filename = filename; + } + + static fromBuffer(parts: BlobLike | Uint8Array | ArrayBuffer | string, name: string): InputFile { + if (parts && !ArrayBuffer.isView(parts) && typeof (parts as BlobLike).arrayBuffer === 'function') { + return new InputFile({ type: 'blob', data: parts as BlobLike }, name); + } + + if (typeof parts === 'string') { + return new InputFile({ type: 'buffer', data: new TextEncoder().encode(parts) }, name); + } + + if (parts instanceof ArrayBuffer) { + return new InputFile({ type: 'buffer', data: new Uint8Array(parts) }, name); + } + + if (ArrayBuffer.isView(parts)) { + return new InputFile({ + type: 'buffer', + data: new Uint8Array(parts.buffer, parts.byteOffset, parts.byteLength), + }, name); + } + + throw new Error('Unsupported input type for InputFile.fromBuffer'); + } + + static fromPath(path: string, name?: string): InputFile { + assertFileSystemAvailable(); + return new InputFile({ type: 'path', path }, name ?? getFilename(path)); + } + + static fromPlainText(content: string, name: string): InputFile { + return new InputFile({ type: 'buffer', data: new TextEncoder().encode(content) }, name); + } + + async size(): Promise<number> { + switch (this.source.type) { + case 'path': { + const fs = await getFs(); + return (await fs.stat(this.source.path)).size; + } + case 'buffer': + return this.source.data.length; + case 'blob': + return this.source.data.size; + } + } + + async slice(start: number, end: number): Promise<Uint8Array> { + const length = end - start; + + switch (this.source.type) { + case 'path': { + const fs = await getFs(); + const handle = await fs.open(this.source.path, 'r'); + try { + const buffer = new Uint8Array(length); + const result = await handle.read(buffer, 0, length, start); + return result.bytesRead === buffer.length ? buffer : buffer.subarray(0, result.bytesRead); + } finally { + await handle.close(); + } + } + case 'buffer': + return this.source.data.subarray(start, end); + case 'blob': { + const arrayBuffer = await this.source.data.slice(start, end).arrayBuffer(); + return new Uint8Array(arrayBuffer); + } + } + } + + async toFile(): Promise<File> { + const data = await this.toUint8Array(); + return new File([data], this.filename); + } + + private async toUint8Array(): Promise<Uint8Array> { + switch (this.source.type) { + case 'path': { + const fs = await getFs(); + return await fs.readFile(this.source.path); + } + case 'buffer': + return this.source.data; + case 'blob': + return new Uint8Array(await this.source.data.arrayBuffer()); + } + } +} diff --git a/src/models.ts b/src/models.ts new file mode 100644 index 00000000..de934950 --- /dev/null +++ b/src/models.ts @@ -0,0 +1,7091 @@ +import { DatabaseType } from "./enums/database-type" +import { AttributeStatus } from "./enums/attribute-status" +import { ColumnStatus } from "./enums/column-status" +import { IndexStatus } from "./enums/index-status" +import { DeploymentStatus } from "./enums/deployment-status" +import { ExecutionTrigger } from "./enums/execution-trigger" +import { ExecutionStatus } from "./enums/execution-status" +import { ProjectAuthMethodId } from "./enums/project-auth-method-id" +import { ProjectServiceId } from "./enums/project-service-id" +import { ProjectProtocolId } from "./enums/project-protocol-id" +import { OAuth2GooglePrompt } from "./enums/o-auth-2-google-prompt" +import { PlatformType } from "./enums/platform-type" +import { HealthAntivirusStatus } from "./enums/health-antivirus-status" +import { HealthCheckStatus } from "./enums/health-check-status" +import { ProxyRuleDeploymentResourceType } from "./enums/proxy-rule-deployment-resource-type" +import { ProxyRuleStatus } from "./enums/proxy-rule-status" +import { MessageStatus } from "./enums/message-status" + +/** + * Appwrite Models + */ +export namespace Models { + + declare const __default: unique symbol; + + /** + * Rows List + */ + export type RowList<Row extends Models.Row = Models.DefaultRow> = { + /** + * Total number of rows that matched your query. + */ + total: number; + /** + * List of rows. + */ + rows: Row[]; + } + + /** + * Documents List + */ + export type DocumentList<Document extends Models.Document = Models.DefaultDocument> = { + /** + * Total number of documents that matched your query. + */ + total: number; + /** + * List of documents. + */ + documents: Document[]; + } + + /** + * Presences List + */ + export type PresenceList<Presence extends Models.Presence = Models.DefaultPresence> = { + /** + * Total number of presences that matched your query. + */ + total: number; + /** + * List of presences. + */ + presences: Presence[]; + } + + /** + * Tables List + */ + export type TableList = { + /** + * Total number of tables that matched your query. + */ + total: number; + /** + * List of tables. + */ + tables: Table[]; + } + + /** + * Collections List + */ + export type CollectionList = { + /** + * Total number of collections that matched your query. + */ + total: number; + /** + * List of collections. + */ + collections: Collection[]; + } + + /** + * Databases List + */ + export type DatabaseList = { + /** + * Total number of databases that matched your query. + */ + total: number; + /** + * List of databases. + */ + databases: Database[]; + } + + /** + * Indexes List + */ + export type IndexList = { + /** + * Total number of indexes that matched your query. + */ + total: number; + /** + * List of indexes. + */ + indexes: Index[]; + } + + /** + * Column Indexes List + */ + export type ColumnIndexList = { + /** + * Total number of indexes that matched your query. + */ + total: number; + /** + * List of indexes. + */ + indexes: ColumnIndex[]; + } + + /** + * Users List + */ + export type UserList<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + /** + * Total number of users that matched your query. + */ + total: number; + /** + * List of users. + */ + users: User<Preferences>[]; + } + + /** + * Sessions List + */ + export type SessionList = { + /** + * Total number of sessions that matched your query. + */ + total: number; + /** + * List of sessions. + */ + sessions: Session[]; + } + + /** + * Identities List + */ + export type IdentityList = { + /** + * Total number of identities that matched your query. + */ + total: number; + /** + * List of identities. + */ + identities: Identity[]; + } + + /** + * Logs List + */ + export type LogList = { + /** + * Total number of logs that matched your query. + */ + total: number; + /** + * List of logs. + */ + logs: Log[]; + } + + /** + * Files List + */ + export type FileList = { + /** + * Total number of files that matched your query. + */ + total: number; + /** + * List of files. + */ + files: File[]; + } + + /** + * Buckets List + */ + export type BucketList = { + /** + * Total number of buckets that matched your query. + */ + total: number; + /** + * List of buckets. + */ + buckets: Bucket[]; + } + + /** + * Resource Tokens List + */ + export type ResourceTokenList = { + /** + * Total number of tokens that matched your query. + */ + total: number; + /** + * List of tokens. + */ + tokens: ResourceToken[]; + } + + /** + * Teams List + */ + export type TeamList<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + /** + * Total number of teams that matched your query. + */ + total: number; + /** + * List of teams. + */ + teams: Team<Preferences>[]; + } + + /** + * Memberships List + */ + export type MembershipList = { + /** + * Total number of memberships that matched your query. + */ + total: number; + /** + * List of memberships. + */ + memberships: Membership[]; + } + + /** + * Sites List + */ + export type SiteList = { + /** + * Total number of sites that matched your query. + */ + total: number; + /** + * List of sites. + */ + sites: Site[]; + } + + /** + * Functions List + */ + export type FunctionList = { + /** + * Total number of functions that matched your query. + */ + total: number; + /** + * List of functions. + */ + functions: Function[]; + } + + /** + * Frameworks List + */ + export type FrameworkList = { + /** + * Total number of frameworks that matched your query. + */ + total: number; + /** + * List of frameworks. + */ + frameworks: Framework[]; + } + + /** + * Runtimes List + */ + export type RuntimeList = { + /** + * Total number of runtimes that matched your query. + */ + total: number; + /** + * List of runtimes. + */ + runtimes: Runtime[]; + } + + /** + * Deployments List + */ + export type DeploymentList = { + /** + * Total number of deployments that matched your query. + */ + total: number; + /** + * List of deployments. + */ + deployments: Deployment[]; + } + + /** + * Executions List + */ + export type ExecutionList = { + /** + * Total number of executions that matched your query. + */ + total: number; + /** + * List of executions. + */ + executions: Execution[]; + } + + /** + * Webhooks List + */ + export type WebhookList = { + /** + * Total number of webhooks that matched your query. + */ + total: number; + /** + * List of webhooks. + */ + webhooks: Webhook[]; + } + + /** + * API Keys List + */ + export type KeyList = { + /** + * Total number of keys that matched your query. + */ + total: number; + /** + * List of keys. + */ + keys: Key[]; + } + + /** + * Countries List + */ + export type CountryList = { + /** + * Total number of countries that matched your query. + */ + total: number; + /** + * List of countries. + */ + countries: Country[]; + } + + /** + * Continents List + */ + export type ContinentList = { + /** + * Total number of continents that matched your query. + */ + total: number; + /** + * List of continents. + */ + continents: Continent[]; + } + + /** + * Languages List + */ + export type LanguageList = { + /** + * Total number of languages that matched your query. + */ + total: number; + /** + * List of languages. + */ + languages: Language[]; + } + + /** + * Currencies List + */ + export type CurrencyList = { + /** + * Total number of currencies that matched your query. + */ + total: number; + /** + * List of currencies. + */ + currencies: Currency[]; + } + + /** + * Phones List + */ + export type PhoneList = { + /** + * Total number of phones that matched your query. + */ + total: number; + /** + * List of phones. + */ + phones: Phone[]; + } + + /** + * Variables List + */ + export type VariableList = { + /** + * Total number of variables that matched your query. + */ + total: number; + /** + * List of variables. + */ + variables: Variable[]; + } + + /** + * Mock Numbers List + */ + export type MockNumberList = { + /** + * Total number of mockNumbers that matched your query. + */ + total: number; + /** + * List of mockNumbers. + */ + mockNumbers: MockNumber[]; + } + + /** + * Policies List + */ + export type PolicyList = { + /** + * Total number of policies in the given project. + */ + total: number; + /** + * List of policies. + */ + policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy)[]; + } + + /** + * Email Templates List + */ + export type EmailTemplateList = { + /** + * Total number of templates that matched your query. + */ + total: number; + /** + * List of templates. + */ + templates: EmailTemplate[]; + } + + /** + * Status List + */ + export type HealthStatusList = { + /** + * Total number of statuses that matched your query. + */ + total: number; + /** + * List of statuses. + */ + statuses: HealthStatus[]; + } + + /** + * Rule List + */ + export type ProxyRuleList = { + /** + * Total number of rules that matched your query. + */ + total: number; + /** + * List of rules. + */ + rules: ProxyRule[]; + } + + /** + * Locale codes list + */ + export type LocaleCodeList = { + /** + * Total number of localeCodes that matched your query. + */ + total: number; + /** + * List of localeCodes. + */ + localeCodes: LocaleCode[]; + } + + /** + * Provider list + */ + export type ProviderList = { + /** + * Total number of providers that matched your query. + */ + total: number; + /** + * List of providers. + */ + providers: Provider[]; + } + + /** + * Message list + */ + export type MessageList = { + /** + * Total number of messages that matched your query. + */ + total: number; + /** + * List of messages. + */ + messages: Message[]; + } + + /** + * Topic list + */ + export type TopicList = { + /** + * Total number of topics that matched your query. + */ + total: number; + /** + * List of topics. + */ + topics: Topic[]; + } + + /** + * Subscriber list + */ + export type SubscriberList = { + /** + * Total number of subscribers that matched your query. + */ + total: number; + /** + * List of subscribers. + */ + subscribers: Subscriber[]; + } + + /** + * Target list + */ + export type TargetList = { + /** + * Total number of targets that matched your query. + */ + total: number; + /** + * List of targets. + */ + targets: Target[]; + } + + /** + * Transaction List + */ + export type TransactionList = { + /** + * Total number of transactions that matched your query. + */ + total: number; + /** + * List of transactions. + */ + transactions: Transaction[]; + } + + /** + * Specifications List + */ + export type SpecificationList = { + /** + * Total number of specifications that matched your query. + */ + total: number; + /** + * List of specifications. + */ + specifications: Specification[]; + } + + /** + * Insights List + */ + export type InsightList = { + /** + * Total number of insights that matched your query. + */ + total: number; + /** + * List of insights. + */ + insights: Insight[]; + } + + /** + * Reports List + */ + export type ReportList = { + /** + * Total number of reports that matched your query. + */ + total: number; + /** + * List of reports. + */ + reports: Report[]; + } + + /** + * Database + */ + export type Database = { + /** + * Database ID. + */ + $id: string; + /** + * Database name. + */ + name: string; + /** + * Database creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Database update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * If database is enabled. Can be 'enabled' or 'disabled'. When disabled, the database is inaccessible to users, but remains accessible to Server SDKs using API keys. + */ + enabled: boolean; + /** + * Database type. + */ + type: DatabaseType; + /** + * Database backup policies. + */ + policies: BackupPolicy[]; + /** + * Database backup archives. + */ + archives: BackupArchive[]; + } + + /** + * Collection + */ + export type Collection = { + /** + * Collection ID. + */ + $id: string; + /** + * Collection creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Collection update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * Database ID. + */ + databaseId: string; + /** + * Collection name. + */ + name: string; + /** + * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. + */ + enabled: boolean; + /** + * Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + documentSecurity: boolean; + /** + * Collection attributes. + */ + attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; + /** + * Collection indexes. + */ + indexes: Index[]; + /** + * Maximum document size in bytes. Returns 0 when no limit applies. + */ + bytesMax: number; + /** + * Currently used document size in bytes based on defined attributes. + */ + bytesUsed: number; + } + + /** + * Attributes List + */ + export type AttributeList = { + /** + * Total number of attributes in the given collection. + */ + total: number; + /** + * List of attributes. + */ + attributes: (Models.AttributeBoolean | Models.AttributeBigint | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributePoint | Models.AttributeLine | Models.AttributePolygon | Models.AttributeVarchar | Models.AttributeText | Models.AttributeMediumtext | Models.AttributeLongtext | Models.AttributeString)[]; + } + + /** + * AttributeString + */ + export type AttributeString = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Attribute size. + */ + size: number; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * AttributeInteger + */ + export type AttributeInteger = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number | bigint; + /** + * Maximum value to enforce for new documents. + */ + max?: number | bigint; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: number; + } + + /** + * AttributeBigInt + */ + export type AttributeBigint = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number | bigint; + /** + * Maximum value to enforce for new documents. + */ + max?: number | bigint; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: number | bigint; + } + + /** + * AttributeFloat + */ + export type AttributeFloat = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number; + /** + * Maximum value to enforce for new documents. + */ + max?: number; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: number; + } + + /** + * AttributeBoolean + */ + export type AttributeBoolean = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: boolean; + } + + /** + * AttributeEmail + */ + export type AttributeEmail = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * AttributeEnum + */ + export type AttributeEnum = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Array of elements in enumerated type. + */ + elements: string[]; + /** + * String format. + */ + format: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * AttributeIP + */ + export type AttributeIp = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * AttributeURL + */ + export type AttributeUrl = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + } + + /** + * AttributeDatetime + */ + export type AttributeDatetime = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ISO 8601 format. + */ + format: string; + /** + * Default value for attribute when not provided. Only null is optional + */ + default?: string; + } + + /** + * AttributeRelationship + */ + export type AttributeRelationship = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The ID of the related collection. + */ + relatedCollection: string; + /** + * The type of the relationship. + */ + relationType: string; + /** + * Is the relationship two-way? + */ + twoWay: boolean; + /** + * The key of the two-way relationship. + */ + twoWayKey: string; + /** + * How deleting the parent document will propagate to child documents. + */ + onDelete: string; + /** + * Whether this is the parent or child side of the relationship + */ + side: string; + } + + /** + * AttributePoint + */ + export type AttributePoint = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: any[]; + } + + /** + * AttributeLine + */ + export type AttributeLine = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: any[]; + } + + /** + * AttributePolygon + */ + export type AttributePolygon = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: any[]; + } + + /** + * AttributeVarchar + */ + export type AttributeVarchar = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Attribute size. + */ + size: number; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * AttributeText + */ + export type AttributeText = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * AttributeMediumtext + */ + export type AttributeMediumtext = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * AttributeLongtext + */ + export type AttributeLongtext = { + /** + * Attribute Key. + */ + key: string; + /** + * Attribute type. + */ + type: string; + /** + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: AttributeStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an attribute. + */ + error: string; + /** + * Is attribute required? + */ + required: boolean; + /** + * Is attribute an array? + */ + array?: boolean; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: string; + /** + * Defines whether this attribute is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * Table + */ + export type Table = { + /** + * Table ID. + */ + $id: string; + /** + * Table creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Table update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Table permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * Database ID. + */ + databaseId: string; + /** + * Table name. + */ + name: string; + /** + * Table enabled. Can be 'enabled' or 'disabled'. When disabled, the table is inaccessible to users, but remains accessible to Server SDKs using API keys. + */ + enabled: boolean; + /** + * Whether row-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + rowSecurity: boolean; + /** + * Table columns. + */ + columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; + /** + * Table indexes. + */ + indexes: ColumnIndex[]; + /** + * Maximum row size in bytes. Returns 0 when no limit applies. + */ + bytesMax: number; + /** + * Currently used row size in bytes based on defined columns. + */ + bytesUsed: number; + } + + /** + * Columns List + */ + export type ColumnList = { + /** + * Total number of columns in the given table. + */ + total: number; + /** + * List of columns. + */ + columns: (Models.ColumnBoolean | Models.ColumnBigint | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnPoint | Models.ColumnLine | Models.ColumnPolygon | Models.ColumnVarchar | Models.ColumnText | Models.ColumnMediumtext | Models.ColumnLongtext | Models.ColumnString)[]; + } + + /** + * ColumnString + */ + export type ColumnString = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Column size. + */ + size: number; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnInteger + */ + export type ColumnInteger = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number | bigint; + /** + * Maximum value to enforce for new documents. + */ + max?: number | bigint; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: number; + } + + /** + * ColumnBigInt + */ + export type ColumnBigint = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number | bigint; + /** + * Maximum value to enforce for new documents. + */ + max?: number | bigint; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: number | bigint; + } + + /** + * ColumnFloat + */ + export type ColumnFloat = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Minimum value to enforce for new documents. + */ + min?: number; + /** + * Maximum value to enforce for new documents. + */ + max?: number; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: number; + } + + /** + * ColumnBoolean + */ + export type ColumnBoolean = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: boolean; + } + + /** + * ColumnEmail + */ + export type ColumnEmail = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnEnum + */ + export type ColumnEnum = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Array of elements in enumerated type. + */ + elements: string[]; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnIP + */ + export type ColumnIp = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnURL + */ + export type ColumnUrl = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * String format. + */ + format: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + } + + /** + * ColumnDatetime + */ + export type ColumnDatetime = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ISO 8601 format. + */ + format: string; + /** + * Default value for column when not provided. Only null is optional + */ + default?: string; + } + + /** + * ColumnRelationship + */ + export type ColumnRelationship = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The ID of the related table. + */ + relatedTable: string; + /** + * The type of the relationship. + */ + relationType: string; + /** + * Is the relationship two-way? + */ + twoWay: boolean; + /** + * The key of the two-way relationship. + */ + twoWayKey: string; + /** + * How deleting the parent document will propagate to child documents. + */ + onDelete: string; + /** + * Whether this is the parent or child side of the relationship + */ + side: string; + } + + /** + * ColumnPoint + */ + export type ColumnPoint = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: any[]; + } + + /** + * ColumnLine + */ + export type ColumnLine = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: any[]; + } + + /** + * ColumnPolygon + */ + export type ColumnPolygon = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: any[]; + } + + /** + * ColumnVarchar + */ + export type ColumnVarchar = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Column size. + */ + size: number; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnText + */ + export type ColumnText = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnMediumtext + */ + export type ColumnMediumtext = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * ColumnLongtext + */ + export type ColumnLongtext = { + /** + * Column Key. + */ + key: string; + /** + * Column type. + */ + type: string; + /** + * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: ColumnStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an column. + */ + error: string; + /** + * Is column required? + */ + required: boolean; + /** + * Is column an array? + */ + array?: boolean; + /** + * Column creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Column update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Default value for column when not provided. Cannot be set when column is required. + */ + default?: string; + /** + * Defines whether this column is encrypted or not. + */ + encrypt?: boolean; + } + + /** + * Index + */ + export type Index = { + /** + * Index ID. + */ + $id: string; + /** + * Index creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Index update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Index key. + */ + key: string; + /** + * Index type. + */ + type: string; + /** + * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: IndexStatus; + /** + * Error message. Displays error generated on failure of creating or deleting an index. + */ + error: string; + /** + * Index attributes. + */ + attributes: string[]; + /** + * Index attributes length. + */ + lengths: number[]; + /** + * Index orders. + */ + orders?: string[]; + } + + /** + * Index + */ + export type ColumnIndex = { + /** + * Index ID. + */ + $id: string; + /** + * Index creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Index update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Index Key. + */ + key: string; + /** + * Index type. + */ + type: string; + /** + * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` + */ + status: string; + /** + * Error message. Displays error generated on failure of creating or deleting an index. + */ + error: string; + /** + * Index columns. + */ + columns: string[]; + /** + * Index columns length. + */ + lengths: number[]; + /** + * Index orders. + */ + orders?: string[]; + } + + /** + * Row + */ + export type Row = { + /** + * Row ID. + */ + $id: string; + /** + * Row sequence ID. + */ + $sequence: string; + /** + * Table ID. + */ + $tableId: string; + /** + * Database ID. + */ + $databaseId: string; + /** + * Row creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Row update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + } + + export type DefaultRow = Row & { + [key: string]: any; + [__default]: true; + }; + + /** + * Document + */ + export type Document = { + /** + * Document ID. + */ + $id: string; + /** + * Document sequence ID. + */ + $sequence: string; + /** + * Collection ID. + */ + $collectionId: string; + /** + * Database ID. + */ + $databaseId: string; + /** + * Document creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Document update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + } + + export type DefaultDocument = Document & { + [key: string]: any; + [__default]: true; + }; + + /** + * Presence + */ + export type Presence = { + /** + * Presence ID. + */ + $id: string; + /** + * Presence creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Presence update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * User ID. + */ + userId: string; + /** + * Presence status. + */ + status?: string; + /** + * Presence source. + */ + source: string; + /** + * Presence expiry date in ISO 8601 format. + */ + expiresAt?: string; + } + + export type DefaultPresence = Presence & { + [key: string]: any; + [__default]: true; + }; + + /** + * Log + */ + export type Log = { + /** + * Event name. + */ + event: string; + /** + * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. + */ + userId: string; + /** + * User email of the actor recorded for this log. During impersonation, this is the original impersonator. + */ + userEmail: string; + /** + * User name of the actor recorded for this log. During impersonation, this is the original impersonator. + */ + userName: string; + /** + * API mode when event triggered. + */ + mode: string; + /** + * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + */ + userType: string; + /** + * IP session in use when the session was created. + */ + ip: string; + /** + * Log creation date in ISO 8601 format. + */ + time: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + + /** + * User + */ + export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + /** + * User ID. + */ + $id: string; + /** + * User creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * User update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User name. + */ + name: string; + /** + * Hashed user password. + */ + password?: string; + /** + * Password hashing algorithm. + */ + hash?: string; + /** + * Password hashing algorithm configuration. + */ + hashOptions?: object; + /** + * User registration date in ISO 8601 format. + */ + registration: string; + /** + * User status. Pass `true` for enabled and `false` for disabled. + */ + status: boolean; + /** + * Labels for the user. + */ + labels: string[]; + /** + * Password update time in ISO 8601 format. + */ + passwordUpdate: string; + /** + * User email address. + */ + email: string; + /** + * User phone number in E.164 format. + */ + phone: string; + /** + * Email verification status. + */ + emailVerification: boolean; + /** + * Phone verification status. + */ + phoneVerification: boolean; + /** + * Multi factor authentication status. + */ + mfa: boolean; + /** + * User preferences as a key-value object + */ + prefs: Preferences; + /** + * A user-owned message receiver. A single user may have multiple e.g. emails, phones, and a browser. Each target is registered with a single provider. + */ + targets: Target[]; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * Whether the user can impersonate other users. + */ + impersonator?: boolean; + /** + * ID of the original actor performing the impersonation. Present only when the current request is impersonating another user. Internal audit logs attribute the action to this user, while the impersonated target is recorded only in internal audit payload data. + */ + impersonatorUserId?: string; + } + + /** + * AlgoMD5 + */ + export type AlgoMd5 = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoSHA + */ + export type AlgoSha = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoPHPass + */ + export type AlgoPhpass = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoBcrypt + */ + export type AlgoBcrypt = { + /** + * Algo type. + */ + type: string; + } + + /** + * AlgoScrypt + */ + export type AlgoScrypt = { + /** + * Algo type. + */ + type: string; + /** + * CPU complexity of computed hash. + */ + costCpu: number; + /** + * Memory complexity of computed hash. + */ + costMemory: number; + /** + * Parallelization of computed hash. + */ + costParallel: number; + /** + * Length used to compute hash. + */ + length: number; + } + + /** + * AlgoScryptModified + */ + export type AlgoScryptModified = { + /** + * Algo type. + */ + type: string; + /** + * Salt used to compute hash. + */ + salt: string; + /** + * Separator used to compute hash. + */ + saltSeparator: string; + /** + * Key used to compute hash. + */ + signerKey: string; + } + + /** + * AlgoArgon2 + */ + export type AlgoArgon2 = { + /** + * Algo type. + */ + type: string; + /** + * Memory used to compute hash. + */ + memoryCost: number; + /** + * Amount of time consumed to compute hash + */ + timeCost: number; + /** + * Number of threads used to compute hash. + */ + threads: number; + } + + /** + * Preferences + */ + export type Preferences = { + } + + export type DefaultPreferences = Preferences & { + [key: string]: any; + [__default]: true; + }; + + /** + * Session + */ + export type Session = { + /** + * Session ID. + */ + $id: string; + /** + * Session creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Session update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User ID. + */ + userId: string; + /** + * Session expiration date in ISO 8601 format. + */ + expire: string; + /** + * Session Provider. + */ + provider: string; + /** + * Session Provider User ID. + */ + providerUid: string; + /** + * Session Provider Access Token. + */ + providerAccessToken: string; + /** + * The date of when the access token expires in ISO 8601 format. + */ + providerAccessTokenExpiry: string; + /** + * Session Provider Refresh Token. + */ + providerRefreshToken: string; + /** + * IP in use when the session was created. + */ + ip: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + /** + * Returns true if this the current user session. + */ + current: boolean; + /** + * Returns a list of active session factors. + */ + factors: string[]; + /** + * Secret used to authenticate the user. Only included if the request was made with an API key + */ + secret: string; + /** + * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. + */ + mfaUpdatedAt: string; + } + + /** + * Identity + */ + export type Identity = { + /** + * Identity ID. + */ + $id: string; + /** + * Identity creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Identity update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User ID. + */ + userId: string; + /** + * Identity Provider. + */ + provider: string; + /** + * ID of the User in the Identity Provider. + */ + providerUid: string; + /** + * Email of the User in the Identity Provider. + */ + providerEmail: string; + /** + * Identity Provider Access Token. + */ + providerAccessToken: string; + /** + * The date of when the access token expires in ISO 8601 format. + */ + providerAccessTokenExpiry: string; + /** + * Identity Provider Refresh Token. + */ + providerRefreshToken: string; + } + + /** + * Token + */ + export type Token = { + /** + * Token ID. + */ + $id: string; + /** + * Token creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * User ID. + */ + userId: string; + /** + * Token secret key. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + secret: string; + /** + * Token expiration date in ISO 8601 format. + */ + expire: string; + /** + * Security phrase of a token. Empty if security phrase was not requested when creating a token. It includes randomly generated phrase which is also sent in the external resource such as email. + */ + phrase: string; + } + + /** + * JWT + */ + export type Jwt = { + /** + * JWT encoded string. + */ + jwt: string; + } + + /** + * Locale + */ + export type Locale = { + /** + * User IP address. + */ + ip: string; + /** + * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format + */ + countryCode: string; + /** + * Country name. This field support localization. + */ + country: string; + /** + * Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America. + */ + continentCode: string; + /** + * Continent name. This field support localization. + */ + continent: string; + /** + * True if country is part of the European Union. + */ + eu: boolean; + /** + * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format + */ + currency: string; + } + + /** + * LocaleCode + */ + export type LocaleCode = { + /** + * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + */ + code: string; + /** + * Locale name + */ + name: string; + } + + /** + * File + */ + export type File = { + /** + * File ID. + */ + $id: string; + /** + * Bucket ID. + */ + bucketId: string; + /** + * File creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * File update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * File name. + */ + name: string; + /** + * File MD5 signature. + */ + signature: string; + /** + * File mime type. + */ + mimeType: string; + /** + * File original size in bytes. + */ + sizeOriginal: number; + /** + * File actual stored size in bytes after compression and/or encryption. + */ + sizeActual: number; + /** + * Total number of chunks available + */ + chunksTotal: number; + /** + * Total number of chunks uploaded + */ + chunksUploaded: number; + /** + * Whether file contents are encrypted at rest. + */ + encryption: boolean; + /** + * Compression algorithm used for the file. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + */ + compression: string; + } + + /** + * Bucket + */ + export type Bucket = { + /** + * Bucket ID. + */ + $id: string; + /** + * Bucket creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Bucket update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Bucket permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + $permissions: string[]; + /** + * Whether file-level security is enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). + */ + fileSecurity: boolean; + /** + * Bucket name. + */ + name: string; + /** + * Bucket enabled. + */ + enabled: boolean; + /** + * Maximum file size supported. + */ + maximumFileSize: number; + /** + * Allowed file extensions. + */ + allowedFileExtensions: string[]; + /** + * Compression algorithm chosen for compression. Will be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd). + */ + compression: string; + /** + * Bucket is encrypted. + */ + encryption: boolean; + /** + * Virus scanning is enabled. + */ + antivirus: boolean; + /** + * Image transformations are enabled. + */ + transformations: boolean; + /** + * Total size of this bucket in bytes. + */ + totalSize: number; + } + + /** + * ResourceToken + */ + export type ResourceToken = { + /** + * Token ID. + */ + $id: string; + /** + * Token creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource type. + */ + resourceType: string; + /** + * Token expiration date in ISO 8601 format. + */ + expire: string; + /** + * JWT encoded string. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + } + + /** + * Team + */ + export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + /** + * Team ID. + */ + $id: string; + /** + * Team creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Team update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Team name. + */ + name: string; + /** + * Total number of team members. + */ + total: number; + /** + * Team preferences as a key-value object + */ + prefs: Preferences; + } + + /** + * Membership + */ + export type Membership = { + /** + * Membership ID. + */ + $id: string; + /** + * Membership creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Membership update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * User ID. + */ + userId: string; + /** + * User name. Hide this attribute by toggling membership privacy in the Console. + */ + userName: string; + /** + * User email address. Hide this attribute by toggling membership privacy in the Console. + */ + userEmail: string; + /** + * User phone number. Hide this attribute by toggling membership privacy in the Console. + */ + userPhone: string; + /** + * Team ID. + */ + teamId: string; + /** + * Team name. + */ + teamName: string; + /** + * Date, the user has been invited to join the team in ISO 8601 format. + */ + invited: string; + /** + * Date, the user has accepted the invitation to join the team in ISO 8601 format. + */ + joined: string; + /** + * User confirmation status, true if the user has joined the team or false otherwise. + */ + confirm: boolean; + /** + * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. + */ + mfa: boolean; + /** + * User list of roles + */ + roles: string[]; + } + + /** + * Site + */ + export type Site = { + /** + * Site ID. + */ + $id: string; + /** + * Site creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Site update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Site name. + */ + name: string; + /** + * Site enabled. + */ + enabled: boolean; + /** + * Is the site deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration. + */ + live: boolean; + /** + * When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + */ + logging: boolean; + /** + * Site framework. + */ + framework: string; + /** + * How many days to keep the non-active deployments before they will be automatically deleted. + */ + deploymentRetention: number; + /** + * Site's active deployment ID. + */ + deploymentId: string; + /** + * Active deployment creation date in ISO 8601 format. + */ + deploymentCreatedAt: string; + /** + * Screenshot of active deployment with light theme preference file ID. + */ + deploymentScreenshotLight: string; + /** + * Screenshot of active deployment with dark theme preference file ID. + */ + deploymentScreenshotDark: string; + /** + * Site's latest deployment ID. + */ + latestDeploymentId: string; + /** + * Latest deployment creation date in ISO 8601 format. + */ + latestDeploymentCreatedAt: string; + /** + * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + */ + latestDeploymentStatus: string; + /** + * Site variables. + */ + vars: Variable[]; + /** + * Site request timeout in seconds. + */ + timeout: number; + /** + * The install command used to install the site dependencies. + */ + installCommand: string; + /** + * The build command used to build the site. + */ + buildCommand: string; + /** + * Custom command to use when starting site runtime. + */ + startCommand: string; + /** + * The directory where the site build output is located. + */ + outputDirectory: string; + /** + * Site VCS (Version Control System) installation id. + */ + installationId: string; + /** + * VCS (Version Control System) Repository ID + */ + providerRepositoryId: string; + /** + * VCS (Version Control System) branch name + */ + providerBranch: string; + /** + * Path to site in VCS (Version Control System) repository + */ + providerRootDirectory: string; + /** + * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + */ + providerSilentMode: boolean; + /** + * Machine specification for deployment builds. + */ + buildSpecification: string; + /** + * Machine specification for SSR executions. + */ + runtimeSpecification: string; + /** + * Site build runtime. + */ + buildRuntime: string; + /** + * Site framework adapter. + */ + adapter: string; + /** + * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + */ + fallbackFile: string; + } + + /** + * Function + */ + export type Function = { + /** + * Function ID. + */ + $id: string; + /** + * Function creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Function update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Execution permissions. + */ + execute: string[]; + /** + * Function name. + */ + name: string; + /** + * Function enabled. + */ + enabled: boolean; + /** + * Is the function deployed with the latest configuration? This is set to false if you've changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the function to update it with the latest configuration. + */ + live: boolean; + /** + * When disabled, executions will exclude logs and errors, and will be slightly faster. + */ + logging: boolean; + /** + * Function execution and build runtime. + */ + runtime: string; + /** + * How many days to keep the non-active deployments before they will be automatically deleted. + */ + deploymentRetention: number; + /** + * Function's active deployment ID. + */ + deploymentId: string; + /** + * Active deployment creation date in ISO 8601 format. + */ + deploymentCreatedAt: string; + /** + * Function's latest deployment ID. + */ + latestDeploymentId: string; + /** + * Latest deployment creation date in ISO 8601 format. + */ + latestDeploymentCreatedAt: string; + /** + * Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed". + */ + latestDeploymentStatus: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; + /** + * Function variables. + */ + vars: Variable[]; + /** + * Function trigger events. + */ + events: string[]; + /** + * Function execution schedule in CRON format. + */ + schedule: string; + /** + * Function execution timeout in seconds. + */ + timeout: number; + /** + * The entrypoint file used to execute the deployment. + */ + entrypoint: string; + /** + * The build command used to build the deployment. + */ + commands: string; + /** + * Version of Open Runtimes used for the function. + */ + version: string; + /** + * Function VCS (Version Control System) installation id. + */ + installationId: string; + /** + * VCS (Version Control System) Repository ID + */ + providerRepositoryId: string; + /** + * VCS (Version Control System) branch name + */ + providerBranch: string; + /** + * Path to function in VCS (Version Control System) repository + */ + providerRootDirectory: string; + /** + * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests + */ + providerSilentMode: boolean; + /** + * Machine specification for deployment builds. + */ + buildSpecification: string; + /** + * Machine specification for executions. + */ + runtimeSpecification: string; + } + + /** + * Runtime + */ + export type Runtime = { + /** + * Runtime ID. + */ + $id: string; + /** + * Parent runtime key. + */ + key: string; + /** + * Runtime Name. + */ + name: string; + /** + * Runtime version. + */ + version: string; + /** + * Base Docker image used to build the runtime. + */ + base: string; + /** + * Image name of Docker Hub. + */ + image: string; + /** + * Name of the logo image. + */ + logo: string; + /** + * List of supported architectures. + */ + supports: string[]; + } + + /** + * Framework + */ + export type Framework = { + /** + * Framework key. + */ + key: string; + /** + * Framework Name. + */ + name: string; + /** + * Default runtime version. + */ + buildRuntime: string; + /** + * List of supported runtime versions. + */ + runtimes: string[]; + /** + * List of supported adapters. + */ + adapters: FrameworkAdapter[]; + } + + /** + * Framework Adapter + */ + export type FrameworkAdapter = { + /** + * Adapter key. + */ + key: string; + /** + * Default command to download dependencies. + */ + installCommand: string; + /** + * Default command to build site into output directory. + */ + buildCommand: string; + /** + * Default output directory of build. + */ + outputDirectory: string; + /** + * Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed. + */ + fallbackFile: string; + } + + /** + * Deployment + */ + export type Deployment = { + /** + * Deployment ID. + */ + $id: string; + /** + * Deployment creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Deployment update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Type of deployment. + */ + type: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource type. + */ + resourceType: string; + /** + * The entrypoint file to use to execute the deployment code. + */ + entrypoint: string; + /** + * The code size in bytes. + */ + sourceSize: number; + /** + * The build output size in bytes. + */ + buildSize: number; + /** + * The total size in bytes (source and build output). + */ + totalSize: number; + /** + * The current build ID. + */ + buildId: string; + /** + * Whether the deployment should be automatically activated. + */ + activate: boolean; + /** + * Screenshot with light theme preference file ID. + */ + screenshotLight: string; + /** + * Screenshot with dark theme preference file ID. + */ + screenshotDark: string; + /** + * The deployment status. Possible values are "waiting", "processing", "building", "ready", "canceled" and "failed". + */ + status: DeploymentStatus; + /** + * The build logs. + */ + buildLogs: string; + /** + * The current build time in seconds. + */ + buildDuration: number; + /** + * The name of the vcs provider repository + */ + providerRepositoryName: string; + /** + * The name of the vcs provider repository owner + */ + providerRepositoryOwner: string; + /** + * The url of the vcs provider repository + */ + providerRepositoryUrl: string; + /** + * The commit hash of the vcs commit + */ + providerCommitHash: string; + /** + * The url of vcs commit author + */ + providerCommitAuthorUrl: string; + /** + * The name of vcs commit author + */ + providerCommitAuthor: string; + /** + * The commit message + */ + providerCommitMessage: string; + /** + * The url of the vcs commit + */ + providerCommitUrl: string; + /** + * The branch of the vcs repository + */ + providerBranch: string; + /** + * The branch of the vcs repository + */ + providerBranchUrl: string; + } + + /** + * Execution + */ + export type Execution = { + /** + * Execution ID. + */ + $id: string; + /** + * Execution creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Execution update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Execution roles. + */ + $permissions: string[]; + /** + * Function ID. + */ + functionId: string; + /** + * Function's deployment ID used to create the execution. + */ + deploymentId: string; + /** + * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + */ + trigger: ExecutionTrigger; + /** + * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. + */ + status: ExecutionStatus; + /** + * HTTP request method type. + */ + requestMethod: string; + /** + * HTTP request path and query. + */ + requestPath: string; + /** + * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + */ + requestHeaders: Headers[]; + /** + * HTTP response status code. + */ + responseStatusCode: number; + /** + * HTTP response body. This will return empty unless execution is created as synchronous. + */ + responseBody: string; + /** + * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + */ + responseHeaders: Headers[]; + /** + * Function logs. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + logs: string; + /** + * Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload. + */ + errors: string; + /** + * Resource(function/site) execution duration in seconds. + */ + duration: number; + /** + * The scheduled time for execution. If left empty, execution will be queued immediately. + */ + scheduledAt?: string; + } + + /** + * Project + */ + export type Project = { + /** + * Project ID. + */ + $id: string; + /** + * Project creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Project update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Project name. + */ + name: string; + /** + * Project team ID. + */ + teamId: string; + /** + * Deprecated since 1.9.5: List of dev keys. + */ + devKeys: DevKey[]; + /** + * Status for custom SMTP + */ + smtpEnabled: boolean; + /** + * SMTP sender name + */ + smtpSenderName: string; + /** + * SMTP sender email + */ + smtpSenderEmail: string; + /** + * SMTP reply to name + */ + smtpReplyToName: string; + /** + * SMTP reply to email + */ + smtpReplyToEmail: string; + /** + * SMTP server host name + */ + smtpHost: string; + /** + * SMTP server port + */ + smtpPort: number; + /** + * SMTP server username + */ + smtpUsername: string; + /** + * SMTP server password. This property is write-only and always returned empty. + */ + smtpPassword: string; + /** + * SMTP server secure protocol + */ + smtpSecure: string; + /** + * Number of times the ping was received for this project. + */ + pingCount: number; + /** + * Last ping datetime in ISO 8601 format. + */ + pingedAt: string; + /** + * Labels for the project. + */ + labels: string[]; + /** + * Project status + */ + status: string; + /** + * List of auth methods. + */ + authMethods: ProjectAuthMethod[]; + /** + * List of services. + */ + services: ProjectService[]; + /** + * List of protocols. + */ + protocols: ProjectProtocol[]; + /** + * Project region + */ + region: string; + /** + * Billing limits reached + */ + billingLimits?: BillingLimits; + /** + * Project blocks information + */ + blocks: Block[]; + /** + * Last time the project was accessed via console. Used with plan's projectInactivityDays to determine if project is paused. + */ + consoleAccessedAt: string; + } + + /** + * ProjectAuthMethod + */ + export type ProjectAuthMethod = { + /** + * Auth method ID. + */ + $id: ProjectAuthMethodId; + /** + * Auth method status. + */ + enabled: boolean; + } + + /** + * ProjectService + */ + export type ProjectService = { + /** + * Service ID. + */ + $id: ProjectServiceId; + /** + * Service status. + */ + enabled: boolean; + } + + /** + * ProjectProtocol + */ + export type ProjectProtocol = { + /** + * Protocol ID. + */ + $id: ProjectProtocolId; + /** + * Protocol status. + */ + enabled: boolean; + } + + /** + * Webhook + */ + export type Webhook = { + /** + * Webhook ID. + */ + $id: string; + /** + * Webhook creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Webhook update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Webhook name. + */ + name: string; + /** + * Webhook URL endpoint. + */ + url: string; + /** + * Webhook trigger events. + */ + events: string[]; + /** + * Indicates if SSL / TLS certificate verification is enabled. + */ + tls: boolean; + /** + * HTTP basic authentication username. + */ + authUsername: string; + /** + * HTTP basic authentication password. + */ + authPassword: string; + /** + * Signature key which can be used to validate incoming webhook payloads. Only returned on creation and secret rotation. + */ + secret: string; + /** + * Indicates if this webhook is enabled. + */ + enabled: boolean; + /** + * Webhook error logs from the most recent failure. + */ + logs: string; + /** + * Number of consecutive failed webhook attempts. + */ + attempts: number; + } + + /** + * Key + */ + export type Key = { + /** + * Key ID. + */ + $id: string; + /** + * Key creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Key update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Key name. + */ + name: string; + /** + * Key expiration date in ISO 8601 format. + */ + expire: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; + /** + * Secret key. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * List of SDK user agents that used this key. + */ + sdks: string[]; + } + + /** + * Ephemeral Key + */ + export type EphemeralKey = { + /** + * Key ID. + */ + $id: string; + /** + * Key creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Key update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Key name. + */ + name: string; + /** + * Key expiration date in ISO 8601 format. + */ + expire: string; + /** + * Allowed permission scopes. + */ + scopes: string[]; + /** + * Secret key. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * List of SDK user agents that used this key. + */ + sdks: string[]; + } + + /** + * DevKey + */ + export type DevKey = { + /** + * Key ID. + */ + $id: string; + /** + * Key creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Key update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Key name. + */ + name: string; + /** + * Key expiration date in ISO 8601 format. + */ + expire: string; + /** + * Secret key. + */ + secret: string; + /** + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + */ + accessedAt: string; + /** + * List of SDK user agents that used this key. + */ + sdks: string[]; + } + + /** + * Mock Number + */ + export type MockNumber = { + /** + * Mock phone number for testing phone authentication. Useful for testing phone authentication without sending an SMS. + */ + number: string; + /** + * Mock OTP for the number. + */ + otp: string; + /** + * Attribute creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Attribute update date in ISO 8601 format. + */ + $updatedAt: string; + } + + /** + * OAuth2GitHub + */ + export type OAuth2Github = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * GitHub OAuth2 client ID. For GitHub Apps, use the "App ID" when both an App ID and client ID are available. + */ + clientId: string; + /** + * GitHub OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Discord + */ + export type OAuth2Discord = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Discord OAuth2 client ID. + */ + clientId: string; + /** + * Discord OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Figma + */ + export type OAuth2Figma = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Figma OAuth2 client ID. + */ + clientId: string; + /** + * Figma OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Dropbox + */ + export type OAuth2Dropbox = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Dropbox OAuth2 app key. + */ + appKey: string; + /** + * Dropbox OAuth2 app secret. + */ + appSecret: string; + } + + /** + * OAuth2Dailymotion + */ + export type OAuth2Dailymotion = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Dailymotion OAuth2 API key. + */ + apiKey: string; + /** + * Dailymotion OAuth2 API secret. + */ + apiSecret: string; + } + + /** + * OAuth2Bitbucket + */ + export type OAuth2Bitbucket = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Bitbucket OAuth2 key. + */ + key: string; + /** + * Bitbucket OAuth2 secret. + */ + secret: string; + } + + /** + * OAuth2Bitly + */ + export type OAuth2Bitly = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Bitly OAuth2 client ID. + */ + clientId: string; + /** + * Bitly OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Box + */ + export type OAuth2Box = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Box OAuth2 client ID. + */ + clientId: string; + /** + * Box OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Autodesk + */ + export type OAuth2Autodesk = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Autodesk OAuth2 client ID. + */ + clientId: string; + /** + * Autodesk OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Google + */ + export type OAuth2Google = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Google OAuth2 client ID. + */ + clientId: string; + /** + * Google OAuth2 client secret. + */ + clientSecret: string; + /** + * Google OAuth2 prompt values. + */ + prompt: OAuth2GooglePrompt[]; + } + + /** + * OAuth2Zoom + */ + export type OAuth2Zoom = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Zoom OAuth2 client ID. + */ + clientId: string; + /** + * Zoom OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Zoho + */ + export type OAuth2Zoho = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Zoho OAuth2 client ID. + */ + clientId: string; + /** + * Zoho OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Yandex + */ + export type OAuth2Yandex = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Yandex OAuth2 client ID. + */ + clientId: string; + /** + * Yandex OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2X + */ + export type OAuth2X = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * X OAuth2 customer key. + */ + customerKey: string; + /** + * X OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2WordPress + */ + export type OAuth2WordPress = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * WordPress OAuth2 client ID. + */ + clientId: string; + /** + * WordPress OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Twitch + */ + export type OAuth2Twitch = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Twitch OAuth2 client ID. + */ + clientId: string; + /** + * Twitch OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Stripe + */ + export type OAuth2Stripe = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Stripe OAuth2 client ID. + */ + clientId: string; + /** + * Stripe OAuth2 API secret key. + */ + apiSecretKey: string; + } + + /** + * OAuth2Spotify + */ + export type OAuth2Spotify = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Spotify OAuth2 client ID. + */ + clientId: string; + /** + * Spotify OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Slack + */ + export type OAuth2Slack = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Slack OAuth2 client ID. + */ + clientId: string; + /** + * Slack OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Podio + */ + export type OAuth2Podio = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Podio OAuth2 client ID. + */ + clientId: string; + /** + * Podio OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Notion + */ + export type OAuth2Notion = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Notion OAuth2 client ID. + */ + oauthClientId: string; + /** + * Notion OAuth2 client secret. + */ + oauthClientSecret: string; + } + + /** + * OAuth2Salesforce + */ + export type OAuth2Salesforce = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Salesforce OAuth2 consumer key. + */ + customerKey: string; + /** + * Salesforce OAuth2 consumer secret. + */ + customerSecret: string; + } + + /** + * OAuth2Yahoo + */ + export type OAuth2Yahoo = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Yahoo OAuth2 client ID. + */ + clientId: string; + /** + * Yahoo OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Linkedin + */ + export type OAuth2Linkedin = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * LinkedIn OAuth2 client ID. + */ + clientId: string; + /** + * LinkedIn OAuth2 primary client secret. + */ + primaryClientSecret: string; + } + + /** + * OAuth2Disqus + */ + export type OAuth2Disqus = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Disqus OAuth2 public key. + */ + publicKey: string; + /** + * Disqus OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2Amazon + */ + export type OAuth2Amazon = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Amazon OAuth2 client ID. + */ + clientId: string; + /** + * Amazon OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Etsy + */ + export type OAuth2Etsy = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Etsy OAuth2 keystring. + */ + keyString: string; + /** + * Etsy OAuth2 shared secret. + */ + sharedSecret: string; + } + + /** + * OAuth2Facebook + */ + export type OAuth2Facebook = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Facebook OAuth2 app ID. + */ + appId: string; + /** + * Facebook OAuth2 app secret. + */ + appSecret: string; + } + + /** + * OAuth2Tradeshift + */ + export type OAuth2Tradeshift = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Tradeshift OAuth2 client ID. + */ + oauth2ClientId: string; + /** + * Tradeshift OAuth2 client secret. + */ + oauth2ClientSecret: string; + } + + /** + * OAuth2Paypal + */ + export type OAuth2Paypal = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * PayPal OAuth2 client ID. + */ + clientId: string; + /** + * PayPal OAuth2 secret key. + */ + secretKey: string; + } + + /** + * OAuth2Gitlab + */ + export type OAuth2Gitlab = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * GitLab OAuth2 application ID. + */ + applicationId: string; + /** + * GitLab OAuth2 secret. + */ + secret: string; + /** + * GitLab OAuth2 endpoint URL. Defaults to https://gitlab.com for self-hosted instances. + */ + endpoint: string; + } + + /** + * OAuth2Authentik + */ + export type OAuth2Authentik = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Authentik OAuth2 client ID. + */ + clientId: string; + /** + * Authentik OAuth2 client secret. + */ + clientSecret: string; + /** + * Authentik OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2Auth0 + */ + export type OAuth2Auth0 = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Auth0 OAuth2 client ID. + */ + clientId: string; + /** + * Auth0 OAuth2 client secret. + */ + clientSecret: string; + /** + * Auth0 OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2FusionAuth + */ + export type OAuth2FusionAuth = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * FusionAuth OAuth2 client ID. + */ + clientId: string; + /** + * FusionAuth OAuth2 client secret. + */ + clientSecret: string; + /** + * FusionAuth OAuth2 endpoint domain. + */ + endpoint: string; + } + + /** + * OAuth2Keycloak + */ + export type OAuth2Keycloak = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Keycloak OAuth2 client ID. + */ + clientId: string; + /** + * Keycloak OAuth2 client secret. + */ + clientSecret: string; + /** + * Keycloak OAuth2 endpoint domain. + */ + endpoint: string; + /** + * Keycloak OAuth2 realm name. + */ + realmName: string; + } + + /** + * OAuth2Oidc + */ + export type OAuth2Oidc = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * OpenID Connect OAuth2 client ID. + */ + clientId: string; + /** + * OpenID Connect OAuth2 client secret. + */ + clientSecret: string; + /** + * OpenID Connect well-known configuration URL. When set, authorization, token, and user info endpoints can be discovered automatically. + */ + wellKnownURL: string; + /** + * OpenID Connect authorization endpoint URL. + */ + authorizationURL: string; + /** + * OpenID Connect token endpoint URL. + */ + tokenURL: string; + /** + * OpenID Connect user info endpoint URL. + */ + userInfoURL: string; + } + + /** + * OAuth2Okta + */ + export type OAuth2Okta = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Okta OAuth2 client ID. + */ + clientId: string; + /** + * Okta OAuth2 client secret. + */ + clientSecret: string; + /** + * Okta OAuth2 domain. + */ + domain: string; + /** + * Okta OAuth2 authorization server ID. + */ + authorizationServerId: string; + } + + /** + * OAuth2Kick + */ + export type OAuth2Kick = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Kick OAuth2 client ID. + */ + clientId: string; + /** + * Kick OAuth2 client secret. + */ + clientSecret: string; + } + + /** + * OAuth2Apple + */ + export type OAuth2Apple = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Apple OAuth2 service ID. + */ + serviceId: string; + /** + * Apple OAuth2 key ID. + */ + keyId: string; + /** + * Apple OAuth2 team ID. + */ + teamId: string; + /** + * Apple OAuth2 .p8 private key file contents. The secret key wrapped by the PEM markers is 200 characters long. + */ + p8File: string; + } + + /** + * OAuth2Microsoft + */ + export type OAuth2Microsoft = { + /** + * OAuth2 provider ID. + */ + $id: string; + /** + * OAuth2 provider is active and can be used to create sessions. + */ + enabled: boolean; + /** + * Microsoft OAuth2 application ID. + */ + applicationId: string; + /** + * Microsoft OAuth2 application secret. + */ + applicationSecret: string; + /** + * Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. + */ + tenant: string; + } + + /** + * OAuth2 Providers List + */ + export type OAuth2ProviderList = { + /** + * Total number of OAuth2 providers in the given project. + */ + total: number; + /** + * List of OAuth2 providers. + */ + providers: (Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft)[]; + } + + /** + * Policy Password Dictionary + */ + export type PolicyPasswordDictionary = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether password dictionary policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Password History + */ + export type PolicyPasswordHistory = { + /** + * Policy ID. + */ + $id: string; + /** + * Password history length. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy Password Personal Data + */ + export type PolicyPasswordPersonalData = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether password personal data policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Alert + */ + export type PolicySessionAlert = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether session alert policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Duration + */ + export type PolicySessionDuration = { + /** + * Policy ID. + */ + $id: string; + /** + * Session duration in seconds. + */ + duration: number; + } + + /** + * Policy Session Invalidation + */ + export type PolicySessionInvalidation = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether session invalidation policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Session Limit + */ + export type PolicySessionLimit = { + /** + * Policy ID. + */ + $id: string; + /** + * Maximum number of sessions allowed per user. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy User Limit + */ + export type PolicyUserLimit = { + /** + * Policy ID. + */ + $id: string; + /** + * Maximum number of users allowed in the project. A value of 0 means the policy is disabled. + */ + total: number; + } + + /** + * Policy Membership Privacy + */ + export type PolicyMembershipPrivacy = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether user ID is visible in memberships. + */ + userId: boolean; + /** + * Whether user email is visible in memberships. + */ + userEmail: boolean; + /** + * Whether user phone is visible in memberships. + */ + userPhone: boolean; + /** + * Whether user name is visible in memberships. + */ + userName: boolean; + /** + * Whether user MFA status is visible in memberships. + */ + userMFA: boolean; + } + + /** + * Platform Web + */ + export type PlatformWeb = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Web app hostname. Empty string for other platforms. + */ + hostname: string; + } + + /** + * Platform Apple + */ + export type PlatformApple = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Apple bundle identifier. + */ + bundleIdentifier: string; + } + + /** + * Platform Android + */ + export type PlatformAndroid = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Android application ID. + */ + applicationId: string; + } + + /** + * Platform Windows + */ + export type PlatformWindows = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Windows package identifier name. + */ + packageIdentifierName: string; + } + + /** + * Platform Linux + */ + export type PlatformLinux = { + /** + * Platform ID. + */ + $id: string; + /** + * Platform creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Platform update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Platform name. + */ + name: string; + /** + * Platform type. Possible values are: windows, apple, android, linux, web. + */ + type: PlatformType; + /** + * Linux package name. + */ + packageName: string; + } + + /** + * Platforms List + */ + export type PlatformList = { + /** + * Total number of platforms in the given project. + */ + total: number; + /** + * List of platforms. + */ + platforms: (Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux)[]; + } + + /** + * Variable + */ + export type Variable = { + /** + * Variable ID. + */ + $id: string; + /** + * Variable creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Variable creation date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Variable key. + */ + key: string; + /** + * Variable value. + */ + value: string; + /** + * Variable secret flag. Secret variables can only be updated or deleted, but never read. + */ + secret: boolean; + /** + * Service to which the variable belongs. Possible values are "project", "function" + */ + resourceType: string; + /** + * ID of resource to which the variable belongs. If resourceType is "project", it is empty. If resourceType is "function", it is ID of the function. + */ + resourceId: string; + } + + /** + * Country + */ + export type Country = { + /** + * Country name. + */ + name: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + code: string; + } + + /** + * Continent + */ + export type Continent = { + /** + * Continent name. + */ + name: string; + /** + * Continent two letter code. + */ + code: string; + } + + /** + * Language + */ + export type Language = { + /** + * Language name. + */ + name: string; + /** + * Language two-character ISO 639-1 codes. + */ + code: string; + /** + * Language native name. + */ + nativeName: string; + } + + /** + * Currency + */ + export type Currency = { + /** + * Currency symbol. + */ + symbol: string; + /** + * Currency name. + */ + name: string; + /** + * Currency native symbol. + */ + symbolNative: string; + /** + * Number of decimal digits. + */ + decimalDigits: number; + /** + * Currency digit rounding. + */ + rounding: number; + /** + * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. + */ + code: string; + /** + * Currency plural name + */ + namePlural: string; + } + + /** + * Phone + */ + export type Phone = { + /** + * Phone code. + */ + code: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + + /** + * Health Antivirus + */ + export type HealthAntivirus = { + /** + * Antivirus version. + */ + version: string; + /** + * Antivirus status. Possible values are: `disabled`, `offline`, `online` + */ + status: HealthAntivirusStatus; + } + + /** + * Health Queue + */ + export type HealthQueue = { + /** + * Amount of actions in the queue. + */ + size: number; + } + + /** + * Health Status + */ + export type HealthStatus = { + /** + * Name of the service. + */ + name: string; + /** + * Duration in milliseconds how long the health check took. + */ + ping: number; + /** + * Service status. Possible values are: `pass`, `fail` + */ + status: HealthCheckStatus; + } + + /** + * Health Certificate + */ + export type HealthCertificate = { + /** + * Certificate name + */ + name: string; + /** + * Subject SN + */ + subjectSN: string; + /** + * Issuer organisation + */ + issuerOrganisation: string; + /** + * Valid from + */ + validFrom: string; + /** + * Valid to + */ + validTo: string; + /** + * Signature type SN + */ + signatureTypeSN: string; + } + + /** + * Health Time + */ + export type HealthTime = { + /** + * Current unix timestamp on trustful remote server. + */ + remoteTime: number; + /** + * Current unix timestamp of local server where Appwrite runs. + */ + localTime: number; + /** + * Difference of unix remote and local timestamps in milliseconds. + */ + diff: number; + } + + /** + * Headers + */ + export type Headers = { + /** + * Header name. + */ + name: string; + /** + * Header value. + */ + value: string; + } + + /** + * Specification + */ + export type Specification = { + /** + * Memory size in MB. + */ + memory: number; + /** + * Number of CPUs. + */ + cpus: number; + /** + * Is size enabled. + */ + enabled: boolean; + /** + * Size slug. + */ + slug: string; + } + + /** + * Rule + */ + export type ProxyRule = { + /** + * Rule ID. + */ + $id: string; + /** + * Rule creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Rule update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Domain name. + */ + domain: string; + /** + * Action definition for the rule. Possible values are "api", "deployment", or "redirect" + */ + type: string; + /** + * Defines how the rule was created. Possible values are "manual" or "deployment" + */ + trigger: string; + /** + * URL to redirect to. Used if type is "redirect" + */ + redirectUrl: string; + /** + * Status code to apply during redirect. Used if type is "redirect" + */ + redirectStatusCode: number; + /** + * ID of deployment. Used if type is "deployment" + */ + deploymentId: string; + /** + * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". + */ + deploymentResourceType?: ProxyRuleDeploymentResourceType; + /** + * ID of deployment's resource (site or function ID). Used if type is "deployment" + */ + deploymentResourceId: string; + /** + * Name of Git branch that updates rule. Used if type is "deployment" + */ + deploymentVcsProviderBranch: string; + /** + * Domain verification status. Possible values are "unverified", "verifying", "verified" + */ + status: ProxyRuleStatus; + /** + * Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. + */ + logs: string; + /** + * Certificate auto-renewal date in ISO 8601 format. + */ + renewAt: string; + } + + /** + * EmailTemplate + */ + export type EmailTemplate = { + /** + * Template type + */ + templateId: string; + /** + * Template locale + */ + locale: string; + /** + * Template message + */ + message: string; + /** + * Name of the sender + */ + senderName: string; + /** + * Email of the sender + */ + senderEmail: string; + /** + * Reply to email address + */ + replyToEmail: string; + /** + * Reply to name + */ + replyToName: string; + /** + * Email subject + */ + subject: string; + } + + /** + * MFA Challenge + */ + export type MfaChallenge = { + /** + * Token ID. + */ + $id: string; + /** + * Token creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * User ID. + */ + userId: string; + /** + * Token expiration date in ISO 8601 format. + */ + expire: string; + } + + /** + * MFA Recovery Codes + */ + export type MfaRecoveryCodes = { + /** + * Recovery codes. + */ + recoveryCodes: string[]; + } + + /** + * MFAType + */ + export type MfaType = { + /** + * Secret token used for TOTP factor. + */ + secret: string; + /** + * URI for authenticator apps. + */ + uri: string; + } + + /** + * MFAFactors + */ + export type MfaFactors = { + /** + * Can TOTP be used for MFA challenge for this account. + */ + totp: boolean; + /** + * Can phone (SMS) be used for MFA challenge for this account. + */ + phone: boolean; + /** + * Can email be used for MFA challenge for this account. + */ + email: boolean; + /** + * Can recovery code be used for MFA challenge for this account. + */ + recoveryCode: boolean; + } + + /** + * Provider + */ + export type Provider = { + /** + * Provider ID. + */ + $id: string; + /** + * Provider creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Provider update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The name for the provider instance. + */ + name: string; + /** + * The name of the provider service. + */ + provider: string; + /** + * Is provider enabled? + */ + enabled: boolean; + /** + * Type of provider. + */ + type: string; + /** + * Provider credentials. + */ + credentials: object; + /** + * Provider options. + */ + options?: object; + } + + /** + * Message + */ + export type Message = { + /** + * Message ID. + */ + $id: string; + /** + * Message creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Message update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Message provider type. + */ + providerType: string; + /** + * Topic IDs set as recipients. + */ + topics: string[]; + /** + * User IDs set as recipients. + */ + users: string[]; + /** + * Target IDs set as recipients. + */ + targets: string[]; + /** + * The scheduled time for message. + */ + scheduledAt?: string; + /** + * The time when the message was delivered. + */ + deliveredAt?: string; + /** + * Delivery errors if any. + */ + deliveryErrors?: string[]; + /** + * Number of recipients the message was delivered to. + */ + deliveredTotal: number; + /** + * Data of the message. + */ + data: object; + /** + * Status of delivery. + */ + status: MessageStatus; + } + + /** + * Topic + */ + export type Topic = { + /** + * Topic ID. + */ + $id: string; + /** + * Topic creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Topic update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The name of the topic. + */ + name: string; + /** + * Total count of email subscribers subscribed to the topic. + */ + emailTotal: number; + /** + * Total count of SMS subscribers subscribed to the topic. + */ + smsTotal: number; + /** + * Total count of push subscribers subscribed to the topic. + */ + pushTotal: number; + /** + * Subscribe permissions. + */ + subscribe: string[]; + } + + /** + * Transaction + */ + export type Transaction = { + /** + * Transaction ID. + */ + $id: string; + /** + * Transaction creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Transaction update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. + */ + status: string; + /** + * Number of operations in the transaction. + */ + operations: number; + /** + * Expiration time in ISO 8601 format. + */ + expiresAt: string; + } + + /** + * Subscriber + */ + export type Subscriber = { + /** + * Subscriber ID. + */ + $id: string; + /** + * Subscriber creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Subscriber update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Target ID. + */ + targetId: string; + /** + * Target. + */ + target: Target; + /** + * Topic ID. + */ + userId: string; + /** + * User Name. + */ + userName: string; + /** + * Topic ID. + */ + topicId: string; + /** + * The target provider type. Can be one of the following: `email`, `sms` or `push`. + */ + providerType: string; + } + + /** + * Target + */ + export type Target = { + /** + * Target ID. + */ + $id: string; + /** + * Target creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Target update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Target Name. + */ + name: string; + /** + * User ID. + */ + userId: string; + /** + * Provider ID. + */ + providerId?: string; + /** + * The target provider type. Can be one of the following: `email`, `sms` or `push`. + */ + providerType: string; + /** + * The target identifier. + */ + identifier: string; + /** + * Is the target expired. + */ + expired: boolean; + } + + /** + * Insight + */ + export type Insight = { + /** + * Insight ID. + */ + $id: string; + /** + * Insight creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Insight update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Parent report ID. Insights always belong to a report. + */ + reportId: string; + /** + * Insight type. One of databaseIndex (legacy), tablesDBIndex, documentsDBIndex, vectorsDBIndex, databasePerformance, sitePerformance, siteAccessibility, siteSeo, functionPerformance. The index types are engine-specific so each CTA can pair the right service+method (databases.createIndex, tablesDB.createIndex, documentsDB.createIndex, or vectorsDB.createIndex). + */ + type: string; + /** + * Insight severity. One of info, warning, critical. + */ + severity: string; + /** + * Insight status. One of active, dismissed. + */ + status: string; + /** + * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. + */ + resourceType: string; + /** + * ID of the resource the insight is about. + */ + resourceId: string; + /** + * Plural noun for the parent resource that contains the insight's resource, e.g. an insight about a column index on a table → resourceType=indexes, parentResourceType=tables. Empty when the resource has no parent. + */ + parentResourceType: string; + /** + * ID of the parent resource. Empty when the resource has no parent. + */ + parentResourceId: string; + /** + * Insight title. + */ + title: string; + /** + * Short markdown summary describing the insight. + */ + summary: string; + /** + * List of call-to-action buttons attached to this insight. + */ + ctas: InsightCTA[]; + /** + * Time the insight was analyzed in ISO 8601 format. + */ + analyzedAt?: string; + /** + * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. + */ + dismissedAt?: string; + /** + * User ID that dismissed the insight. Empty when not dismissed. + */ + dismissedBy?: string; + } + + /** + * InsightCTA + */ + export type InsightCTA = { + /** + * Human-readable label for the CTA, used in UI. + */ + label: string; + /** + * Public API service (SDK namespace) the client should invoke. Must match the engine that owns the resource — for index suggestions: databases (legacy), tablesDB, documentsDB, or vectorsDB. + */ + service: string; + /** + * Public API method on the chosen service the client should invoke when this CTA is triggered. + */ + method: string; + /** + * Parameter map the client should pass to the service method when this CTA is triggered. Keys match the target API's parameter names (e.g. databaseId/tableId/columns for tablesDB, databaseId/collectionId/attributes for the legacy Databases API). + */ + params: object; + } + + /** + * Report + */ + export type Report = { + /** + * Report ID. + */ + $id: string; + /** + * Report creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Report update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * ID of the third-party app that submitted the report. + */ + appId: string; + /** + * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. + */ + type: string; + /** + * Short, human-readable title for the report. + */ + title: string; + /** + * Markdown summary describing the report. + */ + summary: string; + /** + * Plural noun describing what the report analyzes, e.g. databases, sites, urls. + */ + targetType: string; + /** + * Free-form target identifier (URL for lighthouse, resource ID for db). + */ + target: string; + /** + * Categories covered by the report, e.g. performance, accessibility. + */ + categories: string[]; + /** + * Insights nested under this report. + */ + insights: Insight[]; + /** + * Time the report was analyzed in ISO 8601 format. + */ + analyzedAt?: string; + } + + /** + * ActivityEvent + */ + export type ActivityEvent = { + /** + * Event ID. + */ + $id: string; + /** + * User type. + */ + userType: string; + /** + * User ID. + */ + userId: string; + /** + * User Email. + */ + userEmail: string; + /** + * User Name. + */ + userName: string; + /** + * Resource parent. + */ + resourceParent: string; + /** + * Resource type. + */ + resourceType: string; + /** + * Resource ID. + */ + resourceId: string; + /** + * Resource. + */ + resource: string; + /** + * Event name. + */ + event: string; + /** + * User agent. + */ + userAgent: string; + /** + * IP address. + */ + ip: string; + /** + * API mode when event triggered. + */ + mode: string; + /** + * Location. + */ + country: string; + /** + * Log creation date in ISO 8601 format. + */ + time: string; + /** + * Project ID. + */ + projectId: string; + /** + * Team ID. + */ + teamId: string; + /** + * Hostname. + */ + hostname: string; + /** + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + */ + osCode: string; + /** + * Operating system name. + */ + osName: string; + /** + * Operating system version. + */ + osVersion: string; + /** + * Client type. + */ + clientType: string; + /** + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + */ + clientCode: string; + /** + * Client name. + */ + clientName: string; + /** + * Client version. + */ + clientVersion: string; + /** + * Client engine name. + */ + clientEngine: string; + /** + * Client engine name. + */ + clientEngineVersion: string; + /** + * Device name. + */ + deviceName: string; + /** + * Device brand name. + */ + deviceBrand: string; + /** + * Device model name. + */ + deviceModel: string; + /** + * Country two-character ISO 3166-1 alpha code. + */ + countryCode: string; + /** + * Country name. + */ + countryName: string; + } + + /** + * Archive + */ + export type BackupArchive = { + /** + * Archive ID. + */ + $id: string; + /** + * Archive creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Archive update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Archive policy ID. + */ + policyId: string; + /** + * Archive size in bytes. + */ + size: number; + /** + * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. + */ + status: string; + /** + * The backup start time. + */ + startedAt: string; + /** + * Migration ID. + */ + migrationId: string; + /** + * The services that are backed up by this archive. + */ + services: string[]; + /** + * The resources that are backed up by this archive. + */ + resources: string[]; + /** + * The resource ID to backup. Set only if this archive should backup a single resource. + */ + resourceId?: string; + /** + * The resource type to backup. Set only if this archive should backup a single resource. + */ + resourceType?: string; + } + + /** + * BillingLimits + */ + export type BillingLimits = { + /** + * Bandwidth limit + */ + bandwidth?: number; + /** + * Storage limit + */ + storage?: number; + /** + * Users limit + */ + users?: number; + /** + * Executions limit + */ + executions?: number; + /** + * GBHours limit + */ + GBHours?: number; + /** + * Image transformations limit + */ + imageTransformations?: number; + /** + * Auth phone limit + */ + authPhone?: number; + /** + * Budget limit percentage + */ + budgetLimit?: number; + } + + /** + * Block + */ + export type Block = { + /** + * Block creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Resource type that is blocked + */ + resourceType: string; + /** + * Resource identifier that is blocked + */ + resourceId: string; + /** + * Reason for the block. Can be null if no reason was provided. + */ + reason?: string; + /** + * Block expiration date in ISO 8601 format. Can be null if the block does not expire. + */ + expiredAt?: string; + /** + * Name of the project this block applies to. + */ + projectName: string; + /** + * Region of the project this block applies to. + */ + region: string; + /** + * Name of the organization that owns the project. + */ + organizationName: string; + /** + * ID of the organization that owns the project. + */ + organizationId: string; + /** + * Billing plan of the organization that owns the project. + */ + billingPlan: string; + } + + /** + * backup + */ + export type BackupPolicy = { + /** + * Backup policy ID. + */ + $id: string; + /** + * Backup policy name. + */ + name: string; + /** + * Policy creation date in ISO 8601 format. + */ + $createdAt: string; + /** + * Policy update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * The services that are backed up by this policy. + */ + services: string[]; + /** + * The resources that are backed up by this policy. + */ + resources: string[]; + /** + * The resource ID to backup. Set only if this policy should backup a single resource. + */ + resourceId?: string; + /** + * The resource type to backup. Set only if this policy should backup a single resource. + */ + resourceType?: string; + /** + * How many days to keep the backup before it will be automatically deleted. + */ + retention: number; + /** + * Policy backup schedule in CRON format. + */ + schedule: string; + /** + * Is this policy enabled. + */ + enabled: boolean; + } + + /** + * Restoration + */ + export type BackupRestoration = { + /** + * Restoration ID. + */ + $id: string; + /** + * Restoration creation time in ISO 8601 format. + */ + $createdAt: string; + /** + * Restoration update date in ISO 8601 format. + */ + $updatedAt: string; + /** + * Backup archive ID. + */ + archiveId: string; + /** + * Backup policy ID. + */ + policyId: string; + /** + * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. + */ + status: string; + /** + * The backup start time. + */ + startedAt: string; + /** + * Migration ID. + */ + migrationId: string; + /** + * The services that are backed up by this policy. + */ + services: string[]; + /** + * The resources that are backed up by this policy. + */ + resources: string[]; + /** + * Optional data in key-value object. + */ + options: string; + } + + /** + * usageEvent + */ + export type UsageEvent = { + /** + * The metric key. + */ + metric: string; + /** + * The metric value. + */ + value: number; + /** + * The event timestamp. + */ + time: string; + /** + * The API endpoint path. + */ + path: string; + /** + * The HTTP method. + */ + method: string; + /** + * HTTP status code. Stored as string to preserve unset state (empty string = not available). + */ + status: string; + /** + * The resource type. + */ + resourceType: string; + /** + * The resource ID. + */ + resourceId: string; + /** + * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. + */ + countryCode: string; + /** + * The user agent string. + */ + userAgent: string; + } + + /** + * Usage events list + */ + export type UsageEventList = { + /** + * Total number of events that matched your query. + */ + total: number; + /** + * List of events. + */ + events: UsageEvent[]; + } + + /** + * usageGauge + */ + export type UsageGauge = { + /** + * The metric key. + */ + metric: string; + /** + * The current snapshot value. + */ + value: number; + /** + * The snapshot timestamp. + */ + time: string; + } + + /** + * Usage gauges list + */ + export type UsageGaugeList = { + /** + * Total number of gauges that matched your query. + */ + total: number; + /** + * List of gauges. + */ + gauges: UsageGauge[]; + } + + /** + * Activity event list + */ + export type ActivityEventList = { + /** + * Total number of events that matched your query. + */ + total: number; + /** + * List of events. + */ + events: ActivityEvent[]; + } + + /** + * Backup archive list + */ + export type BackupArchiveList = { + /** + * Total number of archives that matched your query. + */ + total: number; + /** + * List of archives. + */ + archives: BackupArchive[]; + } + + /** + * Backup policy list + */ + export type BackupPolicyList = { + /** + * Total number of policies that matched your query. + */ + total: number; + /** + * List of policies. + */ + policies: BackupPolicy[]; + } + + /** + * Backup restoration list + */ + export type BackupRestorationList = { + /** + * Total number of restorations that matched your query. + */ + total: number; + /** + * List of restorations. + */ + restorations: BackupRestoration[]; + } +} diff --git a/src/operator.ts b/src/operator.ts new file mode 100644 index 00000000..2386a6c4 --- /dev/null +++ b/src/operator.ts @@ -0,0 +1,308 @@ +type OperatorValuesSingle = string | number | boolean; +export type OperatorValuesList = string[] | number[] | boolean[] | any[]; +export type OperatorValues = OperatorValuesSingle | OperatorValuesList; + +export enum Condition { + Equal = "equal", + NotEqual = "notEqual", + GreaterThan = "greaterThan", + GreaterThanEqual = "greaterThanEqual", + LessThan = "lessThan", + LessThanEqual = "lessThanEqual", + Contains = "contains", + IsNull = "isNull", + IsNotNull = "isNotNull", +} + +/** + * Helper class to generate operator strings for atomic operations. + */ +export class Operator { + method: string; + values: OperatorValuesList | undefined; + + /** + * Constructor for Operator class. + * + * @param {string} method + * @param {OperatorValues} values + */ + constructor( + method: string, + values?: OperatorValues + ) { + this.method = method; + + if (values !== undefined) { + if (Array.isArray(values)) { + this.values = values; + } else { + this.values = [values] as OperatorValuesList; + } + } + } + + /** + * Convert the operator object to a JSON string. + * + * @returns {string} + */ + toString(): string { + return JSON.stringify({ + method: this.method, + values: this.values, + }); + } + + /** + * Increment a numeric attribute by a specified value. + * + * @param {number} value + * @param {number} max + * @returns {string} + */ + static increment = (value: number = 1, max?: number): string => { + if (isNaN(value) || !isFinite(value)) { + throw new Error("Value cannot be NaN or Infinity"); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error("Max cannot be NaN or Infinity"); + } + const values: any[] = [value]; + if (max !== undefined) { + values.push(max); + } + return new Operator("increment", values).toString(); + }; + + /** + * Decrement a numeric attribute by a specified value. + * + * @param {number} value + * @param {number} min + * @returns {string} + */ + static decrement = (value: number = 1, min?: number): string => { + if (isNaN(value) || !isFinite(value)) { + throw new Error("Value cannot be NaN or Infinity"); + } + if (min !== undefined && (isNaN(min) || !isFinite(min))) { + throw new Error("Min cannot be NaN or Infinity"); + } + const values: any[] = [value]; + if (min !== undefined) { + values.push(min); + } + return new Operator("decrement", values).toString(); + }; + + /** + * Multiply a numeric attribute by a specified factor. + * + * @param {number} factor + * @param {number} max + * @returns {string} + */ + static multiply = (factor: number, max?: number): string => { + if (isNaN(factor) || !isFinite(factor)) { + throw new Error("Factor cannot be NaN or Infinity"); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error("Max cannot be NaN or Infinity"); + } + const values: any[] = [factor]; + if (max !== undefined) { + values.push(max); + } + return new Operator("multiply", values).toString(); + }; + + /** + * Divide a numeric attribute by a specified divisor. + * + * @param {number} divisor + * @param {number} min + * @returns {string} + */ + static divide = (divisor: number, min?: number): string => { + if (isNaN(divisor) || !isFinite(divisor)) { + throw new Error("Divisor cannot be NaN or Infinity"); + } + if (min !== undefined && (isNaN(min) || !isFinite(min))) { + throw new Error("Min cannot be NaN or Infinity"); + } + if (divisor === 0) { + throw new Error("Divisor cannot be zero"); + } + const values: any[] = [divisor]; + if (min !== undefined) { + values.push(min); + } + return new Operator("divide", values).toString(); + }; + + /** + * Apply modulo operation on a numeric attribute. + * + * @param {number} divisor + * @returns {string} + */ + static modulo = (divisor: number): string => { + if (isNaN(divisor) || !isFinite(divisor)) { + throw new Error("Divisor cannot be NaN or Infinity"); + } + if (divisor === 0) { + throw new Error("Divisor cannot be zero"); + } + return new Operator("modulo", [divisor]).toString(); + }; + + /** + * Raise a numeric attribute to a specified power. + * + * @param {number} exponent + * @param {number} max + * @returns {string} + */ + static power = (exponent: number, max?: number): string => { + if (isNaN(exponent) || !isFinite(exponent)) { + throw new Error("Exponent cannot be NaN or Infinity"); + } + if (max !== undefined && (isNaN(max) || !isFinite(max))) { + throw new Error("Max cannot be NaN or Infinity"); + } + const values: any[] = [exponent]; + if (max !== undefined) { + values.push(max); + } + return new Operator("power", values).toString(); + }; + + /** + * Append values to an array attribute. + * + * @param {any[]} values + * @returns {string} + */ + static arrayAppend = (values: any[]): string => + new Operator("arrayAppend", values).toString(); + + /** + * Prepend values to an array attribute. + * + * @param {any[]} values + * @returns {string} + */ + static arrayPrepend = (values: any[]): string => + new Operator("arrayPrepend", values).toString(); + + /** + * Insert a value at a specific index in an array attribute. + * + * @param {number} index + * @param {any} value + * @returns {string} + */ + static arrayInsert = (index: number, value: any): string => + new Operator("arrayInsert", [index, value]).toString(); + + /** + * Remove a value from an array attribute. + * + * @param {any} value + * @returns {string} + */ + static arrayRemove = (value: any): string => + new Operator("arrayRemove", [value]).toString(); + + /** + * Remove duplicate values from an array attribute. + * + * @returns {string} + */ + static arrayUnique = (): string => + new Operator("arrayUnique", []).toString(); + + /** + * Keep only values that exist in both the current array and the provided array. + * + * @param {any[]} values + * @returns {string} + */ + static arrayIntersect = (values: any[]): string => + new Operator("arrayIntersect", values).toString(); + + /** + * Remove values from the array that exist in the provided array. + * + * @param {any[]} values + * @returns {string} + */ + static arrayDiff = (values: any[]): string => + new Operator("arrayDiff", values).toString(); + + /** + * Filter array values based on a condition. + * + * @param {Condition} condition + * @param {any} value + * @returns {string} + */ + static arrayFilter = (condition: Condition, value?: any): string => { + const values: any[] = [condition as string, value === undefined ? null : value]; + return new Operator("arrayFilter", values).toString(); + }; + + /** + * Concatenate a value to a string or array attribute. + * + * @param {any} value + * @returns {string} + */ + static stringConcat = (value: any): string => + new Operator("stringConcat", [value]).toString(); + + /** + * Replace occurrences of a search string with a replacement string. + * + * @param {string} search + * @param {string} replace + * @returns {string} + */ + static stringReplace = (search: string, replace: string): string => + new Operator("stringReplace", [search, replace]).toString(); + + /** + * Toggle a boolean attribute. + * + * @returns {string} + */ + static toggle = (): string => + new Operator("toggle", []).toString(); + + /** + * Add days to a date attribute. + * + * @param {number} days + * @returns {string} + */ + static dateAddDays = (days: number): string => + new Operator("dateAddDays", [days]).toString(); + + /** + * Subtract days from a date attribute. + * + * @param {number} days + * @returns {string} + */ + static dateSubDays = (days: number): string => + new Operator("dateSubDays", [days]).toString(); + + /** + * Set a date attribute to the current date and time. + * + * @returns {string} + */ + static dateSetNow = (): string => + new Operator("dateSetNow", []).toString(); +} diff --git a/src/permission.ts b/src/permission.ts new file mode 100644 index 00000000..94d9cedd --- /dev/null +++ b/src/permission.ts @@ -0,0 +1,57 @@ +/** + * Helper class to generate permission strings for resources. + */ +export class Permission { + /** + * Generate read permission string for the provided role. + * + * @param {string} role + * @returns {string} + */ + static read = (role: string): string => { + return `read("${role}")`; + } + + /** + * Generate write permission string for the provided role. + * + * This is an alias of update, delete, and possibly create. + * Don't use write in combination with update, delete, or create. + * + * @param {string} role + * @returns {string} + */ + static write = (role: string): string => { + return `write("${role}")`; + } + + /** + * Generate create permission string for the provided role. + * + * @param {string} role + * @returns {string} + */ + static create = (role: string): string => { + return `create("${role}")`; + } + + /** + * Generate update permission string for the provided role. + * + * @param {string} role + * @returns {string} + */ + static update = (role: string): string => { + return `update("${role}")`; + } + + /** + * Generate delete permission string for the provided role. + * + * @param {string} role + * @returns {string} + */ + static delete = (role: string): string => { + return `delete("${role}")`; + } +} diff --git a/src/query.ts b/src/query.ts new file mode 100644 index 00000000..fdd9f407 --- /dev/null +++ b/src/query.ts @@ -0,0 +1,576 @@ +import JSONbigModule from 'json-bigint'; +const JSONbig = JSONbigModule({ useNativeBigInt: true }); + +type QueryTypesSingle = string | number | bigint | boolean; +export type QueryTypesList = string[] | number[] | bigint[] | boolean[] | Query[] | any[]; +export type QueryTypes = QueryTypesSingle | QueryTypesList; +type AttributesTypes = string | string[]; + +/** + * Helper class to generate query strings. + */ +export class Query { + method: string; + attribute: AttributesTypes | undefined; + values: QueryTypesList | undefined; + + /** + * Constructor for Query class. + * + * @param {string} method + * @param {AttributesTypes} attribute + * @param {QueryTypes} values + */ + constructor( + method: string, + attribute?: AttributesTypes, + values?: QueryTypes + ) { + this.method = method; + this.attribute = attribute; + + if (values !== undefined) { + if (Array.isArray(values)) { + this.values = values; + } else { + this.values = [values] as QueryTypesList; + } + } + } + + /** + * Convert the query object to a JSON string. + * + * @returns {string} + */ + toString(): string { + return JSONbig.stringify({ + method: this.method, + attribute: this.attribute, + values: this.values, + }); + } + + /** + * Filter resources where attribute is equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static equal = (attribute: string, value: QueryTypes): string => + new Query("equal", attribute, value).toString(); + + /** + * Filter resources where attribute is not equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static notEqual = (attribute: string, value: QueryTypes): string => + new Query("notEqual", attribute, value).toString(); + + /** + * Filter resources where attribute matches a regular expression pattern. + * + * @param {string} attribute The attribute to filter on. + * @param {string} pattern The regular expression pattern to match. + * @returns {string} + */ + static regex = (attribute: string, pattern: string): string => + new Query("regex", attribute, pattern).toString(); + + /** + * Filter resources where attribute is less than value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static lessThan = (attribute: string, value: QueryTypes): string => + new Query("lessThan", attribute, value).toString(); + + /** + * Filter resources where attribute is less than or equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static lessThanEqual = (attribute: string, value: QueryTypes): string => + new Query("lessThanEqual", attribute, value).toString(); + + /** + * Filter resources where attribute is greater than value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static greaterThan = (attribute: string, value: QueryTypes): string => + new Query("greaterThan", attribute, value).toString(); + + /** + * Filter resources where attribute is greater than or equal to value. + * + * @param {string} attribute + * @param {QueryTypes} value + * @returns {string} + */ + static greaterThanEqual = (attribute: string, value: QueryTypes): string => + new Query("greaterThanEqual", attribute, value).toString(); + + /** + * Filter resources where attribute is null. + * + * @param {string} attribute + * @returns {string} + */ + static isNull = (attribute: string): string => + new Query("isNull", attribute).toString(); + + /** + * Filter resources where attribute is not null. + * + * @param {string} attribute + * @returns {string} + */ + static isNotNull = (attribute: string): string => + new Query("isNotNull", attribute).toString(); + + /** + * Filter resources where the specified attributes exist. + * + * @param {string[]} attributes The list of attributes that must exist. + * @returns {string} + */ + static exists = (attributes: string[]): string => + new Query("exists", undefined, attributes).toString(); + + /** + * Filter resources where the specified attributes do not exist. + * + * @param {string[]} attributes The list of attributes that must not exist. + * @returns {string} + */ + static notExists = (attributes: string[]): string => + new Query("notExists", undefined, attributes).toString(); + + /** + * Filter resources where attribute is between start and end (inclusive). + * + * @param {string} attribute + * @param {string | number | bigint} start + * @param {string | number | bigint} end + * @returns {string} + */ + static between = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => + new Query("between", attribute, [start, end] as QueryTypesList).toString(); + + /** + * Filter resources where attribute starts with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static startsWith = (attribute: string, value: string): string => + new Query("startsWith", attribute, value).toString(); + + /** + * Filter resources where attribute ends with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static endsWith = (attribute: string, value: string): string => + new Query("endsWith", attribute, value).toString(); + + /** + * Specify which attributes should be returned by the API call. + * + * @param {string[]} attributes + * @returns {string} + */ + static select = (attributes: string[]): string => + new Query("select", undefined, attributes).toString(); + + /** + * Filter resources by searching attribute for value. + * A fulltext index on attribute is required for this query to work. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static search = (attribute: string, value: string): string => + new Query("search", attribute, value).toString(); + + /** + * Sort results by attribute descending. + * + * @param {string} attribute + * @returns {string} + */ + static orderDesc = (attribute: string): string => + new Query("orderDesc", attribute).toString(); + + /** + * Sort results by attribute ascending. + * + * @param {string} attribute + * @returns {string} + */ + static orderAsc = (attribute: string): string => + new Query("orderAsc", attribute).toString(); + + /** + * Sort results randomly. + * + * @returns {string} + */ + static orderRandom = (): string => + new Query("orderRandom").toString(); + + /** + * Return results after documentId. + * + * @param {string} documentId + * @returns {string} + */ + static cursorAfter = (documentId: string): string => + new Query("cursorAfter", undefined, documentId).toString(); + + /** + * Return results before documentId. + * + * @param {string} documentId + * @returns {string} + */ + static cursorBefore = (documentId: string): string => + new Query("cursorBefore", undefined, documentId).toString(); + + /** + * Return only limit results. + * + * @param {number} limit + * @returns {string} + */ + static limit = (limit: number): string => + new Query("limit", undefined, limit).toString(); + + /** + * Filter resources by skipping the first offset results. + * + * @param {number} offset + * @returns {string} + */ + static offset = (offset: number): string => + new Query("offset", undefined, offset).toString(); + + /** + * Filter resources where attribute contains the specified value. + * For string attributes, checks if the string contains the substring. + * + * Note: For array attributes, use {@link containsAny} or {@link containsAll} instead. + * @param {string} attribute + * @param {string | string[]} value + * @returns {string} + */ + static contains = (attribute: string, value: string | any[]): string => + new Query("contains", attribute, value).toString(); + + /** + * Filter resources where attribute contains ANY of the specified values. + * For array and relationship attributes, matches documents where the attribute + * contains at least one of the given values. + * + * @param {string} attribute + * @param {any[]} value + * @returns {string} + */ + static containsAny = (attribute: string, value: any[]): string => + new Query("containsAny", attribute, value).toString(); + + /** + * Filter resources where attribute contains ALL of the specified values. + * For array and relationship attributes, matches documents where the attribute + * contains every one of the given values. + * + * @param {string} attribute + * @param {any[]} value + * @returns {string} + */ + static containsAll = (attribute: string, value: any[]): string => + new Query("containsAll", attribute, value).toString(); + + /** + * Filter resources where attribute does not contain the specified value. + * + * @param {string} attribute + * @param {string | any[]} value + * @returns {string} + */ + static notContains = (attribute: string, value: string | any[]): string => + new Query("notContains", attribute, value).toString(); + + /** + * Filter resources by searching attribute for value (inverse of search). + * A fulltext index on attribute is required for this query to work. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static notSearch = (attribute: string, value: string): string => + new Query("notSearch", attribute, value).toString(); + + /** + * Filter resources where attribute is not between start and end (exclusive). + * + * @param {string} attribute + * @param {string | number | bigint} start + * @param {string | number | bigint} end + * @returns {string} + */ + static notBetween = (attribute: string, start: string | number | bigint, end: string | number | bigint): string => + new Query("notBetween", attribute, [start, end] as QueryTypesList).toString(); + + /** + * Filter resources where attribute does not start with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static notStartsWith = (attribute: string, value: string): string => + new Query("notStartsWith", attribute, value).toString(); + + /** + * Filter resources where attribute does not end with value. + * + * @param {string} attribute + * @param {string} value + * @returns {string} + */ + static notEndsWith = (attribute: string, value: string): string => + new Query("notEndsWith", attribute, value).toString(); + + /** + * Filter resources where document was created before date. + * + * @param {string} value + * @returns {string} + */ + static createdBefore = (value: string): string => + Query.lessThan("$createdAt", value); + + /** + * Filter resources where document was created after date. + * + * @param {string} value + * @returns {string} + */ + static createdAfter = (value: string): string => + Query.greaterThan("$createdAt", value); + + /** + * Filter resources where document was created between dates. + * + * @param {string} start + * @param {string} end + * @returns {string} + */ + static createdBetween = (start: string, end: string): string => + Query.between("$createdAt", start, end); + + /** + * Filter resources where document was updated before date. + * + * @param {string} value + * @returns {string} + */ + static updatedBefore = (value: string): string => + Query.lessThan("$updatedAt", value); + + /** + * Filter resources where document was updated after date. + * + * @param {string} value + * @returns {string} + */ + static updatedAfter = (value: string): string => + Query.greaterThan("$updatedAt", value); + + /** + * Filter resources where document was updated between dates. + * + * @param {string} start + * @param {string} end + * @returns {string} + */ + static updatedBetween = (start: string, end: string): string => + Query.between("$updatedAt", start, end); + + /** + * Combine multiple queries using logical OR operator. + * + * @param {string[]} queries + * @returns {string} + */ + static or = (queries: string[]) => + new Query("or", undefined, queries.map((query) => JSONbig.parse(query))).toString(); + + /** + * Combine multiple queries using logical AND operator. + * + * @param {string[]} queries + * @returns {string} + */ + static and = (queries: string[]) => + new Query("and", undefined, queries.map((query) => JSONbig.parse(query))).toString(); + + /** + * Filter array elements where at least one element matches all the specified queries. + * + * @param {string} attribute The attribute containing the array to filter on. + * @param {string[]} queries The list of query strings to match against array elements. + * @returns {string} + */ + static elemMatch = (attribute: string, queries: string[]): string => + new Query( + "elemMatch", + attribute, + queries.map((query) => JSONbig.parse(query)) + ).toString(); + + /** + * Filter resources where attribute is at a specific distance from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is not at a specific distance from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceNotEqual = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceNotEqual", attribute, [[values, distance, meters]] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is at a distance greater than the specified value from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceGreaterThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceGreaterThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); + + /** + * Filter resources where attribute is at a distance less than the specified value from the given coordinates. + * + * @param {string} attribute + * @param {any[]} values + * @param {number} distance + * @param {boolean} meters + * @returns {string} + */ + static distanceLessThan = (attribute: string, values: any[], distance: number, meters: boolean = true): string => + new Query("distanceLessThan", attribute, [[values, distance, meters]] as QueryTypesList).toString(); + + /** + * Filter resources where attribute intersects with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static intersects = (attribute: string, values: any[]): string => + new Query("intersects", attribute, [values]).toString(); + + /** + * Filter resources where attribute does not intersect with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notIntersects = (attribute: string, values: any[]): string => + new Query("notIntersects", attribute, [values]).toString(); + + /** + * Filter resources where attribute crosses the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static crosses = (attribute: string, values: any[]): string => + new Query("crosses", attribute, [values]).toString(); + + /** + * Filter resources where attribute does not cross the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notCrosses = (attribute: string, values: any[]): string => + new Query("notCrosses", attribute, [values]).toString(); + + /** + * Filter resources where attribute overlaps with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static overlaps = (attribute: string, values: any[]): string => + new Query("overlaps", attribute, [values]).toString(); + + /** + * Filter resources where attribute does not overlap with the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notOverlaps = (attribute: string, values: any[]): string => + new Query("notOverlaps", attribute, [values]).toString(); + + /** + * Filter resources where attribute touches the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static touches = (attribute: string, values: any[]): string => + new Query("touches", attribute, [values]).toString(); + + /** + * Filter resources where attribute does not touch the given geometry. + * + * @param {string} attribute + * @param {any[]} values + * @returns {string} + */ + static notTouches = (attribute: string, values: any[]): string => + new Query("notTouches", attribute, [values]).toString(); +} diff --git a/src/role.ts b/src/role.ts new file mode 100644 index 00000000..79f8c6b6 --- /dev/null +++ b/src/role.ts @@ -0,0 +1,100 @@ +/** + * Helper class to generate role strings for `Permission`. + */ +export class Role { + + /** + * Grants access to anyone. + * + * This includes authenticated and unauthenticated users. + * + * @returns {string} + */ + public static any(): string { + return 'any' + } + + /** + * Grants access to a specific user by user ID. + * + * You can optionally pass verified or unverified for + * `status` to target specific types of users. + * + * @param {string} id + * @param {string} status + * @returns {string} + */ + public static user(id: string, status: string = ''): string { + if (status === '') { + return `user:${id}` + } + return `user:${id}/${status}` + } + + /** + * Grants access to any authenticated or anonymous user. + * + * You can optionally pass verified or unverified for + * `status` to target specific types of users. + * + * @param {string} status + * @returns {string} + */ + public static users(status: string = ''): string { + if (status === '') { + return 'users' + } + return `users/${status}` + } + + /** + * Grants access to any guest user without a session. + * + * Authenticated users don't have access to this role. + * + * @returns {string} + */ + public static guests(): string { + return 'guests' + } + + /** + * Grants access to a team by team ID. + * + * You can optionally pass a role for `role` to target + * team members with the specified role. + * + * @param {string} id + * @param {string} role + * @returns {string} + */ + public static team(id: string, role: string = ''): string { + if (role === '') { + return `team:${id}` + } + return `team:${id}/${role}` + } + + /** + * Grants access to a specific member of a team. + * + * When the member is removed from the team, they will + * no longer have access. + * + * @param {string} id + * @returns {string} + */ + public static member(id: string): string { + return `member:${id}` + } + + /** + * Grants access to a user with the specified label. + * + * @param {string} name + * @returns {string} + */ + public static label(name: string): string { + return `label:${name}` + } +} \ No newline at end of file diff --git a/src/services/account.ts b/src/services/account.ts new file mode 100644 index 00000000..c98e454b --- /dev/null +++ b/src/services/account.ts @@ -0,0 +1,2831 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { AuthenticatorType } from '../enums/authenticator-type'; +import { AuthenticationFactor } from '../enums/authentication-factor'; +import { OAuthProvider } from '../enums/o-auth-provider'; + +export class Account { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get the currently logged in user. + * + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + get<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> { + + const apiPath = '/account'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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). + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.password - New user password. Must be between 8 and 256 chars. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * 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). + * + * @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. + * @param {string} email - User email. + * @param {string} password - New user password. Must be between 8 and 256 chars. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + create<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/account'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * + * + * @param {string} params.email - User email. + * @param {string} params.password - User password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { email: string, password: string }): Promise<Models.User<Preferences>>; + /** + * 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. + * This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password. + * + * + * @param {string} email - User email. + * @param {string} password - User password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(email: string, password: string): Promise<Models.User<Preferences>>; + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { email: string, password: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { email: string, password: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { email: string, password: string }; + } else { + params = { + email: paramsOrFirst as string, + password: rest[0] as string + }; + } + + const email = params.email; + const password = params.password; + + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/account/email'; + const payload: Payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the list of identities for the currently logged in user. + * + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IdentityList>} + */ + listIdentities(params?: { queries?: string[], total?: boolean }): Promise<Models.IdentityList>; + /** + * Get the list of identities for the currently logged in user. + * + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IdentityList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIdentities(queries?: string[], total?: boolean): Promise<Models.IdentityList>; + listIdentities( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.IdentityList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/account/identities'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an identity by its unique ID. + * + * @param {string} params.identityId - Identity ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteIdentity(params: { identityId: string }): Promise<{}>; + /** + * Delete an identity by its unique ID. + * + * @param {string} identityId - Identity ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteIdentity(identityId: string): Promise<{}>; + deleteIdentity( + paramsOrFirst: { identityId: string } | string + ): Promise<{}> { + let params: { identityId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { identityId: string }; + } else { + params = { + identityId: paramsOrFirst as string + }; + } + + const identityId = params.identityId; + + if (typeof identityId === 'undefined') { + throw new AppwriteException('Missing required parameter: "identityId"'); + } + + const apiPath = '/account/identities/{identityId}'.replace('{identityId}', identityId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Jwt>} + */ + createJWT(params?: { duration?: number }): Promise<Models.Jwt>; + /** + * 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. + * + * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Jwt>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createJWT(duration?: number): Promise<Models.Jwt>; + createJWT( + paramsOrFirst?: { duration?: number } | number + ): Promise<Models.Jwt> { + let params: { duration?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { duration?: number }; + } else { + params = { + duration: paramsOrFirst as number + }; + } + + const duration = params.duration; + + + const apiPath = '/account/jwts'; + const payload: Payload = {}; + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listLogs(params?: { queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * 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. + * + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listLogs(queries?: string[], total?: boolean): Promise<Models.LogList>; + listLogs( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.LogList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/account/logs'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Enable or disable MFA on an account. + * + * @param {boolean} params.mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { mfa: boolean }): Promise<Models.User<Preferences>>; + /** + * Enable or disable MFA on an account. + * + * @param {boolean} mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(mfa: boolean): Promise<Models.User<Preferences>>; + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { mfa: boolean } | boolean + ): Promise<Models.User<Preferences>> { + let params: { mfa: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { mfa: boolean }; + } else { + params = { + mfa: paramsOrFirst as boolean + }; + } + + const mfa = params.mfa; + + if (typeof mfa === 'undefined') { + throw new AppwriteException('Missing required parameter: "mfa"'); + } + + const apiPath = '/account/mfa'; + const payload: Payload = {}; + if (typeof mfa !== 'undefined') { + payload['mfa'] = mfa; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp` + * @throws {AppwriteException} + * @returns {Promise<Models.MfaType>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAAuthenticator` instead. + */ + createMfaAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>; + /** + * 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. + * + * @param {AuthenticatorType} type - Type of authenticator. Must be `totp` + * @throws {AppwriteException} + * @returns {Promise<Models.MfaType>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMfaAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>; + createMfaAuthenticator( + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + ): Promise<Models.MfaType> { + let params: { type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type: AuthenticatorType }; + } else { + params = { + type: paramsOrFirst as AuthenticatorType + }; + } + + const type = params.type; + + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {AuthenticatorType} params.type - Type of authenticator. Must be `totp` + * @throws {AppwriteException} + * @returns {Promise<Models.MfaType>} + */ + createMFAAuthenticator(params: { type: AuthenticatorType }): Promise<Models.MfaType>; + /** + * 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. + * + * @param {AuthenticatorType} type - Type of authenticator. Must be `totp` + * @throws {AppwriteException} + * @returns {Promise<Models.MfaType>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMFAAuthenticator(type: AuthenticatorType): Promise<Models.MfaType>; + createMFAAuthenticator( + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + ): Promise<Models.MfaType> { + let params: { type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type: AuthenticatorType }; + } else { + params = { + type: paramsOrFirst as AuthenticatorType + }; + } + + const type = params.type; + + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + * + * @param {AuthenticatorType} params.type - Type of authenticator. + * @param {string} params.otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAAuthenticator` instead. + */ + updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>; + /** + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + * + * @param {AuthenticatorType} type - Type of authenticator. + * @param {string} otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>; + updateMfaAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { type: AuthenticatorType, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string }; + } else { + params = { + type: paramsOrFirst as AuthenticatorType, + otp: rest[0] as string + }; + } + + const type = params.type; + const otp = params.otp; + + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const payload: Payload = {}; + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + * + * @param {AuthenticatorType} params.type - Type of authenticator. + * @param {string} params.otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { type: AuthenticatorType, otp: string }): Promise<Models.User<Preferences>>; + /** + * Verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method. + * + * @param {AuthenticatorType} type - Type of authenticator. + * @param {string} otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>(type: AuthenticatorType, otp: string): Promise<Models.User<Preferences>>; + updateMFAAuthenticator<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { type: AuthenticatorType, otp: string } | AuthenticatorType, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { type: AuthenticatorType, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst || 'otp' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type: AuthenticatorType, otp: string }; + } else { + params = { + type: paramsOrFirst as AuthenticatorType, + otp: rest[0] as string + }; + } + + const type = params.type; + const otp = params.otp; + + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const payload: Payload = {}; + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an authenticator for a user by ID. + * + * @param {AuthenticatorType} params.type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.deleteMFAAuthenticator` instead. + */ + deleteMfaAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; + /** + * Delete an authenticator for a user by ID. + * + * @param {AuthenticatorType} type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMfaAuthenticator(type: AuthenticatorType): Promise<{}>; + deleteMfaAuthenticator( + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + ): Promise<{}> { + let params: { type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type: AuthenticatorType }; + } else { + params = { + type: paramsOrFirst as AuthenticatorType + }; + } + + const type = params.type; + + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an authenticator for a user by ID. + * + * @param {AuthenticatorType} params.type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMFAAuthenticator(params: { type: AuthenticatorType }): Promise<{}>; + /** + * Delete an authenticator for a user by ID. + * + * @param {AuthenticatorType} type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMFAAuthenticator(type: AuthenticatorType): Promise<{}>; + deleteMFAAuthenticator( + paramsOrFirst: { type: AuthenticatorType } | AuthenticatorType + ): Promise<{}> { + let params: { type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('type' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { type: AuthenticatorType }; + } else { + params = { + type: paramsOrFirst as AuthenticatorType + }; + } + + const type = params.type; + + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/account/mfa/authenticators/{type}'.replace('{type}', type); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + * + * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaChallenge>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFAChallenge` instead. + */ + createMfaChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>; + /** + * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + * + * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaChallenge>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMfaChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>; + createMfaChallenge( + paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor + ): Promise<Models.MfaChallenge> { + let params: { factor: AuthenticationFactor }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { factor: AuthenticationFactor }; + } else { + params = { + factor: paramsOrFirst as AuthenticationFactor + }; + } + + const factor = params.factor; + + if (typeof factor === 'undefined') { + throw new AppwriteException('Missing required parameter: "factor"'); + } + + const apiPath = '/account/mfa/challenges'; + const payload: Payload = {}; + if (typeof factor !== 'undefined') { + payload['factor'] = factor; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + * + * @param {AuthenticationFactor} params.factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaChallenge>} + */ + createMFAChallenge(params: { factor: AuthenticationFactor }): Promise<Models.MfaChallenge>; + /** + * Begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method. + * + * @param {AuthenticationFactor} factor - Factor used for verification. Must be one of following: `email`, `phone`, `totp`, `recoveryCode`. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaChallenge>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMFAChallenge(factor: AuthenticationFactor): Promise<Models.MfaChallenge>; + createMFAChallenge( + paramsOrFirst: { factor: AuthenticationFactor } | AuthenticationFactor + ): Promise<Models.MfaChallenge> { + let params: { factor: AuthenticationFactor }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('factor' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { factor: AuthenticationFactor }; + } else { + params = { + factor: paramsOrFirst as AuthenticationFactor + }; + } + + const factor = params.factor; + + if (typeof factor === 'undefined') { + throw new AppwriteException('Missing required parameter: "factor"'); + } + + const apiPath = '/account/mfa/challenges'; + const payload: Payload = {}; + if (typeof factor !== 'undefined') { + payload['factor'] = factor; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.challengeId - ID of the challenge. + * @param {string} params.otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFAChallenge` instead. + */ + updateMfaChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>; + /** + * 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. + * + * @param {string} challengeId - ID of the challenge. + * @param {string} otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMfaChallenge(challengeId: string, otp: string): Promise<Models.Session>; + updateMfaChallenge( + paramsOrFirst: { challengeId: string, otp: string } | string, + ...rest: [(string)?] + ): Promise<Models.Session> { + let params: { challengeId: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { challengeId: string, otp: string }; + } else { + params = { + challengeId: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const challengeId = params.challengeId; + const otp = params.otp; + + if (typeof challengeId === 'undefined') { + throw new AppwriteException('Missing required parameter: "challengeId"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/account/mfa/challenges'; + const payload: Payload = {}; + if (typeof challengeId !== 'undefined') { + payload['challengeId'] = challengeId; + } + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.challengeId - ID of the challenge. + * @param {string} params.otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + updateMFAChallenge(params: { challengeId: string, otp: string }): Promise<Models.Session>; + /** + * 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. + * + * @param {string} challengeId - ID of the challenge. + * @param {string} otp - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFAChallenge(challengeId: string, otp: string): Promise<Models.Session>; + updateMFAChallenge( + paramsOrFirst: { challengeId: string, otp: string } | string, + ...rest: [(string)?] + ): Promise<Models.Session> { + let params: { challengeId: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { challengeId: string, otp: string }; + } else { + params = { + challengeId: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const challengeId = params.challengeId; + const otp = params.otp; + + if (typeof challengeId === 'undefined') { + throw new AppwriteException('Missing required parameter: "challengeId"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/account/mfa/challenges'; + const payload: Payload = {}; + if (typeof challengeId !== 'undefined') { + payload['challengeId'] = challengeId; + } + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the factors available on the account to be used as a MFA challange. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.listMFAFactors` instead. + */ + listMfaFactors(): Promise<Models.MfaFactors> { + + const apiPath = '/account/mfa/factors'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the factors available on the account to be used as a MFA challange. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + */ + listMFAFactors(): Promise<Models.MfaFactors> { + + const apiPath = '/account/mfa/factors'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.getMFARecoveryCodes` instead. + */ + getMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> { + + const apiPath = '/account/mfa/recovery-codes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + getMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> { + + const apiPath = '/account/mfa/recovery-codes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createMFARecoveryCodes` instead. + */ + createMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> { + + const apiPath = '/account/mfa/recovery-codes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + createMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> { + + const apiPath = '/account/mfa/recovery-codes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateMFARecoveryCodes` instead. + */ + updateMfaRecoveryCodes(): Promise<Models.MfaRecoveryCodes> { + + const apiPath = '/account/mfa/recovery-codes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + updateMFARecoveryCodes(): Promise<Models.MfaRecoveryCodes> { + + const apiPath = '/account/mfa/recovery-codes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update currently logged in user account name. + * + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { name: string }): Promise<Models.User<Preferences>>; + /** + * Update currently logged in user account name. + * + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(name: string): Promise<Models.User<Preferences>>; + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { name: string } | string + ): Promise<Models.User<Preferences>> { + let params: { name: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { name: string }; + } else { + params = { + name: paramsOrFirst as string + }; + } + + const name = params.name; + + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/account/name'; + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.password - New user password. Must be at least 8 chars. + * @param {string} params.oldPassword - Current user password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { password: string, oldPassword?: string }): Promise<Models.User<Preferences>>; + /** + * 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. + * + * @param {string} password - New user password. Must be at least 8 chars. + * @param {string} oldPassword - Current user password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(password: string, oldPassword?: string): Promise<Models.User<Preferences>>; + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { password: string, oldPassword?: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { password: string, oldPassword?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { password: string, oldPassword?: string }; + } else { + params = { + password: paramsOrFirst as string, + oldPassword: rest[0] as string + }; + } + + const password = params.password; + const oldPassword = params.oldPassword; + + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/account/password'; + const payload: Payload = {}; + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof oldPassword !== 'undefined') { + payload['oldPassword'] = oldPassword; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.password - User password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { phone: string, password: string }): Promise<Models.User<Preferences>>; + /** + * 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. + * + * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} password - User password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(phone: string, password: string): Promise<Models.User<Preferences>>; + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { phone: string, password: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { phone: string, password: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { phone: string, password: string }; + } else { + params = { + phone: paramsOrFirst as string, + password: rest[0] as string + }; + } + + const phone = params.phone; + const password = params.password; + + if (typeof phone === 'undefined') { + throw new AppwriteException('Missing required parameter: "phone"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/account/phone'; + const payload: Payload = {}; + if (typeof phone !== 'undefined') { + payload['phone'] = phone; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the preferences as a key-value object for the currently logged in user. + * + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + */ + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Preferences> { + + const apiPath = '/account/prefs'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {Partial<Preferences>} params.prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { prefs: Partial<Preferences> }): Promise<Models.User<Preferences>>; + /** + * 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. + * + * @param {Partial<Preferences>} prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(prefs: Partial<Preferences>): Promise<Models.User<Preferences>>; + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { prefs: Partial<Preferences> } | Partial<Preferences> + ): Promise<Models.User<Preferences>> { + let params: { prefs: Partial<Preferences> }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('prefs' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { prefs: Partial<Preferences> }; + } else { + params = { + prefs: paramsOrFirst as Partial<Preferences> + }; + } + + const prefs = params.prefs; + + if (typeof prefs === 'undefined') { + throw new AppwriteException('Missing required parameter: "prefs"'); + } + + const apiPath = '/account/prefs'; + const payload: Payload = {}; + if (typeof prefs !== 'undefined') { + payload['prefs'] = prefs; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.email - User email. + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createRecovery(params: { email: string, url: string }): Promise<Models.Token>; + /** + * 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. + * + * @param {string} email - User email. + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRecovery(email: string, url: string): Promise<Models.Token>; + createRecovery( + paramsOrFirst: { email: string, url: string } | string, + ...rest: [(string)?] + ): Promise<Models.Token> { + let params: { email: string, url: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { email: string, url: string }; + } else { + params = { + email: paramsOrFirst as string, + url: rest[0] as string + }; + } + + const email = params.email; + const url = params.url; + + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + + const apiPath = '/account/recovery'; + const payload: Payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * 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. + * + * @param {string} params.userId - User ID. + * @param {string} params.secret - Valid reset token. + * @param {string} params.password - New user password. Must be between 8 and 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + updateRecovery(params: { userId: string, secret: string, password: string }): Promise<Models.Token>; + /** + * 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. + * + * 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. + * + * @param {string} userId - User ID. + * @param {string} secret - Valid reset token. + * @param {string} password - New user password. Must be between 8 and 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRecovery(userId: string, secret: string, password: string): Promise<Models.Token>; + updateRecovery( + paramsOrFirst: { userId: string, secret: string, password: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Token> { + let params: { userId: string, secret: string, password: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, secret: string, password: string }; + } else { + params = { + userId: paramsOrFirst as string, + secret: rest[0] as string, + password: rest[1] as string + }; + } + + const userId = params.userId; + const secret = params.secret; + const password = params.password; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/account/recovery'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the list of active sessions across different devices for the currently logged in user. + * + * @throws {AppwriteException} + * @returns {Promise<Models.SessionList>} + */ + listSessions(): Promise<Models.SessionList> { + + const apiPath = '/account/sessions'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete all sessions from the user account and remove any sessions cookies from the end client. + * + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSessions(): Promise<{}> { + + const apiPath = '/account/sessions'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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). + * + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + createAnonymousSession(): Promise<Models.Session> { + + const apiPath = '/account/sessions/anonymous'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * 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). + * + * @param {string} params.email - User email. + * @param {string} params.password - User password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + createEmailPasswordSession(params: { email: string, password: string }): Promise<Models.Session>; + /** + * 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. + * + * 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). + * + * @param {string} email - User email. + * @param {string} password - User password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmailPasswordSession(email: string, password: string): Promise<Models.Session>; + createEmailPasswordSession( + paramsOrFirst: { email: string, password: string } | string, + ...rest: [(string)?] + ): Promise<Models.Session> { + let params: { email: string, password: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { email: string, password: string }; + } else { + params = { + email: paramsOrFirst as string, + password: rest[0] as string + }; + } + + const email = params.email; + const password = params.password; + + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/account/sessions/email'; + const payload: Payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @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. + * @param {string} params.secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. + */ + updateMagicURLSession(params: { userId: string, secret: string }): Promise<Models.Session>; + /** + * 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. + * + * @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. + * @param {string} secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMagicURLSession(userId: string, secret: string): Promise<Models.Session>; + updateMagicURLSession( + paramsOrFirst: { userId: string, secret: string } | string, + ...rest: [(string)?] + ): Promise<Models.Session> { + let params: { userId: string, secret: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, secret: string }; + } else { + params = { + userId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const userId = params.userId; + const secret = params.secret; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + + const apiPath = '/account/sessions/magic-url'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @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. + * @param {string} params.secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated This API has been deprecated since 1.6.0. Please use `Account.createSession` instead. + */ + updatePhoneSession(params: { userId: string, secret: string }): Promise<Models.Session>; + /** + * 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. + * + * @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. + * @param {string} secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhoneSession(userId: string, secret: string): Promise<Models.Session>; + updatePhoneSession( + paramsOrFirst: { userId: string, secret: string } | string, + ...rest: [(string)?] + ): Promise<Models.Session> { + let params: { userId: string, secret: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, secret: string }; + } else { + params = { + userId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const userId = params.userId; + const secret = params.secret; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + + const apiPath = '/account/sessions/phone'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @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. + * @param {string} params.secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + createSession(params: { userId: string, secret: string }): Promise<Models.Session>; + /** + * 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. + * + * @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. + * @param {string} secret - Secret of a token generated by login methods. For example, the `createMagicURLToken` or `createPhoneToken` methods. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSession(userId: string, secret: string): Promise<Models.Session>; + createSession( + paramsOrFirst: { userId: string, secret: string } | string, + ...rest: [(string)?] + ): Promise<Models.Session> { + let params: { userId: string, secret: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, secret: string }; + } else { + params = { + userId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const userId = params.userId; + const secret = params.secret; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + + const apiPath = '/account/sessions/token'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + * + * @param {string} params.sessionId - Session ID. Use the string 'current' to get the current device session. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + getSession(params: { sessionId: string }): Promise<Models.Session>; + /** + * Use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used. + * + * @param {string} sessionId - Session ID. Use the string 'current' to get the current device session. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getSession(sessionId: string): Promise<Models.Session>; + getSession( + paramsOrFirst: { sessionId: string } | string + ): Promise<Models.Session> { + let params: { sessionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { sessionId: string }; + } else { + params = { + sessionId: paramsOrFirst as string + }; + } + + const sessionId = params.sessionId; + + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.sessionId - Session ID. Use the string 'current' to update the current device session. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + updateSession(params: { sessionId: string }): Promise<Models.Session>; + /** + * 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. + * + * @param {string} sessionId - Session ID. Use the string 'current' to update the current device session. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSession(sessionId: string): Promise<Models.Session>; + updateSession( + paramsOrFirst: { sessionId: string } | string + ): Promise<Models.Session> { + let params: { sessionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { sessionId: string }; + } else { + params = { + sessionId: paramsOrFirst as string + }; + } + + const sessionId = params.sessionId; + + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.sessionId - Session ID. Use the string 'current' to delete the current device session. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSession(params: { sessionId: string }): Promise<{}>; + /** + * 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. + * + * @param {string} sessionId - Session ID. Use the string 'current' to delete the current device session. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSession(sessionId: string): Promise<{}>; + deleteSession( + paramsOrFirst: { sessionId: string } | string + ): Promise<{}> { + let params: { sessionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { sessionId: string }; + } else { + params = { + sessionId: paramsOrFirst as string + }; + } + + const sessionId = params.sessionId; + + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + + const apiPath = '/account/sessions/{sessionId}'.replace('{sessionId}', sessionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(): Promise<Models.User<Preferences>> { + + const apiPath = '/account/status'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * 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). + * + * + * @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. + * @param {string} params.email - User email. + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createEmailToken(params: { userId: string, email: string, phrase?: boolean }): Promise<Models.Token>; + /** + * 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. + * + * 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). + * + * + * @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. + * @param {string} email - User email. + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmailToken(userId: string, email: string, phrase?: boolean): Promise<Models.Token>; + createEmailToken( + paramsOrFirst: { userId: string, email: string, phrase?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Token> { + let params: { userId: string, email: string, phrase?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, phrase?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + phrase: rest[1] as boolean + }; + } + + const userId = params.userId; + const email = params.email; + const phrase = params.phrase; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + + const apiPath = '/account/tokens/email'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof phrase !== 'undefined') { + payload['phrase'] = phrase; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * 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). + * + * + * @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. + * @param {string} params.email - User email. + * @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. + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createMagicURLToken(params: { userId: string, email: string, url?: string, phrase?: boolean }): Promise<Models.Token>; + /** + * 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. + * + * 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). + * + * + * @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. + * @param {string} email - User email. + * @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. + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMagicURLToken(userId: string, email: string, url?: string, phrase?: boolean): Promise<Models.Token>; + createMagicURLToken( + paramsOrFirst: { userId: string, email: string, url?: string, phrase?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.Token> { + let params: { userId: string, email: string, url?: string, phrase?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, url?: string, phrase?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + url: rest[1] as string, + phrase: rest[2] as boolean + }; + } + + const userId = params.userId; + const email = params.email; + const url = params.url; + const phrase = params.phrase; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + + const apiPath = '/account/tokens/magic-url'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof phrase !== 'undefined') { + payload['phrase'] = phrase; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * 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. + * + * 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). + * + * @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, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @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. + * @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. + * @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. + * @throws {AppwriteException} + * @returns {Promise<string>} + */ + createOAuth2Token(params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }): Promise<string>; + /** + * 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. + * + * 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. + * + * 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). + * + * @param {OAuthProvider} provider - OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom. + * @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. + * @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. + * @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. + * @throws {AppwriteException} + * @returns {Promise<string>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createOAuth2Token(provider: OAuthProvider, success?: string, failure?: string, scopes?: string[]): Promise<string>; + createOAuth2Token( + paramsOrFirst: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] } | OAuthProvider, + ...rest: [(string)?, (string)?, (string[])?] + ): Promise<string> { + let params: { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('provider' in paramsOrFirst || 'success' in paramsOrFirst || 'failure' in paramsOrFirst || 'scopes' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { provider: OAuthProvider, success?: string, failure?: string, scopes?: string[] }; + } else { + params = { + provider: paramsOrFirst as OAuthProvider, + success: rest[0] as string, + failure: rest[1] as string, + scopes: rest[2] as string[] + }; + } + + const provider = params.provider; + const success = params.success; + const failure = params.failure; + const scopes = params.scopes; + + if (typeof provider === 'undefined') { + throw new AppwriteException('Missing required parameter: "provider"'); + } + + const apiPath = '/account/tokens/oauth2/{provider}'.replace('{provider}', provider); + const payload: Payload = {}; + if (typeof success !== 'undefined') { + payload['success'] = success; + } + if (typeof failure !== 'undefined') { + payload['failure'] = failure; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.redirect( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * 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. + * + * 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). + * + * @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. + * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createPhoneToken(params: { userId: string, phone: string }): Promise<Models.Token>; + /** + * 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. + * + * 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). + * + * @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. + * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPhoneToken(userId: string, phone: string): Promise<Models.Token>; + createPhoneToken( + paramsOrFirst: { userId: string, phone: string } | string, + ...rest: [(string)?] + ): Promise<Models.Token> { + let params: { userId: string, phone: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, phone: string }; + } else { + params = { + userId: paramsOrFirst as string, + phone: rest[0] as string + }; + } + + const userId = params.userId; + const phone = params.phone; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof phone === 'undefined') { + throw new AppwriteException('Missing required parameter: "phone"'); + } + + const apiPath = '/account/tokens/phone'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof phone !== 'undefined') { + payload['phone'] = phone; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * 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. + * + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createEmailVerification(params: { url: string }): Promise<Models.Token>; + /** + * 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. + * + * 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. + * + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmailVerification(url: string): Promise<Models.Token>; + createEmailVerification( + paramsOrFirst: { url: string } | string + ): Promise<Models.Token> { + let params: { url: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { url: string }; + } else { + params = { + url: paramsOrFirst as string + }; + } + + const url = params.url; + + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + + const apiPath = '/account/verifications/email'; + const payload: Payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * 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. + * + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead. + */ + createVerification(params: { url: string }): Promise<Models.Token>; + /** + * 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. + * + * 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. + * + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVerification(url: string): Promise<Models.Token>; + createVerification( + paramsOrFirst: { url: string } | string + ): Promise<Models.Token> { + let params: { url: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { url: string }; + } else { + params = { + url: paramsOrFirst as string + }; + } + + const url = params.url; + + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + + const apiPath = '/account/verifications/email'; + const payload: Payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.userId - User ID. + * @param {string} params.secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + updateEmailVerification(params: { userId: string, secret: string }): Promise<Models.Token>; + /** + * 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. + * + * @param {string} userId - User ID. + * @param {string} secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailVerification(userId: string, secret: string): Promise<Models.Token>; + updateEmailVerification( + paramsOrFirst: { userId: string, secret: string } | string, + ...rest: [(string)?] + ): Promise<Models.Token> { + let params: { userId: string, secret: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, secret: string }; + } else { + params = { + userId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const userId = params.userId; + const secret = params.secret; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + + const apiPath = '/account/verifications/email'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.userId - User ID. + * @param {string} params.secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead. + */ + updateVerification(params: { userId: string, secret: string }): Promise<Models.Token>; + /** + * 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. + * + * @param {string} userId - User ID. + * @param {string} secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVerification(userId: string, secret: string): Promise<Models.Token>; + updateVerification( + paramsOrFirst: { userId: string, secret: string } | string, + ...rest: [(string)?] + ): Promise<Models.Token> { + let params: { userId: string, secret: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, secret: string }; + } else { + params = { + userId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const userId = params.userId; + const secret = params.secret; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + + const apiPath = '/account/verifications/email'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createPhoneVerification(): Promise<Models.Token> { + + const apiPath = '/account/verifications/phone'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * 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. + * + * @param {string} params.userId - User ID. + * @param {string} params.secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + updatePhoneVerification(params: { userId: string, secret: string }): Promise<Models.Token>; + /** + * 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. + * + * @param {string} userId - User ID. + * @param {string} secret - Valid verification token. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhoneVerification(userId: string, secret: string): Promise<Models.Token>; + updatePhoneVerification( + paramsOrFirst: { userId: string, secret: string } | string, + ...rest: [(string)?] + ): Promise<Models.Token> { + let params: { userId: string, secret: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, secret: string }; + } else { + params = { + userId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const userId = params.userId; + const secret = params.secret; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + + const apiPath = '/account/verifications/phone'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/activities.ts b/src/services/activities.ts new file mode 100644 index 00000000..64e79410 --- /dev/null +++ b/src/services/activities.ts @@ -0,0 +1,116 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Activities { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all events for selected filters. + * + * @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 attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEventList>} + */ + listEvents(params?: { queries?: string }): Promise<Models.ActivityEventList>; + /** + * List all events for selected filters. + * + * @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 attributes such as userId, teamId, etc. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEventList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listEvents(queries?: string): Promise<Models.ActivityEventList>; + listEvents( + paramsOrFirst?: { queries?: string } | string + ): Promise<Models.ActivityEventList> { + let params: { queries?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string }; + } else { + params = { + queries: paramsOrFirst as string + }; + } + + const queries = params.queries; + + + const apiPath = '/activities/events'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get event by ID. + * + * + * @param {string} params.eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEvent>} + */ + getEvent(params: { eventId: string }): Promise<Models.ActivityEvent>; + /** + * Get event by ID. + * + * + * @param {string} eventId - Event ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ActivityEvent>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getEvent(eventId: string): Promise<Models.ActivityEvent>; + getEvent( + paramsOrFirst: { eventId: string } | string + ): Promise<Models.ActivityEvent> { + let params: { eventId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { eventId: string }; + } else { + params = { + eventId: paramsOrFirst as string + }; + } + + const eventId = params.eventId; + + if (typeof eventId === 'undefined') { + throw new AppwriteException('Missing required parameter: "eventId"'); + } + + const apiPath = '/activities/events/{eventId}'.replace('{eventId}', eventId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/advisor.ts b/src/services/advisor.ts new file mode 100644 index 00000000..02587b99 --- /dev/null +++ b/src/services/advisor.ts @@ -0,0 +1,309 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Advisor { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's analyzer reports. You can use the query params to filter your results. + * + * + * @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: appId, type, targetType, target, analyzedAt + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ReportList>} + */ + listReports(params?: { queries?: string[], total?: boolean }): Promise<Models.ReportList>; + /** + * Get a list of all the project's analyzer reports. You can use the query params to filter your results. + * + * + * @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: appId, type, targetType, target, analyzedAt + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ReportList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listReports(queries?: string[], total?: boolean): Promise<Models.ReportList>; + listReports( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.ReportList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/reports'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. + * + * + * @param {string} params.reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Report>} + */ + getReport(params: { reportId: string }): Promise<Models.Report>; + /** + * Get an analyzer report by its unique ID. The response includes the report's metadata and the nested insights it produced. + * + * + * @param {string} reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Report>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getReport(reportId: string): Promise<Models.Report>; + getReport( + paramsOrFirst: { reportId: string } | string + ): Promise<Models.Report> { + let params: { reportId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string }; + } else { + params = { + reportId: paramsOrFirst as string + }; + } + + const reportId = params.reportId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. + * + * + * @param {string} params.reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteReport(params: { reportId: string }): Promise<{}>; + /** + * Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker. + * + * + * @param {string} reportId - Report ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteReport(reportId: string): Promise<{}>; + deleteReport( + paramsOrFirst: { reportId: string } | string + ): Promise<{}> { + let params: { reportId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string }; + } else { + params = { + reportId: paramsOrFirst as string + }; + } + + const reportId = params.reportId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}'.replace('{reportId}', reportId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the insights produced under a single analyzer report. You can use the query params to filter your results further. + * + * + * @param {string} params.reportId - Parent report ID. + * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.InsightList>} + */ + listInsights(params: { reportId: string, queries?: string[], total?: boolean }): Promise<Models.InsightList>; + /** + * List the insights produced under a single analyzer report. You can use the query params to filter your results further. + * + * + * @param {string} reportId - Parent report ID. + * @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: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.InsightList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listInsights(reportId: string, queries?: string[], total?: boolean): Promise<Models.InsightList>; + listInsights( + paramsOrFirst: { reportId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.InsightList> { + let params: { reportId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string, queries?: string[], total?: boolean }; + } else { + params = { + reportId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const reportId = params.reportId; + const queries = params.queries; + const total = params.total; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + + const apiPath = '/reports/{reportId}/insights'.replace('{reportId}', reportId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an insight by its unique ID, scoped to its parent report. + * + * + * @param {string} params.reportId - Parent report ID. + * @param {string} params.insightId - Insight ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Insight>} + */ + getInsight(params: { reportId: string, insightId: string }): Promise<Models.Insight>; + /** + * Get an insight by its unique ID, scoped to its parent report. + * + * + * @param {string} reportId - Parent report ID. + * @param {string} insightId - Insight ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Insight>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInsight(reportId: string, insightId: string): Promise<Models.Insight>; + getInsight( + paramsOrFirst: { reportId: string, insightId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Insight> { + let params: { reportId: string, insightId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { reportId: string, insightId: string }; + } else { + params = { + reportId: paramsOrFirst as string, + insightId: rest[0] as string + }; + } + + const reportId = params.reportId; + const insightId = params.insightId; + + if (typeof reportId === 'undefined') { + throw new AppwriteException('Missing required parameter: "reportId"'); + } + if (typeof insightId === 'undefined') { + throw new AppwriteException('Missing required parameter: "insightId"'); + } + + const apiPath = '/reports/{reportId}/insights/{insightId}'.replace('{reportId}', reportId).replace('{insightId}', insightId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/avatars.ts b/src/services/avatars.ts new file mode 100644 index 00000000..37ed3bd3 --- /dev/null +++ b/src/services/avatars.ts @@ -0,0 +1,754 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { Browser } from '../enums/browser'; +import { CreditCard } from '../enums/credit-card'; +import { Flag } from '../enums/flag'; +import { Theme } from '../enums/theme'; +import { Timezone } from '../enums/timezone'; +import { BrowserPermission } from '../enums/browser-permission'; +import { ImageFormat } from '../enums/image-format'; + +export class Avatars { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * @param {Browser} params.code - Browser Code. + * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getBrowser(params: { code: Browser, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>; + /** + * You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user [GET /account/sessions](https://appwrite.io/docs/references/cloud/client-web/account#getSessions) endpoint. Use width, height and quality arguments to change the output settings. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * @param {Browser} code - Browser Code. + * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBrowser(code: Browser, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>; + getBrowser( + paramsOrFirst: { code: Browser, width?: number, height?: number, quality?: number } | Browser, + ...rest: [(number)?, (number)?, (number)?] + ): Promise<ArrayBuffer> { + let params: { code: Browser, width?: number, height?: number, quality?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { code: Browser, width?: number, height?: number, quality?: number }; + } else { + params = { + code: paramsOrFirst as Browser, + width: rest[0] as number, + height: rest[1] as number, + quality: rest[2] as number + }; + } + + const code = params.code; + const width = params.width; + const height = params.height; + const quality = params.quality; + + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + + const apiPath = '/avatars/browsers/{code}'.replace('{code}', code); + const payload: Payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * + * @param {CreditCard} params.code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. + * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getCreditCard(params: { code: CreditCard, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>; + /** + * The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * + * @param {CreditCard} code - Credit Card Code. Possible values: amex, argencard, cabal, cencosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, unionpay, visa, mir, maestro, rupay. + * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getCreditCard(code: CreditCard, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>; + getCreditCard( + paramsOrFirst: { code: CreditCard, width?: number, height?: number, quality?: number } | CreditCard, + ...rest: [(number)?, (number)?, (number)?] + ): Promise<ArrayBuffer> { + let params: { code: CreditCard, width?: number, height?: number, quality?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { code: CreditCard, width?: number, height?: number, quality?: number }; + } else { + params = { + code: paramsOrFirst as CreditCard, + width: rest[0] as number, + height: rest[1] as number, + quality: rest[2] as number + }; + } + + const code = params.code; + const width = params.width; + const height = params.height; + const quality = params.quality; + + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + + const apiPath = '/avatars/credit-cards/{code}'.replace('{code}', code); + const payload: Payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. + * + * This endpoint does not follow HTTP redirects. + * + * @param {string} params.url - Website URL which you want to fetch the favicon from. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getFavicon(params: { url: string }): Promise<ArrayBuffer>; + /** + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. + * + * This endpoint does not follow HTTP redirects. + * + * @param {string} url - Website URL which you want to fetch the favicon from. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFavicon(url: string): Promise<ArrayBuffer>; + getFavicon( + paramsOrFirst: { url: string } | string + ): Promise<ArrayBuffer> { + let params: { url: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { url: string }; + } else { + params = { + url: paramsOrFirst as string + }; + } + + const url = params.url; + + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + + const apiPath = '/avatars/favicon'; + const payload: Payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * + * @param {Flag} params.code - Country Code. ISO Alpha-2 country code format. + * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} params.quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getFlag(params: { code: Flag, width?: number, height?: number, quality?: number }): Promise<ArrayBuffer>; + /** + * You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * + * @param {Flag} code - Country Code. ISO Alpha-2 country code format. + * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} quality - Image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFlag(code: Flag, width?: number, height?: number, quality?: number): Promise<ArrayBuffer>; + getFlag( + paramsOrFirst: { code: Flag, width?: number, height?: number, quality?: number } | Flag, + ...rest: [(number)?, (number)?, (number)?] + ): Promise<ArrayBuffer> { + let params: { code: Flag, width?: number, height?: number, quality?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('code' in paramsOrFirst || 'width' in paramsOrFirst || 'height' in paramsOrFirst || 'quality' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { code: Flag, width?: number, height?: number, quality?: number }; + } else { + params = { + code: paramsOrFirst as Flag, + width: rest[0] as number, + height: rest[1] as number, + quality: rest[2] as number + }; + } + + const code = params.code; + const width = params.width; + const height = params.height; + const quality = params.quality; + + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + + const apiPath = '/avatars/flags/{code}'.replace('{code}', code); + const payload: Payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. + * + * This endpoint does not follow HTTP redirects. + * + * @param {string} params.url - Image URL which you want to crop. + * @param {number} params.width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. + * @param {number} params.height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getImage(params: { url: string, width?: number, height?: number }): Promise<ArrayBuffer>; + /** + * Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 400x400px. + * + * This endpoint does not follow HTTP redirects. + * + * @param {string} url - Image URL which you want to crop. + * @param {number} width - Resize preview image width, Pass an integer between 0 to 2000. Defaults to 400. + * @param {number} height - Resize preview image height, Pass an integer between 0 to 2000. Defaults to 400. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getImage(url: string, width?: number, height?: number): Promise<ArrayBuffer>; + getImage( + paramsOrFirst: { url: string, width?: number, height?: number } | string, + ...rest: [(number)?, (number)?] + ): Promise<ArrayBuffer> { + let params: { url: string, width?: number, height?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { url: string, width?: number, height?: number }; + } else { + params = { + url: paramsOrFirst as string, + width: rest[0] as number, + height: rest[1] as number + }; + } + + const url = params.url; + const width = params.width; + const height = params.height; + + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + + const apiPath = '/avatars/image'; + const payload: Payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. + * + * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * + * @param {string} params.name - Full Name. When empty, current user name or email will be used. Max length: 128 chars. + * @param {number} params.width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} params.height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {string} params.background - Changes background color. By default a random color will be picked and stay will persistent to the given name. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getInitials(params?: { name?: string, width?: number, height?: number, background?: string }): Promise<ArrayBuffer>; + /** + * Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. + * + * You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. + * + * When one dimension is specified and the other is 0, the image is scaled with preserved aspect ratio. If both dimensions are 0, the API provides an image at source quality. If dimensions are not specified, the default size of image returned is 100x100px. + * + * + * @param {string} name - Full Name. When empty, current user name or email will be used. Max length: 128 chars. + * @param {number} width - Image width. Pass an integer between 0 to 2000. Defaults to 100. + * @param {number} height - Image height. Pass an integer between 0 to 2000. Defaults to 100. + * @param {string} background - Changes background color. By default a random color will be picked and stay will persistent to the given name. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getInitials(name?: string, width?: number, height?: number, background?: string): Promise<ArrayBuffer>; + getInitials( + paramsOrFirst?: { name?: string, width?: number, height?: number, background?: string } | string, + ...rest: [(number)?, (number)?, (string)?] + ): Promise<ArrayBuffer> { + let params: { name?: string, width?: number, height?: number, background?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { name?: string, width?: number, height?: number, background?: string }; + } else { + params = { + name: paramsOrFirst as string, + width: rest[0] as number, + height: rest[1] as number, + background: rest[2] as string + }; + } + + const name = params.name; + const width = params.width; + const height = params.height; + const background = params.background; + + + const apiPath = '/avatars/initials'; + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof background !== 'undefined') { + payload['background'] = background; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + * + * + * @param {string} params.text - Plain text to be converted to QR code image. + * @param {number} params.size - QR code size. Pass an integer between 1 to 1000. Defaults to 400. + * @param {number} params.margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1. + * @param {boolean} params.download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getQR(params: { text: string, size?: number, margin?: number, download?: boolean }): Promise<ArrayBuffer>; + /** + * Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image. + * + * + * @param {string} text - Plain text to be converted to QR code image. + * @param {number} size - QR code size. Pass an integer between 1 to 1000. Defaults to 400. + * @param {number} margin - Margin from edge. Pass an integer between 0 to 10. Defaults to 1. + * @param {boolean} download - Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQR(text: string, size?: number, margin?: number, download?: boolean): Promise<ArrayBuffer>; + getQR( + paramsOrFirst: { text: string, size?: number, margin?: number, download?: boolean } | string, + ...rest: [(number)?, (number)?, (boolean)?] + ): Promise<ArrayBuffer> { + let params: { text: string, size?: number, margin?: number, download?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { text: string, size?: number, margin?: number, download?: boolean }; + } else { + params = { + text: paramsOrFirst as string, + size: rest[0] as number, + margin: rest[1] as number, + download: rest[2] as boolean + }; + } + + const text = params.text; + const size = params.size; + const margin = params.margin; + const download = params.download; + + if (typeof text === 'undefined') { + throw new AppwriteException('Missing required parameter: "text"'); + } + + const apiPath = '/avatars/qr'; + const payload: Payload = {}; + if (typeof text !== 'undefined') { + payload['text'] = text; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof margin !== 'undefined') { + payload['margin'] = margin; + } + if (typeof download !== 'undefined') { + payload['download'] = download; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. + * + * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll. + * + * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. + * + * @param {string} params.url - Website URL which you want to capture. + * @param {object} params.headers - HTTP headers to send with the browser request. Defaults to empty. + * @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. + * @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. + * @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. + * @param {Theme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light". + * @param {string} params.userAgent - Custom user agent string. Defaults to browser default. + * @param {boolean} params.fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. + * @param {string} params.locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. + * @param {Timezone} params.timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. + * @param {number} params.latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. + * @param {number} params.longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. + * @param {number} params.accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. + * @param {boolean} params.touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. + * @param {BrowserPermission[]} params.permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. + * @param {number} params.sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. + * @param {number} params.width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). + * @param {number} params.height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). + * @param {number} params.quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp). + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): Promise<ArrayBuffer>; + /** + * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. + * + * You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll. + * + * When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px. + * + * @param {string} url - Website URL which you want to capture. + * @param {object} headers - HTTP headers to send with the browser request. Defaults to empty. + * @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. + * @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. + * @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. + * @param {Theme} theme - Browser theme. Pass "light" or "dark". Defaults to "light". + * @param {string} userAgent - Custom user agent string. Defaults to browser default. + * @param {boolean} fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. + * @param {string} locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. + * @param {Timezone} timezone - IANA timezone identifier (e.g., "America/New_York", "Europe/London"). Defaults to browser default. + * @param {number} latitude - Geolocation latitude. Pass a number between -90 to 90. Defaults to 0. + * @param {number} longitude - Geolocation longitude. Pass a number between -180 to 180. Defaults to 0. + * @param {number} accuracy - Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0. + * @param {boolean} touch - Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0. + * @param {BrowserPermission[]} permissions - Browser permissions to grant. Pass an array of permission names like ["geolocation", "camera", "microphone"]. Defaults to empty. + * @param {number} sleep - Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0. + * @param {number} width - Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width). + * @param {number} height - Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height). + * @param {number} quality - Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp). + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): Promise<ArrayBuffer>; + getScreenshot( + paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, + ...rest: [(object)?, (number)?, (number)?, (number)?, (Theme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] + ): Promise<ArrayBuffer> { + let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; + } else { + params = { + url: paramsOrFirst as string, + headers: rest[0] as object, + viewportWidth: rest[1] as number, + viewportHeight: rest[2] as number, + scale: rest[3] as number, + theme: rest[4] as Theme, + userAgent: rest[5] as string, + fullpage: rest[6] as boolean, + locale: rest[7] as string, + timezone: rest[8] as Timezone, + latitude: rest[9] as number, + longitude: rest[10] as number, + accuracy: rest[11] as number, + touch: rest[12] as boolean, + permissions: rest[13] as BrowserPermission[], + sleep: rest[14] as number, + width: rest[15] as number, + height: rest[16] as number, + quality: rest[17] as number, + output: rest[18] as ImageFormat + }; + } + + const url = params.url; + const headers = params.headers; + const viewportWidth = params.viewportWidth; + const viewportHeight = params.viewportHeight; + const scale = params.scale; + const theme = params.theme; + const userAgent = params.userAgent; + const fullpage = params.fullpage; + const locale = params.locale; + const timezone = params.timezone; + const latitude = params.latitude; + const longitude = params.longitude; + const accuracy = params.accuracy; + const touch = params.touch; + const permissions = params.permissions; + const sleep = params.sleep; + const width = params.width; + const height = params.height; + const quality = params.quality; + const output = params.output; + + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + + const apiPath = '/avatars/screenshots'; + const payload: Payload = {}; + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof headers !== 'undefined') { + payload['headers'] = headers; + } + if (typeof viewportWidth !== 'undefined') { + payload['viewportWidth'] = viewportWidth; + } + if (typeof viewportHeight !== 'undefined') { + payload['viewportHeight'] = viewportHeight; + } + if (typeof scale !== 'undefined') { + payload['scale'] = scale; + } + if (typeof theme !== 'undefined') { + payload['theme'] = theme; + } + if (typeof userAgent !== 'undefined') { + payload['userAgent'] = userAgent; + } + if (typeof fullpage !== 'undefined') { + payload['fullpage'] = fullpage; + } + if (typeof locale !== 'undefined') { + payload['locale'] = locale; + } + if (typeof timezone !== 'undefined') { + payload['timezone'] = timezone; + } + if (typeof latitude !== 'undefined') { + payload['latitude'] = latitude; + } + if (typeof longitude !== 'undefined') { + payload['longitude'] = longitude; + } + if (typeof accuracy !== 'undefined') { + payload['accuracy'] = accuracy; + } + if (typeof touch !== 'undefined') { + payload['touch'] = touch; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof sleep !== 'undefined') { + payload['sleep'] = sleep; + } + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + if (typeof output !== 'undefined') { + payload['output'] = output; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } +} diff --git a/src/services/backups.ts b/src/services/backups.ts new file mode 100644 index 00000000..ef8dbc03 --- /dev/null +++ b/src/services/backups.ts @@ -0,0 +1,754 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { BackupServices } from '../enums/backup-services'; + +export class Backups { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all archives for a project. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchiveList>} + */ + listArchives(params?: { queries?: string[] }): Promise<Models.BackupArchiveList>; + /** + * List all archives for a project. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchiveList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listArchives(queries?: string[]): Promise<Models.BackupArchiveList>; + listArchives( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.BackupArchiveList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/backups/archives'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new archive asynchronously for a project. + * + * @param {BackupServices[]} params.services - Array of services to backup + * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + */ + createArchive(params: { services: BackupServices[], resourceId?: string }): Promise<Models.BackupArchive>; + /** + * Create a new archive asynchronously for a project. + * + * @param {BackupServices[]} services - Array of services to backup + * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createArchive(services: BackupServices[], resourceId?: string): Promise<Models.BackupArchive>; + createArchive( + paramsOrFirst: { services: BackupServices[], resourceId?: string } | BackupServices[], + ...rest: [(string)?] + ): Promise<Models.BackupArchive> { + let params: { services: BackupServices[], resourceId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('services' in paramsOrFirst || 'resourceId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { services: BackupServices[], resourceId?: string }; + } else { + params = { + services: paramsOrFirst as BackupServices[], + resourceId: rest[0] as string + }; + } + + const services = params.services; + const resourceId = params.resourceId; + + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + + const apiPath = '/backups/archives'; + const payload: Payload = {}; + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a backup archive using it's ID. + * + * @param {string} params.archiveId - Archive ID. Choose a custom ID`. 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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + */ + getArchive(params: { archiveId: string }): Promise<Models.BackupArchive>; + /** + * Get a backup archive using it's ID. + * + * @param {string} archiveId - Archive ID. Choose a custom ID`. 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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupArchive>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getArchive(archiveId: string): Promise<Models.BackupArchive>; + getArchive( + paramsOrFirst: { archiveId: string } | string + ): Promise<Models.BackupArchive> { + let params: { archiveId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { archiveId: string }; + } else { + params = { + archiveId: paramsOrFirst as string + }; + } + + const archiveId = params.archiveId; + + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + + const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an existing archive for a project. + * + * @param {string} params.archiveId - Policy 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. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteArchive(params: { archiveId: string }): Promise<{}>; + /** + * Delete an existing archive for a project. + * + * @param {string} archiveId - Policy 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. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteArchive(archiveId: string): Promise<{}>; + deleteArchive( + paramsOrFirst: { archiveId: string } | string + ): Promise<{}> { + let params: { archiveId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { archiveId: string }; + } else { + params = { + archiveId: paramsOrFirst as string + }; + } + + const archiveId = params.archiveId; + + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + + const apiPath = '/backups/archives/{archiveId}'.replace('{archiveId}', archiveId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List all policies for a project. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicyList>} + */ + listPolicies(params?: { queries?: string[] }): Promise<Models.BackupPolicyList>; + /** + * List all policies for a project. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicyList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listPolicies(queries?: string[]): Promise<Models.BackupPolicyList>; + listPolicies( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.BackupPolicyList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/backups/policies'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new backup policy. + * + * @param {string} params.policyId - Policy 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. + * @param {BackupServices[]} params.services - Array of services to backup + * @param {number} params.retention - Days to keep backups before deletion + * @param {string} params.schedule - Schedule CRON syntax. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {string} params.resourceId - Resource ID. When set, only this single resource will be backed up. + * @param {boolean} params.enabled - Is policy enabled? When set to 'disabled', no backups will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + */ + createPolicy(params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; + /** + * Create a new backup policy. + * + * @param {string} policyId - Policy 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. + * @param {BackupServices[]} services - Array of services to backup + * @param {number} retention - Days to keep backups before deletion + * @param {string} schedule - Schedule CRON syntax. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {string} resourceId - Resource ID. When set, only this single resource will be backed up. + * @param {boolean} enabled - Is policy enabled? When set to 'disabled', no backups will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolicy(policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean): Promise<Models.BackupPolicy>; + createPolicy( + paramsOrFirst: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean } | string, + ...rest: [(BackupServices[])?, (number)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.BackupPolicy> { + let params: { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string, services: BackupServices[], retention: number, schedule: string, name?: string, resourceId?: string, enabled?: boolean }; + } else { + params = { + policyId: paramsOrFirst as string, + services: rest[0] as BackupServices[], + retention: rest[1] as number, + schedule: rest[2] as string, + name: rest[3] as string, + resourceId: rest[4] as string, + enabled: rest[5] as boolean + }; + } + + const policyId = params.policyId; + const services = params.services; + const retention = params.retention; + const schedule = params.schedule; + const name = params.name; + const resourceId = params.resourceId; + const enabled = params.enabled; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + if (typeof retention === 'undefined') { + throw new AppwriteException('Missing required parameter: "retention"'); + } + if (typeof schedule === 'undefined') { + throw new AppwriteException('Missing required parameter: "schedule"'); + } + + const apiPath = '/backups/policies'; + const payload: Payload = {}; + if (typeof policyId !== 'undefined') { + payload['policyId'] = policyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof retention !== 'undefined') { + payload['retention'] = retention; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a backup policy using it's ID. + * + * @param {string} params.policyId - Policy ID. Choose a custom ID`. 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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + */ + getPolicy(params: { policyId: string }): Promise<Models.BackupPolicy>; + /** + * Get a backup policy using it's ID. + * + * @param {string} policyId - Policy ID. Choose a custom ID`. 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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPolicy(policyId: string): Promise<Models.BackupPolicy>; + getPolicy( + paramsOrFirst: { policyId: string } | string + ): Promise<Models.BackupPolicy> { + let params: { policyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string }; + } else { + params = { + policyId: paramsOrFirst as string + }; + } + + const policyId = params.policyId; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an existing policy using it's ID. + * + * @param {string} params.policyId - Policy ID. Choose a custom ID`. 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. + * @param {string} params.name - Policy name. Max length: 128 chars. + * @param {number} params.retention - Days to keep backups before deletion + * @param {string} params.schedule - Cron expression + * @param {boolean} params.enabled - Is Backup enabled? When set to 'disabled', No backup will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + */ + updatePolicy(params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }): Promise<Models.BackupPolicy>; + /** + * Update an existing policy using it's ID. + * + * @param {string} policyId - Policy ID. Choose a custom ID`. 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. + * @param {string} name - Policy name. Max length: 128 chars. + * @param {number} retention - Days to keep backups before deletion + * @param {string} schedule - Cron expression + * @param {boolean} enabled - Is Backup enabled? When set to 'disabled', No backup will be taken + * @throws {AppwriteException} + * @returns {Promise<Models.BackupPolicy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolicy(policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean): Promise<Models.BackupPolicy>; + updatePolicy( + paramsOrFirst: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean } | string, + ...rest: [(string)?, (number)?, (string)?, (boolean)?] + ): Promise<Models.BackupPolicy> { + let params: { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string, name?: string, retention?: number, schedule?: string, enabled?: boolean }; + } else { + params = { + policyId: paramsOrFirst as string, + name: rest[0] as string, + retention: rest[1] as number, + schedule: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const policyId = params.policyId; + const name = params.name; + const retention = params.retention; + const schedule = params.schedule; + const enabled = params.enabled; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof retention !== 'undefined') { + payload['retention'] = retention; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a policy using it's ID. + * + * @param {string} params.policyId - Policy 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. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deletePolicy(params: { policyId: string }): Promise<{}>; + /** + * Delete a policy using it's ID. + * + * @param {string} policyId - Policy 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. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deletePolicy(policyId: string): Promise<{}>; + deletePolicy( + paramsOrFirst: { policyId: string } | string + ): Promise<{}> { + let params: { policyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: string }; + } else { + params = { + policyId: paramsOrFirst as string + }; + } + + const policyId = params.policyId; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/backups/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create and trigger a new restoration for a backup on a project. + * + * @param {string} params.archiveId - Backup archive ID to restore + * @param {BackupServices[]} params.services - Array of services to restore + * @param {string} params.newResourceId - 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. + * @param {string} params.newResourceName - Database name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + */ + createRestoration(params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }): Promise<Models.BackupRestoration>; + /** + * Create and trigger a new restoration for a backup on a project. + * + * @param {string} archiveId - Backup archive ID to restore + * @param {BackupServices[]} services - Array of services to restore + * @param {string} newResourceId - 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. + * @param {string} newResourceName - Database name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRestoration(archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string): Promise<Models.BackupRestoration>; + createRestoration( + paramsOrFirst: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string } | string, + ...rest: [(BackupServices[])?, (string)?, (string)?] + ): Promise<Models.BackupRestoration> { + let params: { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { archiveId: string, services: BackupServices[], newResourceId?: string, newResourceName?: string }; + } else { + params = { + archiveId: paramsOrFirst as string, + services: rest[0] as BackupServices[], + newResourceId: rest[1] as string, + newResourceName: rest[2] as string + }; + } + + const archiveId = params.archiveId; + const services = params.services; + const newResourceId = params.newResourceId; + const newResourceName = params.newResourceName; + + if (typeof archiveId === 'undefined') { + throw new AppwriteException('Missing required parameter: "archiveId"'); + } + if (typeof services === 'undefined') { + throw new AppwriteException('Missing required parameter: "services"'); + } + + const apiPath = '/backups/restoration'; + const payload: Payload = {}; + if (typeof archiveId !== 'undefined') { + payload['archiveId'] = archiveId; + } + if (typeof services !== 'undefined') { + payload['services'] = services; + } + if (typeof newResourceId !== 'undefined') { + payload['newResourceId'] = newResourceId; + } + if (typeof newResourceName !== 'undefined') { + payload['newResourceName'] = newResourceName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * List all backup restorations for a project. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestorationList>} + */ + listRestorations(params?: { queries?: string[] }): Promise<Models.BackupRestorationList>; + /** + * List all backup restorations for a project. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestorationList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRestorations(queries?: string[]): Promise<Models.BackupRestorationList>; + listRestorations( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.BackupRestorationList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/backups/restorations'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the current status of a backup restoration. + * + * @param {string} params.restorationId - Restoration ID. Choose a custom ID`. 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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + */ + getRestoration(params: { restorationId: string }): Promise<Models.BackupRestoration>; + /** + * Get the current status of a backup restoration. + * + * @param {string} restorationId - Restoration ID. Choose a custom ID`. 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. + * @throws {AppwriteException} + * @returns {Promise<Models.BackupRestoration>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRestoration(restorationId: string): Promise<Models.BackupRestoration>; + getRestoration( + paramsOrFirst: { restorationId: string } | string + ): Promise<Models.BackupRestoration> { + let params: { restorationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { restorationId: string }; + } else { + params = { + restorationId: paramsOrFirst as string + }; + } + + const restorationId = params.restorationId; + + if (typeof restorationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "restorationId"'); + } + + const apiPath = '/backups/restorations/{restorationId}'.replace('{restorationId}', restorationId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/databases.ts b/src/services/databases.ts new file mode 100644 index 00000000..9a2e744c --- /dev/null +++ b/src/services/databases.ts @@ -0,0 +1,6224 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { RelationshipType } from '../enums/relationship-type'; +import { RelationMutate } from '../enums/relation-mutate'; +import { DatabasesIndexType } from '../enums/databases-index-type'; +import { OrderBy } from '../enums/order-by'; + +export class Databases { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + * + * @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: name + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.list` instead. + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + * + * @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: name + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.DatabaseList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/databases'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Database. + * + * + * @param {string} params.databaseId - 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. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.create` instead. + */ + create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; + /** + * Create a new Database. + * + * + * @param {string} databaseId - 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. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; + create( + paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/databases'; + const payload: Payload = {}; + if (typeof databaseId !== 'undefined') { + payload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * List transactions across all databases. + * + * @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). + * @throws {AppwriteException} + * @returns {Promise<Models.TransactionList>} + */ + listTransactions(params?: { queries?: string[] }): Promise<Models.TransactionList>; + /** + * List transactions across all databases. + * + * @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). + * @throws {AppwriteException} + * @returns {Promise<Models.TransactionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTransactions(queries?: string[]): Promise<Models.TransactionList>; + listTransactions( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.TransactionList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/databases/transactions'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new transaction. + * + * @param {number} params.ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + createTransaction(params?: { ttl?: number }): Promise<Models.Transaction>; + /** + * Create a new transaction. + * + * @param {number} ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTransaction(ttl?: number): Promise<Models.Transaction>; + createTransaction( + paramsOrFirst?: { ttl?: number } | number + ): Promise<Models.Transaction> { + let params: { ttl?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ttl?: number }; + } else { + params = { + ttl: paramsOrFirst as number + }; + } + + const ttl = params.ttl; + + + const apiPath = '/databases/transactions'; + const payload: Payload = {}; + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a transaction by its unique ID. + * + * @param {string} params.transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + getTransaction(params: { transactionId: string }): Promise<Models.Transaction>; + /** + * Get a transaction by its unique ID. + * + * @param {string} transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTransaction(transactionId: string): Promise<Models.Transaction>; + getTransaction( + paramsOrFirst: { transactionId: string } | string + ): Promise<Models.Transaction> { + let params: { transactionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string }; + } else { + params = { + transactionId: paramsOrFirst as string + }; + } + + const transactionId = params.transactionId; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} params.transactionId - Transaction ID. + * @param {boolean} params.commit - Commit transaction? + * @param {boolean} params.rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise<Models.Transaction>; + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} transactionId - Transaction ID. + * @param {boolean} commit - Commit transaction? + * @param {boolean} rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>; + updateTransaction( + paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, + ...rest: [(boolean)?, (boolean)?] + ): Promise<Models.Transaction> { + let params: { transactionId: string, commit?: boolean, rollback?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean }; + } else { + params = { + transactionId: paramsOrFirst as string, + commit: rest[0] as boolean, + rollback: rest[1] as boolean + }; + } + + const transactionId = params.transactionId; + const commit = params.commit; + const rollback = params.rollback; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + if (typeof commit !== 'undefined') { + payload['commit'] = commit; + } + if (typeof rollback !== 'undefined') { + payload['rollback'] = rollback; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a transaction by its unique ID. + * + * @param {string} params.transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTransaction(params: { transactionId: string }): Promise<{}>; + /** + * Delete a transaction by its unique ID. + * + * @param {string} transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTransaction(transactionId: string): Promise<{}>; + deleteTransaction( + paramsOrFirst: { transactionId: string } | string + ): Promise<{}> { + let params: { transactionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string }; + } else { + params = { + transactionId: paramsOrFirst as string + }; + } + + const transactionId = params.transactionId; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create multiple operations in a single transaction. + * + * @param {string} params.transactionId - Transaction ID. + * @param {object[]} params.operations - Array of staged operations. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; + /** + * Create multiple operations in a single transaction. + * + * @param {string} transactionId - Transaction ID. + * @param {object[]} operations - Array of staged operations. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>; + createOperations( + paramsOrFirst: { transactionId: string, operations?: object[] } | string, + ...rest: [(object[])?] + ): Promise<Models.Transaction> { + let params: { transactionId: string, operations?: object[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; + } else { + params = { + transactionId: paramsOrFirst as string, + operations: rest[0] as object[] + }; + } + + const transactionId = params.transactionId; + const operations = params.operations; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/databases/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + if (typeof operations !== 'undefined') { + payload['operations'] = operations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. + */ + get(params: { databaseId: string }): Promise<Models.Database>; + /** + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise<Models.Database>; + get( + paramsOrFirst: { databaseId: string } | string + ): Promise<Models.Database> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a database by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.update` instead. + */ + update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; + /** + * Update a database by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; + update( + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.delete` instead. + */ + delete(params: { databaseId: string }): Promise<{}>; + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(databaseId: string): Promise<{}>; + delete( + paramsOrFirst: { databaseId: string } | string + ): Promise<{}> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @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: name, enabled, documentSecurity + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.CollectionList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. + */ + listCollections(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; + /** + * Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} databaseId - Database ID. + * @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: name, enabled, documentSecurity + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.CollectionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listCollections(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.CollectionList>; + listCollections( + paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.CollectionList> { + let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - 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. + * @param {string} params.name - Collection name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {object[]} params.attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. + */ + createCollection(params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise<Models.Collection>; + /** + * Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - 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. + * @param {string} name - Collection name. Max length: 128 chars. + * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {object[]} attributes - Array of attribute definitions to create. Each attribute should contain: key (string), type (string: string, integer, float, boolean, datetime), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of attribute keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[]): Promise<Models.Collection>; + createCollection( + paramsOrFirst: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] + ): Promise<Models.Collection> { + let params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + documentSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + attributes: rest[5] as object[], + indexes: rest[6] as object[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const name = params.name; + const permissions = params.permissions; + const documentSecurity = params.documentSecurity; + const enabled = params.enabled; + const attributes = params.attributes; + const indexes = params.indexes; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof collectionId !== 'undefined') { + payload['collectionId'] = collectionId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + payload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof attributes !== 'undefined') { + payload['attributes'] = attributes; + } + if (typeof indexes !== 'undefined') { + payload['indexes'] = indexes; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getTable` instead. + */ + getCollection(params: { databaseId: string, collectionId: string }): Promise<Models.Collection>; + /** + * Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getCollection(databaseId: string, collectionId: string): Promise<Models.Collection>; + getCollection( + paramsOrFirst: { databaseId: string, collectionId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Collection> { + let params: { databaseId: string, collectionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a collection by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.name - Collection name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {boolean} params.purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTable` instead. + */ + updateCollection(params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Collection>; + /** + * Update a collection by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} name - Collection name. Max length: 128 chars. + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} documentSecurity - Enables configuring permissions for individual documents. A user needs one of document or collection level permissions to access a document. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is collection enabled? When set to 'disabled', users cannot access the collection but Server SDKs with and API key can still read and write to the collection. No data is lost when this is toggled. + * @param {boolean} purge - When true, purge all cached list responses for this collection as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Collection>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateCollection(databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Collection>; + updateCollection( + paramsOrFirst: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Collection> { + let params: { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, name?: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, purge?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + documentSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + purge: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const name = params.name; + const permissions = params.permissions; + const documentSecurity = params.documentSecurity; + const enabled = params.enabled; + const purge = params.purge; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof documentSecurity !== 'undefined') { + payload['documentSecurity'] = documentSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteTable` instead. + */ + deleteCollection(params: { databaseId: string, collectionId: string }): Promise<{}>; + /** + * Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteCollection(databaseId: string, collectionId: string): Promise<{}>; + deleteCollection( + paramsOrFirst: { databaseId: string, collectionId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { databaseId: string, collectionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List attributes in the collection. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @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: key, type, size, required, array, status, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listColumns` instead. + */ + listAttributes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.AttributeList>; + /** + * List attributes in the collection. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @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: key, type, size, required, array, status, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listAttributes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.AttributeList>; + listAttributes( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.AttributeList> { + let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a bigint attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBigIntColumn` instead. + */ + createBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeBigint>; + /** + * Create a bigint attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeBigint>; + createBigIntAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.AttributeBigint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a bigint attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBigIntColumn` instead. + */ + updateBigIntAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeBigint>; + /** + * Update a bigint attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBigIntAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeBigint>; + updateBigIntAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.AttributeBigint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/bigint/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a boolean attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createBooleanColumn` instead. + */ + createBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.AttributeBoolean>; + /** + * Create a boolean attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean>; + createBooleanAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeBoolean> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a boolean attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {boolean} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateBooleanColumn` instead. + */ + updateBooleanAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.AttributeBoolean>; + /** + * Update a boolean attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {boolean} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean>; + updateBooleanAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] + ): Promise<Models.AttributeBoolean> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a date time attribute according to the ISO 8601 standard. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createDatetimeColumn` instead. + */ + createDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeDatetime>; + /** + * Create a date time attribute according to the ISO 8601 standard. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for the attribute in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime>; + createDatetimeAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeDatetime> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a date time attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateDatetimeColumn` instead. + */ + updateDatetimeAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeDatetime>; + /** + * Update a date time attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime>; + updateDatetimeAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeDatetime> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create an email attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEmailColumn` instead. + */ + createEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEmail>; + /** + * Create an email attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail>; + createEmailAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeEmail> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an email attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEmailColumn` instead. + */ + updateEmailAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEmail>; + /** + * Update an email attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail>; + updateEmailAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeEmail> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {string[]} params.elements - Array of enum values. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createEnumColumn` instead. + */ + createEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeEnum>; + /** + * Create an enum attribute. The `elements` param acts as a white-list of accepted values for this attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {string[]} elements - Array of enum values. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum>; + createEnumAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeEnum> { + let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an enum attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {string[]} params.elements - Updated list of enum values. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateEnumColumn` instead. + */ + updateEnumAttribute(params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeEnum>; + /** + * Update an enum attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {string[]} elements - Updated list of enum values. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum>; + updateEnumAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeEnum> { + let params: { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a float attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number} params.min - Minimum value. + * @param {number} params.max - Maximum value. + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createFloatColumn` instead. + */ + createFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.AttributeFloat>; + /** + * Create a float attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number} min - Minimum value. + * @param {number} max - Maximum value. + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat>; + createFloatAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] + ): Promise<Models.AttributeFloat> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number, + max: rest[4] as number, + xdefault: rest[5] as number, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a float attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {number} params.min - Minimum value. + * @param {number} params.max - Maximum value. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateFloatColumn` instead. + */ + updateFloatAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.AttributeFloat>; + /** + * Update a float attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {number} min - Minimum value. + * @param {number} max - Maximum value. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.AttributeFloat>; + updateFloatAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] + ): Promise<Models.AttributeFloat> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number, + min: rest[4] as number, + max: rest[5] as number, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create an integer attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIntegerColumn` instead. + */ + createIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.AttributeInteger>; + /** + * Create an integer attribute. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.AttributeInteger>; + createIntegerAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.AttributeInteger> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an integer attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIntegerColumn` instead. + */ + updateIntegerAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.AttributeInteger>; + /** + * Update an integer attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {number | bigint} xdefault - Default value. Cannot be set when attribute is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.AttributeInteger>; + updateIntegerAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.AttributeInteger> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create IP address attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIpColumn` instead. + */ + createIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeIp>; + /** + * Create IP address attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp>; + createIpAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeIp> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an ip attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateIpColumn` instead. + */ + updateIpAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeIp>; + /** + * Update an ip attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp>; + updateIpAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeIp> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric line attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createLineColumn` instead. + */ + createLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributeLine>; + /** + * Create a geometric line attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributeLine>; + createLineAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.AttributeLine> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a line attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateLineColumn` instead. + */ + updateLineAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributeLine>; + /** + * Update a line attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLineAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributeLine>; + updateLineAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.AttributeLine> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/line/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a longtext attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + */ + createLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeLongtext>; + /** + * Create a longtext attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeLongtext>; + createLongtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeLongtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a longtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + */ + updateLongtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeLongtext>; + /** + * Update a longtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLongtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeLongtext>; + updateLongtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeLongtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/longtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a mediumtext attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + */ + createMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeMediumtext>; + /** + * Create a mediumtext attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeMediumtext>; + createMediumtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeMediumtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + */ + updateMediumtextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeMediumtext>; + /** + * Update a mediumtext attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMediumtextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeMediumtext>; + updateMediumtextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeMediumtext> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric point attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPointColumn` instead. + */ + createPointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePoint>; + /** + * Create a geometric point attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePoint>; + createPointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.AttributePoint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePointColumn` instead. + */ + updatePointAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePoint>; + /** + * Update a point attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePoint>; + updatePointAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.AttributePoint> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/point/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric polygon attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createPolygonColumn` instead. + */ + createPolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.AttributePolygon>; + /** + * Create a geometric polygon attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.AttributePolygon>; + createPolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.AttributePolygon> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {any[]} params.xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} params.newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updatePolygonColumn` instead. + */ + updatePolygonAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.AttributePolygon>; + /** + * Update a polygon attribute. Changing the `default` value will not update already existing documents. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#createCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {any[]} xdefault - Default value for attribute when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when attribute is required. + * @param {string} newKey - New attribute key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributePolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.AttributePolygon>; + updatePolygonAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.AttributePolygon> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/polygon/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.relatedCollectionId - Related Collection ID. + * @param {RelationshipType} params.type - Relation type + * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.key - Attribute Key. + * @param {string} params.twoWayKey - Two Way Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRelationshipColumn` instead. + */ + createRelationshipAttribute(params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.AttributeRelationship>; + /** + * Create relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} relatedCollectionId - Related Collection ID. + * @param {RelationshipType} type - Relation type + * @param {boolean} twoWay - Is Two Way? + * @param {string} key - Attribute Key. + * @param {string} twoWayKey - Two Way Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship>; + createRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, + ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] + ): Promise<Models.AttributeRelationship> { + let params: { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + relatedCollectionId: rest[1] as string, + type: rest[2] as RelationshipType, + twoWay: rest[3] as boolean, + key: rest[4] as string, + twoWayKey: rest[5] as string, + onDelete: rest[6] as RelationMutate + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const relatedCollectionId = params.relatedCollectionId; + const type = params.type; + const twoWay = params.twoWay; + const key = params.key; + const twoWayKey = params.twoWayKey; + const onDelete = params.onDelete; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof relatedCollectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "relatedCollectionId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof relatedCollectionId !== 'undefined') { + payload['relatedCollectionId'] = relatedCollectionId; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof twoWay !== 'undefined') { + payload['twoWay'] = twoWay; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof twoWayKey !== 'undefined') { + payload['twoWayKey'] = twoWayKey; + } + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRelationshipColumn` instead. + */ + updateRelationshipAttribute(params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.AttributeRelationship>; + /** + * Update relationship attribute. [Learn more about relationship attributes](https://appwrite.io/docs/databases-relationships#relationship-attributes). + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {RelationMutate} onDelete - Constraints option + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship>; + updateRelationshipAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, + ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + ): Promise<Models.AttributeRelationship> { + let params: { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + onDelete: rest[2] as RelationMutate, + newKey: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const onDelete = params.onDelete; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a string attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {number} params.size - Attribute size for text attributes, in number of characters. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createStringColumn` instead. + */ + createStringAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeString>; + /** + * Create a string attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {number} size - Attribute size for text attributes, in number of characters. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString>; + createStringAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeString> { + let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a string attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} params.size - Maximum size of the string attribute. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateStringColumn` instead. + */ + updateStringAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeString>; + /** + * Update a string attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} size - Maximum size of the string attribute. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString>; + updateStringAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.AttributeString> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a text attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + */ + createTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeText>; + /** + * Create a text attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeText>; + createTextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeText> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a text attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + */ + updateTextAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeText>; + /** + * Update a text attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTextAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeText>; + updateTextAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeText> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/text/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a URL attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createUrlColumn` instead. + */ + createUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.AttributeUrl>; + /** + * Create a URL attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl>; + createUrlAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.AttributeUrl> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an url attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateUrlColumn` instead. + */ + updateUrlAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.AttributeUrl>; + /** + * Update an url attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl>; + updateUrlAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.AttributeUrl> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a varchar attribute. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {number} params.size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} params.array - Is attribute an array? + * @param {boolean} params.encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + */ + createVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.AttributeVarchar>; + /** + * Create a varchar attribute. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {number} size - Attribute size for varchar attributes, in number of characters. Maximum size is 16381. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {boolean} array - Is attribute an array? + * @param {boolean} encrypt - Toggle encryption for the attribute. Encryption enhances security by not storing any plain text values in the database. However, encrypted attributes cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVarcharAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeVarchar>; + createVarcharAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.AttributeVarchar> { + let params: { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a varchar attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Attribute Key. + * @param {boolean} params.required - Is attribute required? + * @param {string} params.xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} params.size - Maximum size of the varchar attribute. + * @param {string} params.newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + */ + updateVarcharAttribute(params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.AttributeVarchar>; + /** + * Update a varchar attribute. Changing the `default` value will not update already existing documents. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Attribute Key. + * @param {boolean} required - Is attribute required? + * @param {string} xdefault - Default value for attribute when not provided. Cannot be set when attribute is required. + * @param {number} size - Maximum size of the varchar attribute. + * @param {string} newKey - New Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVarcharAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeVarchar>; + updateVarcharAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.AttributeVarchar> { + let params: { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/varchar/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get attribute by ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getColumn` instead. + */ + getAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; + /** + * Get attribute by ID. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getAttribute(databaseId: string, collectionId: string, key: string): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString>; + getAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.AttributeBoolean | Models.AttributeInteger | Models.AttributeFloat | Models.AttributeEmail | Models.AttributeEnum | Models.AttributeUrl | Models.AttributeIp | Models.AttributeDatetime | Models.AttributeRelationship | Models.AttributeString> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Deletes an attribute. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteColumn` instead. + */ + deleteAttribute(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + /** + * Deletes an attribute. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} key - Attribute Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}>; + deleteAttribute( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. + */ + listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.DocumentList<Document>>; + /** + * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>; + listDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string, + total: rest[3] as boolean, + ttl: rest[4] as number + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const queries = params.queries; + const transactionId = params.transactionId; + const total = params.total; + const ttl = params.ttl; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {string} params.documentId - Document 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. + * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON object. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. + */ + createDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }): Promise<Document>; + /** + * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {string} documentId - Document 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. + * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON object. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string): Promise<Document>; + createDocument<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>)?, (string[])?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof documentId !== 'undefined') { + payload['documentId'] = documentId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {object[]} params.documents - Array of documents data as JSON objects. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRows` instead. + */ + createDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + /** + * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents. + * @param {object[]} documents - Array of documents data as JSON objects. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; + createDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documents: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documents = params.documents; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documents === 'undefined') { + throw new AppwriteException('Missing required parameter: "documents"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof documents !== 'undefined') { + payload['documents'] = documents; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {object[]} params.documents - Array of document data as JSON objects. May contain partial documents. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRows` instead. + */ + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + /** + * Create or update Documents. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {object[]} documents - Array of document data as JSON objects. May contain partial documents. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documents: object[], transactionId?: string): Promise<Models.DocumentList<Document>>; + upsertDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documents: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documents: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documents: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documents = params.documents; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documents === 'undefined') { + throw new AppwriteException('Missing required parameter: "documents"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof documents !== 'undefined') { + payload['documents'] = documents; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {object} params.data - Document data as JSON object. Include only attribute and value pairs to be updated. + * @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. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRows` instead. + */ + updateDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + /** + * Update all documents that match your queries, if no queries are submitted then all documents are updated. You can pass only specific fields to be updated. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {object} data - Document data as JSON object. Include only attribute and value pairs to be updated. + * @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. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; + updateDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (object)?, (string[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, data?: object, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + data: rest[1] as object, + queries: rest[2] as string[], + transactionId: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const data = params.data; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` instead. + */ + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<Document>>; + /** + * Bulk delete documents using queries, if no queries are passed then all documents are deleted. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string): Promise<Models.DocumentList<Document>>; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string[])?, (string)?] + ): Promise<Models.DocumentList<Document>> { + let params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.documentId - Document ID. + * @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. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getRow` instead. + */ + getDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }): Promise<Document>; + /** + * Get a document by its unique ID. This endpoint response returns a JSON object with the document data. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} documentId - Document ID. + * @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. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string): Promise<Document>; + getDocument<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + queries: rest[2] as string[], + transactionId: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include all required attributes of the document to be created or updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.upsertRow` instead. + */ + upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>; + /** + * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include all required attributes of the document to be created or updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>; + upsertDocument<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include only attribute and value pairs to be updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateRow` instead. + */ + updateDocument<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }): Promise<Document>; + /** + * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include only attribute and value pairs to be updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>; + updateDocument<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>)?, (string[])?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + data: rest[2] as Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a document by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.documentId - Document ID. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRow` instead. + */ + deleteDocument(params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }): Promise<{}>; + /** + * Delete a document by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} documentId - Document ID. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDocument(databaseId: string, collectionId: string, documentId: string, transactionId?: string): Promise<{}>; + deleteDocument( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, collectionId: string, documentId: string, transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId); + const payload: Payload = {}; + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Decrement a specific attribute of a document by a given value. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {string} params.attribute - Attribute key. + * @param {number} params.value - Value to increment the attribute by. The value must be a number. + * @param {number} params.min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.decrementRowColumn` instead. + */ + decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }): Promise<Document>; + /** + * Decrement a specific attribute of a document by a given value. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {string} attribute - Attribute key. + * @param {number} value - Value to increment the attribute by. The value must be a number. + * @param {number} min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string): Promise<Document>; + decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + attribute: rest[2] as string, + value: rest[3] as number, + min: rest[4] as number, + transactionId: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const attribute = params.attribute; + const value = params.value; + const min = params.min; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof attribute === 'undefined') { + throw new AppwriteException('Missing required parameter: "attribute"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Increment a specific attribute of a document by a given value. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. + * @param {string} params.documentId - Document ID. + * @param {string} params.attribute - Attribute key. + * @param {number} params.value - Value to increment the attribute by. The value must be a number. + * @param {number} params.max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.incrementRowColumn` instead. + */ + incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }): Promise<Document>; + /** + * Increment a specific attribute of a document by a given value. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. + * @param {string} documentId - Document ID. + * @param {string} attribute - Attribute key. + * @param {number} value - Value to increment the attribute by. The value must be a number. + * @param {number} max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Document>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string): Promise<Document>; + incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>( + paramsOrFirst: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + ): Promise<Document> { + let params: { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + documentId: rest[1] as string, + attribute: rest[2] as string, + value: rest[3] as number, + max: rest[4] as number, + transactionId: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const attribute = params.attribute; + const value = params.value; + const max = params.max; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof documentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "documentId"'); + } + if (typeof attribute === 'undefined') { + throw new AppwriteException('Missing required parameter: "attribute"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * List indexes in the collection. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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: key, type, status, attributes, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IndexList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listIndexes` instead. + */ + listIndexes(params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }): Promise<Models.IndexList>; + /** + * List indexes in the collection. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @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: key, type, status, attributes, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IndexList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIndexes(databaseId: string, collectionId: string, queries?: string[], total?: boolean): Promise<Models.IndexList>; + listIndexes( + paramsOrFirst: { databaseId: string, collectionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.IndexList> { + let params: { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Index Key. + * @param {DatabasesIndexType} params.type - Index type. + * @param {string[]} params.attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} params.lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createIndex` instead. + */ + createIndex(params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.Index>; + /** + * Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request. + * Attributes can be `key`, `fulltext`, and `unique`. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Index Key. + * @param {DatabasesIndexType} type - Index type. + * @param {string[]} attributes - Array of attributes to index. Maximum of 100 attributes are allowed, each 32 characters long. + * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIndex(databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.Index>; + createIndex( + paramsOrFirst: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] } | string, + ...rest: [(string)?, (string)?, (DatabasesIndexType)?, (string[])?, (OrderBy[])?, (number[])?] + ): Promise<Models.Index> { + let params: { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string, type: DatabasesIndexType, attributes: string[], orders?: OrderBy[], lengths?: number[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string, + type: rest[2] as DatabasesIndexType, + attributes: rest[3] as string[], + orders: rest[4] as OrderBy[], + lengths: rest[5] as number[] + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + const type = params.type; + const attributes = params.attributes; + const orders = params.orders; + const lengths = params.lengths; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof attributes === 'undefined') { + throw new AppwriteException('Missing required parameter: "attributes"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof attributes !== 'undefined') { + payload['attributes'] = attributes; + } + if (typeof orders !== 'undefined') { + payload['orders'] = orders; + } + if (typeof lengths !== 'undefined') { + payload['lengths'] = lengths; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get an index by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead. + */ + getIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<Models.Index>; + /** + * Get an index by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.Index>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index>; + getIndex( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Index> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an index. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteIndex` instead. + */ + deleteIndex(params: { databaseId: string, collectionId: string, key: string }): Promise<{}>; + /** + * Delete an index. + * + * @param {string} databaseId - Database ID. + * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}>; + deleteIndex( + paramsOrFirst: { databaseId: string, collectionId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, collectionId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + collectionId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof collectionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "collectionId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/functions.ts b/src/services/functions.ts new file mode 100644 index 00000000..75835a0b --- /dev/null +++ b/src/services/functions.ts @@ -0,0 +1,2003 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { InputFile } from '../inputFile'; + +import { Runtime } from '../enums/runtime'; +import { Scopes } from '../enums/scopes'; +import { TemplateReferenceType } from '../enums/template-reference-type'; +import { VCSReferenceType } from '../enums/vcs-reference-type'; +import { DeploymentDownloadType } from '../enums/deployment-download-type'; +import { ExecutionMethod } from '../enums/execution-method'; + +export class Functions { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's functions. You can use the query params to filter your results. + * + * @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: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.FunctionList>} + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.FunctionList>; + /** + * Get a list of all the project's functions. You can use the query params to filter your results. + * + * @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: name, enabled, runtime, deploymentId, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.FunctionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.FunctionList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.FunctionList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/functions'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + * + * @param {string} params.functionId - Function 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. + * @param {string} params.name - Function name. Max length: 128 chars. + * @param {Runtime} params.runtime - Execution runtime. + * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.timeout - Function maximum execution time in seconds. + * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} params.commands - Build Commands. + * @param {Scopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function. + * @param {string} params.providerBranch - Production branch for the repo linked to the function. + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to function code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the function deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the function executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + /** + * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + * + * @param {string} functionId - Function 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. + * @param {string} name - Function name. Max length: 128 chars. + * @param {Runtime} runtime - Execution runtime. + * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} timeout - Function maximum execution time in seconds. + * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} commands - Build Commands. + * @param {Scopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the function. + * @param {string} providerBranch - Production branch for the repo linked to the function. + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to function code in the linked repo. + * @param {string} buildSpecification - Build specification for the function deployments. + * @param {string} runtimeSpecification - Runtime specification for the function executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + create( + paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Function> { + let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + functionId: paramsOrFirst as string, + name: rest[0] as string, + runtime: rest[1] as Runtime, + execute: rest[2] as string[], + events: rest[3] as string[], + schedule: rest[4] as string, + timeout: rest[5] as number, + enabled: rest[6] as boolean, + logging: rest[7] as boolean, + entrypoint: rest[8] as string, + commands: rest[9] as string, + scopes: rest[10] as Scopes[], + installationId: rest[11] as string, + providerRepositoryId: rest[12] as string, + providerBranch: rest[13] as string, + providerSilentMode: rest[14] as boolean, + providerRootDirectory: rest[15] as string, + buildSpecification: rest[16] as string, + runtimeSpecification: rest[17] as string, + deploymentRetention: rest[18] as number + }; + } + + const functionId = params.functionId; + const name = params.name; + const runtime = params.runtime; + const execute = params.execute; + const events = params.events; + const schedule = params.schedule; + const timeout = params.timeout; + const enabled = params.enabled; + const logging = params.logging; + const entrypoint = params.entrypoint; + const commands = params.commands; + const scopes = params.scopes; + const installationId = params.installationId; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof runtime === 'undefined') { + throw new AppwriteException('Missing required parameter: "runtime"'); + } + + const apiPath = '/functions'; + const payload: Payload = {}; + if (typeof functionId !== 'undefined') { + payload['functionId'] = functionId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof runtime !== 'undefined') { + payload['runtime'] = runtime; + } + if (typeof execute !== 'undefined') { + payload['execute'] = execute; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all runtimes that are currently active on your instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.RuntimeList>} + */ + listRuntimes(): Promise<Models.RuntimeList> { + + const apiPath = '/functions/runtimes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List allowed function specifications for this instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.SpecificationList>} + */ + listSpecifications(): Promise<Models.SpecificationList> { + + const apiPath = '/functions/specifications'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a function by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + get(params: { functionId: string }): Promise<Models.Function>; + /** + * Get a function by its unique ID. + * + * @param {string} functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(functionId: string): Promise<Models.Function>; + get( + paramsOrFirst: { functionId: string } | string + ): Promise<Models.Function> { + let params: { functionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string }; + } else { + params = { + functionId: paramsOrFirst as string + }; + } + + const functionId = params.functionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update function by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.name - Function name. Max length: 128 chars. + * @param {Runtime} params.runtime - Execution runtime. + * @param {string[]} params.execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {string} params.schedule - Schedule CRON syntax. + * @param {number} params.timeout - Maximum execution time in seconds. + * @param {boolean} params.enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} params.commands - Build Commands. + * @param {Scopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function + * @param {string} params.providerBranch - Production branch for the repo linked to the function + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to function code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the function deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the function executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + /** + * Update function by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} name - Function name. Max length: 128 chars. + * @param {Runtime} runtime - Execution runtime. + * @param {string[]} execute - An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {string} schedule - Schedule CRON syntax. + * @param {number} timeout - Maximum execution time in seconds. + * @param {boolean} enabled - Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. + * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". + * @param {string} commands - Build Commands. + * @param {Scopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the function + * @param {string} providerBranch - Production branch for the repo linked to the function + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to function code in the linked repo. + * @param {string} buildSpecification - Build specification for the function deployments. + * @param {string} runtimeSpecification - Runtime specification for the function executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + update( + paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Function> { + let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + functionId: paramsOrFirst as string, + name: rest[0] as string, + runtime: rest[1] as Runtime, + execute: rest[2] as string[], + events: rest[3] as string[], + schedule: rest[4] as string, + timeout: rest[5] as number, + enabled: rest[6] as boolean, + logging: rest[7] as boolean, + entrypoint: rest[8] as string, + commands: rest[9] as string, + scopes: rest[10] as Scopes[], + installationId: rest[11] as string, + providerRepositoryId: rest[12] as string, + providerBranch: rest[13] as string, + providerSilentMode: rest[14] as boolean, + providerRootDirectory: rest[15] as string, + buildSpecification: rest[16] as string, + runtimeSpecification: rest[17] as string, + deploymentRetention: rest[18] as number + }; + } + + const functionId = params.functionId; + const name = params.name; + const runtime = params.runtime; + const execute = params.execute; + const events = params.events; + const schedule = params.schedule; + const timeout = params.timeout; + const enabled = params.enabled; + const logging = params.logging; + const entrypoint = params.entrypoint; + const commands = params.commands; + const scopes = params.scopes; + const installationId = params.installationId; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof runtime !== 'undefined') { + payload['runtime'] = runtime; + } + if (typeof execute !== 'undefined') { + payload['execute'] = execute; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof schedule !== 'undefined') { + payload['schedule'] = schedule; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a function by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { functionId: string }): Promise<{}>; + /** + * Delete a function by its unique ID. + * + * @param {string} functionId - Function ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(functionId: string): Promise<{}>; + delete( + paramsOrFirst: { functionId: string } | string + ): Promise<{}> { + let params: { functionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string }; + } else { + params = { + functionId: paramsOrFirst as string + }; + } + + const functionId = params.functionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}'.replace('{functionId}', functionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + */ + updateFunctionDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Function>; + /** + * Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Function>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFunctionDeployment(functionId: string, deploymentId: string): Promise<Models.Function>; + updateFunctionDeployment( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Function> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployment'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all the function's code deployments. You can use the query params to filter your results. + * + * @param {string} params.functionId - Function ID. + * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + */ + listDeployments(params: { functionId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; + /** + * Get a list of all the function's code deployments. You can use the query params to filter your results. + * + * @param {string} functionId - Function ID. + * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDeployments(functionId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; + listDeployments( + paramsOrFirst: { functionId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.DeploymentList> { + let params: { functionId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const functionId = params.functionId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. + * + * @param {string} params.functionId - Function ID. + * @param {File | InputFile} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @param {string} params.entrypoint - Entrypoint File. + * @param {string} params.commands - Build Commands. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDeployment(params: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; + /** + * Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + * + * This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + * + * Use the "command" param to set the entrypoint used to execute your code. + * + * @param {string} functionId - Function ID. + * @param {File | InputFile} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @param {string} entrypoint - Entrypoint File. + * @param {string} commands - Build Commands. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDeployment(functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; + createDeployment( + paramsOrFirst: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File | InputFile)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string }; + let onProgress: ((progress: UploadProgress) => void); + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, code: File | InputFile, activate: boolean, entrypoint?: string, commands?: string }; + onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + } else { + params = { + functionId: paramsOrFirst as string, + code: rest[0] as File | InputFile, + activate: rest[1] as boolean, + entrypoint: rest[2] as string, + commands: rest[3] as string + }; + onProgress = rest[4] as ((progress: UploadProgress) => void); + } + + const functionId = params.functionId; + const code = params.code; + const activate = params.activate; + const entrypoint = params.entrypoint; + const commands = params.commands; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + if (typeof activate === 'undefined') { + throw new AppwriteException('Missing required parameter: "activate"'); + } + + const apiPath = '/functions/{functionId}/deployments'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof entrypoint !== 'undefined') { + payload['entrypoint'] = entrypoint; + } + if (typeof commands !== 'undefined') { + payload['commands'] = commands; + } + if (typeof code !== 'undefined') { + payload['code'] = code; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'multipart/form-data', + } + + return this.client.chunkedUpload( + 'post', + uri, + apiHeaders, + payload, + onProgress + ); + } + + /** + * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @param {string} params.buildId - Build unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDuplicateDeployment(params: { functionId: string, deploymentId: string, buildId?: string }): Promise<Models.Deployment>; + /** + * Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @param {string} buildId - Build unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDuplicateDeployment(functionId: string, deploymentId: string, buildId?: string): Promise<Models.Deployment>; + createDuplicateDeployment( + paramsOrFirst: { functionId: string, deploymentId: string, buildId?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, deploymentId: string, buildId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, buildId?: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string, + buildId: rest[1] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + const buildId = params.buildId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/duplicate'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + if (typeof buildId !== 'undefined') { + payload['buildId'] = buildId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.repository - Repository name of the template. + * @param {string} params.owner - The name of the owner of the template. + * @param {string} params.rootDirectory - Path to function code in the template repo. + * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createTemplateDeployment(params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/functions/templates) to find the template details. + * + * @param {string} functionId - Function ID. + * @param {string} repository - Repository name of the template. + * @param {string} owner - The name of the owner of the template. + * @param {string} rootDirectory - Path to function code in the template repo. + * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTemplateDeployment(functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createTemplateDeployment( + paramsOrFirst: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + repository: rest[0] as string, + owner: rest[1] as string, + rootDirectory: rest[2] as string, + type: rest[3] as TemplateReferenceType, + reference: rest[4] as string, + activate: rest[5] as boolean + }; + } + + const functionId = params.functionId; + const repository = params.repository; + const owner = params.owner; + const rootDirectory = params.rootDirectory; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof repository === 'undefined') { + throw new AppwriteException('Missing required parameter: "repository"'); + } + if (typeof owner === 'undefined') { + throw new AppwriteException('Missing required parameter: "owner"'); + } + if (typeof rootDirectory === 'undefined') { + throw new AppwriteException('Missing required parameter: "rootDirectory"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/functions/{functionId}/deployments/template'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof repository !== 'undefined') { + payload['repository'] = repository; + } + if (typeof owner !== 'undefined') { + payload['owner'] = owner; + } + if (typeof rootDirectory !== 'undefined') { + payload['rootDirectory'] = rootDirectory; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a deployment when a function is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} params.functionId - Function ID. + * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit + * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createVcsDeployment(params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment when a function is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} functionId - Function ID. + * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit + * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVcsDeployment(functionId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createVcsDeployment( + paramsOrFirst: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + type: rest[0] as VCSReferenceType, + reference: rest[1] as string, + activate: rest[2] as boolean + }; + } + + const functionId = params.functionId; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/functions/{functionId}/deployments/vcs'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a function deployment by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + getDeployment(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Get a function deployment by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeployment(functionId: string, deploymentId: string): Promise<Models.Deployment>; + getDeployment( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a code deployment by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDeployment(params: { functionId: string, deploymentId: string }): Promise<{}>; + /** + * Delete a code deployment by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDeployment(functionId: string, deploymentId: string): Promise<{}>; + deleteDeployment( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getDeploymentDownload(params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise<ArrayBuffer>; + /** + * Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeploymentDownload(functionId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>; + getDeploymentDownload( + paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, + ...rest: [(string)?, (DeploymentDownloadType)?] + ): Promise<ArrayBuffer> { + let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string, + type: rest[1] as DeploymentDownloadType + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + const type = params.type; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/download'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + updateDeploymentStatus(params: { functionId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} functionId - Function ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDeploymentStatus(functionId: string, deploymentId: string): Promise<Models.Deployment>; + updateDeploymentStatus( + paramsOrFirst: { functionId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, deploymentId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const functionId = params.functionId; + const deploymentId = params.deploymentId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/functions/{functionId}/deployments/{deploymentId}/status'.replace('{functionId}', functionId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all the current user function execution logs. You can use the query params to filter your results. + * + * @param {string} params.functionId - Function ID. + * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + */ + listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; + /** + * Get a list of all the current user function execution logs. You can use the query params to filter your results. + * + * @param {string} functionId - Function ID. + * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; + listExecutions( + paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.ExecutionList> { + let params: { functionId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const functionId = params.functionId; + const queries = params.queries; + const total = params.total; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.body - HTTP body of execution. Default value is empty string. + * @param {boolean} params.async - Execute code in the background. Default value is false. + * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is / + * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST. + * @param {object} params.headers - HTTP headers of execution. Defaults to empty. + * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + */ + createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; + /** + * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + * + * @param {string} functionId - Function ID. + * @param {string} body - HTTP body of execution. Default value is empty string. + * @param {boolean} async - Execute code in the background. Default value is false. + * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is / + * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST. + * @param {object} headers - HTTP headers of execution. Defaults to empty. + * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>; + createExecution( + paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?] + ): Promise<Models.Execution> { + let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + } else { + params = { + functionId: paramsOrFirst as string, + body: rest[0] as string, + async: rest[1] as boolean, + xpath: rest[2] as string, + method: rest[3] as ExecutionMethod, + headers: rest[4] as object, + scheduledAt: rest[5] as string + }; + } + + const functionId = params.functionId; + const body = params.body; + const async = params.async; + const xpath = params.xpath; + const method = params.method; + const headers = params.headers; + const scheduledAt = params.scheduledAt; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof body !== 'undefined') { + payload['body'] = body; + } + if (typeof async !== 'undefined') { + payload['async'] = async; + } + if (typeof xpath !== 'undefined') { + payload['path'] = xpath; + } + if (typeof method !== 'undefined') { + payload['method'] = method; + } + if (typeof headers !== 'undefined') { + payload['headers'] = headers; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a function execution log by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + */ + getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; + /** + * Get a function execution log by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getExecution(functionId: string, executionId: string): Promise<Models.Execution>; + getExecution( + paramsOrFirst: { functionId: string, executionId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Execution> { + let params: { functionId: string, executionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + executionId: rest[0] as string + }; + } + + const functionId = params.functionId; + const executionId = params.executionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof executionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "executionId"'); + } + + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a function execution by its unique ID. + * + * @param {string} params.functionId - Function ID. + * @param {string} params.executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteExecution(params: { functionId: string, executionId: string }): Promise<{}>; + /** + * Delete a function execution by its unique ID. + * + * @param {string} functionId - Function ID. + * @param {string} executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteExecution(functionId: string, executionId: string): Promise<{}>; + deleteExecution( + paramsOrFirst: { functionId: string, executionId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { functionId: string, executionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + executionId: rest[0] as string + }; + } + + const functionId = params.functionId; + const executionId = params.executionId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof executionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "executionId"'); + } + + const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all variables of a specific function. + * + * @param {string} params.functionId - Function unique ID. + * @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: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + */ + listVariables(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; + /** + * Get a list of all variables of a specific function. + * + * @param {string} functionId - Function unique ID. + * @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: key, resourceType, resourceId, secret + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listVariables(functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables( + paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.VariableList> { + let params: { functionId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, queries?: string[], total?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const functionId = params.functionId; + const queries = params.queries; + const total = params.total; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + * + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable 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. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + createVariable(params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + * + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable 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. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVariable(functionId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; + createVariable( + paramsOrFirst: { functionId: string, variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean + }; + } + + const functionId = params.functionId; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof value === 'undefined') { + throw new AppwriteException('Missing required parameter: "value"'); + } + + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a variable by its unique ID. + * + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + getVariable(params: { functionId: string, variableId: string }): Promise<Models.Variable>; + /** + * Get a variable by its unique ID. + * + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getVariable(functionId: string, variableId: string): Promise<Models.Variable>; + getVariable( + paramsOrFirst: { functionId: string, variableId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Variable> { + let params: { functionId: string, variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + variableId: rest[0] as string + }; + } + + const functionId = params.functionId; + const variableId = params.variableId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update variable by its unique ID. + * + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable unique ID. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + updateVariable(params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Update variable by its unique ID. + * + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable unique ID. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only functions can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVariable(functionId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; + updateVariable( + paramsOrFirst: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + } else { + params = { + functionId: paramsOrFirst as string, + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean + }; + } + + const functionId = params.functionId; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a variable by its unique ID. + * + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteVariable(params: { functionId: string, variableId: string }): Promise<{}>; + /** + * Delete a variable by its unique ID. + * + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteVariable(functionId: string, variableId: string): Promise<{}>; + deleteVariable( + paramsOrFirst: { functionId: string, variableId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { functionId: string, variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; + } else { + params = { + functionId: paramsOrFirst as string, + variableId: rest[0] as string + }; + } + + const functionId = params.functionId; + const variableId = params.variableId; + + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/graphql.ts b/src/services/graphql.ts new file mode 100644 index 00000000..fc553978 --- /dev/null +++ b/src/services/graphql.ts @@ -0,0 +1,124 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Graphql { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Execute a GraphQL mutation. + * + * @param {object} params.query - The query or queries to execute. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + query(params: { query: object }): Promise<{}>; + /** + * Execute a GraphQL mutation. + * + * @param {object} query - The query or queries to execute. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + query(query: object): Promise<{}>; + query( + paramsOrFirst: { query: object } | object + ): Promise<{}> { + let params: { query: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { query: object }; + } else { + params = { + query: paramsOrFirst as object + }; + } + + const query = params.query; + + if (typeof query === 'undefined') { + throw new AppwriteException('Missing required parameter: "query"'); + } + + const apiPath = '/graphql'; + const payload: Payload = {}; + if (typeof query !== 'undefined') { + payload['query'] = query; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'x-sdk-graphql': 'true', + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Execute a GraphQL mutation. + * + * @param {object} params.query - The query or queries to execute. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + mutation(params: { query: object }): Promise<{}>; + /** + * Execute a GraphQL mutation. + * + * @param {object} query - The query or queries to execute. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + mutation(query: object): Promise<{}>; + mutation( + paramsOrFirst: { query: object } | object + ): Promise<{}> { + let params: { query: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('query' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { query: object }; + } else { + params = { + query: paramsOrFirst as object + }; + } + + const query = params.query; + + if (typeof query === 'undefined') { + throw new AppwriteException('Missing required parameter: "query"'); + } + + const apiPath = '/graphql/mutation'; + const payload: Payload = {}; + if (typeof query !== 'undefined') { + payload['query'] = query; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'x-sdk-graphql': 'true', + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/health.ts b/src/services/health.ts new file mode 100644 index 00000000..1bd2cf03 --- /dev/null +++ b/src/services/health.ts @@ -0,0 +1,1043 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { Name } from '../enums/name'; + +export class Health { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + get(): Promise<Models.HealthStatus> { + + const apiPath = '/health'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Check the Appwrite Antivirus server is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthAntivirus>} + */ + getAntivirus(): Promise<Models.HealthAntivirus> { + + const apiPath = '/health/anti-virus'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Check the Appwrite in-memory cache servers are up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatusList>} + */ + getCache(): Promise<Models.HealthStatusList> { + + const apiPath = '/health/cache'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the SSL certificate for a domain + * + * @param {string} params.domain - string + * @throws {AppwriteException} + * @returns {Promise<Models.HealthCertificate>} + */ + getCertificate(params?: { domain?: string }): Promise<Models.HealthCertificate>; + /** + * Get the SSL certificate for a domain + * + * @param {string} domain - string + * @throws {AppwriteException} + * @returns {Promise<Models.HealthCertificate>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getCertificate(domain?: string): Promise<Models.HealthCertificate>; + getCertificate( + paramsOrFirst?: { domain?: string } | string + ): Promise<Models.HealthCertificate> { + let params: { domain?: string }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain?: string }; + } else { + params = { + domain: paramsOrFirst as string + }; + } + + const domain = params.domain; + + + const apiPath = '/health/certificate'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} params.threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} params.inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + getConsolePausing(params?: { threshold?: number, inactivityDays?: number }): Promise<Models.HealthStatus>; + /** + * Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking. + * + * + * @param {number} threshold - Percentage threshold of projects approaching pause. When hit (equal or higher), endpoint returns server error. Default value is 10. + * @param {number} inactivityDays - Number of days of inactivity before a project is paused. Should match the plan's projectInactivityDays setting. Default value is 7. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getConsolePausing(threshold?: number, inactivityDays?: number): Promise<Models.HealthStatus>; + getConsolePausing( + paramsOrFirst?: { threshold?: number, inactivityDays?: number } | number, + ...rest: [(number)?] + ): Promise<Models.HealthStatus> { + let params: { threshold?: number, inactivityDays?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number, inactivityDays?: number }; + } else { + params = { + threshold: paramsOrFirst as number, + inactivityDays: rest[0] as number + }; + } + + const threshold = params.threshold; + const inactivityDays = params.inactivityDays; + + + const apiPath = '/health/console-pausing'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + if (typeof inactivityDays !== 'undefined') { + payload['inactivityDays'] = inactivityDays; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Check the Appwrite database servers are up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatusList>} + */ + getDB(): Promise<Models.HealthStatusList> { + + const apiPath = '/health/db'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Check the Appwrite pub-sub servers are up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatusList>} + */ + getPubSub(): Promise<Models.HealthStatusList> { + + const apiPath = '/health/pubsub'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. + * + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueAudits(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server. + * + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueAudits(threshold?: number): Promise<Models.HealthQueue>; + getQueueAudits( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/audits'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueBuilds(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of builds that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueBuilds(threshold?: number): Promise<Models.HealthQueue>; + getQueueBuilds( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/builds'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueCertificates(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueCertificates(threshold?: number): Promise<Models.HealthQueue>; + getQueueCertificates( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/certificates'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {string} params.name - Queue name for which to check the queue size + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueDatabases(params?: { name?: string, threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of database changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {string} name - Queue name for which to check the queue size + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueDatabases(name?: string, threshold?: number): Promise<Models.HealthQueue>; + getQueueDatabases( + paramsOrFirst?: { name?: string, threshold?: number } | string, + ...rest: [(number)?] + ): Promise<Models.HealthQueue> { + let params: { name?: string, threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { name?: string, threshold?: number }; + } else { + params = { + name: paramsOrFirst as string, + threshold: rest[0] as number + }; + } + + const name = params.name; + const threshold = params.threshold; + + + const apiPath = '/health/queue/databases'; + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueDeletes(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of background destructive changes that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueDeletes(threshold?: number): Promise<Models.HealthQueue>; + getQueueDeletes( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/deletes'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Returns the amount of failed jobs in a given queue. + * + * + * @param {Name} params.name - The name of the queue + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getFailedJobs(params: { name: Name, threshold?: number }): Promise<Models.HealthQueue>; + /** + * Returns the amount of failed jobs in a given queue. + * + * + * @param {Name} name - The name of the queue + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFailedJobs(name: Name, threshold?: number): Promise<Models.HealthQueue>; + getFailedJobs( + paramsOrFirst: { name: Name, threshold?: number } | Name, + ...rest: [(number)?] + ): Promise<Models.HealthQueue> { + let params: { name: Name, threshold?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('name' in paramsOrFirst || 'threshold' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { name: Name, threshold?: number }; + } else { + params = { + name: paramsOrFirst as Name, + threshold: rest[0] as number + }; + } + + const name = params.name; + const threshold = params.threshold; + + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/health/queue/failed/{name}'.replace('{name}', name); + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueFunctions(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of function executions that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueFunctions(threshold?: number): Promise<Models.HealthQueue>; + getQueueFunctions( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/functions'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueLogs(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of logs that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueLogs(threshold?: number): Promise<Models.HealthQueue>; + getQueueLogs( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/logs'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueMails(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of mails that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueMails(threshold?: number): Promise<Models.HealthQueue>; + getQueueMails( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/mails'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueMessaging(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of messages that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueMessaging(threshold?: number): Promise<Models.HealthQueue>; + getQueueMessaging( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/messaging'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueMigrations(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of migrations that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueMigrations(threshold?: number): Promise<Models.HealthQueue>; + getQueueMigrations( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/migrations'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueStatsResources(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of metrics that are waiting to be processed in the Appwrite stats resources queue. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueStatsResources(threshold?: number): Promise<Models.HealthQueue>; + getQueueStatsResources( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/stats-resources'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueUsage(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of metrics that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueUsage(threshold?: number): Promise<Models.HealthQueue>; + getQueueUsage( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/stats-usage'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + */ + getQueueWebhooks(params?: { threshold?: number }): Promise<Models.HealthQueue>; + /** + * Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. + * + * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. + * @throws {AppwriteException} + * @returns {Promise<Models.HealthQueue>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getQueueWebhooks(threshold?: number): Promise<Models.HealthQueue>; + getQueueWebhooks( + paramsOrFirst?: { threshold?: number } | number + ): Promise<Models.HealthQueue> { + let params: { threshold?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { threshold?: number }; + } else { + params = { + threshold: paramsOrFirst as number + }; + } + + const threshold = params.threshold; + + + const apiPath = '/health/queue/webhooks'; + const payload: Payload = {}; + if (typeof threshold !== 'undefined') { + payload['threshold'] = threshold; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Check the Appwrite storage device is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + getStorage(): Promise<Models.HealthStatus> { + + const apiPath = '/health/storage'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthStatus>} + */ + getStorageLocal(): Promise<Models.HealthStatus> { + + const apiPath = '/health/storage/local'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. + * + * @throws {AppwriteException} + * @returns {Promise<Models.HealthTime>} + */ + getTime(): Promise<Models.HealthTime> { + + const apiPath = '/health/time'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/locale.ts b/src/services/locale.ts new file mode 100644 index 00000000..865a085f --- /dev/null +++ b/src/services/locale.ts @@ -0,0 +1,198 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Locale { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {AppwriteException} + * @returns {Promise<Models.Locale>} + */ + get(): Promise<Models.Locale> { + + const apiPath = '/locale'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List of all locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). + * + * @throws {AppwriteException} + * @returns {Promise<Models.LocaleCodeList>} + */ + listCodes(): Promise<Models.LocaleCodeList> { + + const apiPath = '/locale/codes'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List of all continents. You can use the locale header to get the data in a supported language. + * + * @throws {AppwriteException} + * @returns {Promise<Models.ContinentList>} + */ + listContinents(): Promise<Models.ContinentList> { + + const apiPath = '/locale/continents'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List of all countries. You can use the locale header to get the data in a supported language. + * + * @throws {AppwriteException} + * @returns {Promise<Models.CountryList>} + */ + listCountries(): Promise<Models.CountryList> { + + const apiPath = '/locale/countries'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. + * + * @throws {AppwriteException} + * @returns {Promise<Models.CountryList>} + */ + listCountriesEU(): Promise<Models.CountryList> { + + const apiPath = '/locale/countries/eu'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List of all countries phone codes. You can use the locale header to get the data in a supported language. + * + * @throws {AppwriteException} + * @returns {Promise<Models.PhoneList>} + */ + listCountriesPhones(): Promise<Models.PhoneList> { + + const apiPath = '/locale/countries/phones'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. + * + * @throws {AppwriteException} + * @returns {Promise<Models.CurrencyList>} + */ + listCurrencies(): Promise<Models.CurrencyList> { + + const apiPath = '/locale/currencies'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. + * + * @throws {AppwriteException} + * @returns {Promise<Models.LanguageList>} + */ + listLanguages(): Promise<Models.LanguageList> { + + const apiPath = '/locale/languages'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/messaging.ts b/src/services/messaging.ts new file mode 100644 index 00000000..1b8ac968 --- /dev/null +++ b/src/services/messaging.ts @@ -0,0 +1,5194 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { MessagePriority } from '../enums/message-priority'; +import { SmtpEncryption } from '../enums/smtp-encryption'; + +export class Messaging { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all messages from the current Appwrite project. + * + * @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: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MessageList>} + */ + listMessages(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.MessageList>; + /** + * Get a list of all messages from the current Appwrite project. + * + * @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: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MessageList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMessages(queries?: string[], search?: string, total?: boolean): Promise<Models.MessageList>; + listMessages( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.MessageList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/messaging/messages'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new email message. + * + * @param {string} params.messageId - Message 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. + * @param {string} params.subject - Email Subject. + * @param {string} params.content - Email Content. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string[]} params.cc - Array of target IDs to be added as CC. + * @param {string[]} params.bcc - Array of target IDs to be added as BCC. + * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {boolean} params.draft - Is message a draft + * @param {boolean} params.html - Is content of type HTML + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + createEmail(params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Create a new email message. + * + * @param {string} messageId - Message 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. + * @param {string} subject - Email Subject. + * @param {string} content - Email Content. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string[]} cc - Array of target IDs to be added as CC. + * @param {string[]} bcc - Array of target IDs to be added as BCC. + * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {boolean} draft - Is message a draft + * @param {boolean} html - Is content of type HTML + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmail(messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string): Promise<Models.Message>; + createEmail( + paramsOrFirst: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (string[])?, (boolean)?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, subject: string, content: string, topics?: string[], users?: string[], targets?: string[], cc?: string[], bcc?: string[], attachments?: string[], draft?: boolean, html?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + subject: rest[0] as string, + content: rest[1] as string, + topics: rest[2] as string[], + users: rest[3] as string[], + targets: rest[4] as string[], + cc: rest[5] as string[], + bcc: rest[6] as string[], + attachments: rest[7] as string[], + draft: rest[8] as boolean, + html: rest[9] as boolean, + scheduledAt: rest[10] as string + }; + } + + const messageId = params.messageId; + const subject = params.subject; + const content = params.content; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const cc = params.cc; + const bcc = params.bcc; + const attachments = params.attachments; + const draft = params.draft; + const html = params.html; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + if (typeof subject === 'undefined') { + throw new AppwriteException('Missing required parameter: "subject"'); + } + if (typeof content === 'undefined') { + throw new AppwriteException('Missing required parameter: "content"'); + } + + const apiPath = '/messaging/messages/email'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof subject !== 'undefined') { + payload['subject'] = subject; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof cc !== 'undefined') { + payload['cc'] = cc; + } + if (typeof bcc !== 'undefined') { + payload['bcc'] = bcc; + } + if (typeof attachments !== 'undefined') { + payload['attachments'] = attachments; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof html !== 'undefined') { + payload['html'] = html; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.subject - Email Subject. + * @param {string} params.content - Email Content. + * @param {boolean} params.draft - Is message a draft + * @param {boolean} params.html - Is content of type HTML + * @param {string[]} params.cc - Array of target IDs to be added as CC. + * @param {string[]} params.bcc - Array of target IDs to be added as BCC. + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {string[]} params.attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + updateEmail(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }): Promise<Models.Message>; + /** + * Update an email message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} subject - Email Subject. + * @param {string} content - Email Content. + * @param {boolean} draft - Is message a draft + * @param {boolean} html - Is content of type HTML + * @param {string[]} cc - Array of target IDs to be added as CC. + * @param {string[]} bcc - Array of target IDs to be added as BCC. + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {string[]} attachments - Array of compound ID strings of bucket IDs and file IDs to be attached to the email. They should be formatted as <BUCKET_ID>:<FILE_ID>. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmail(messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[]): Promise<Models.Message>; + updateEmail( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (boolean)?, (boolean)?, (string[])?, (string[])?, (string)?, (string[])?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], subject?: string, content?: string, draft?: boolean, html?: boolean, cc?: string[], bcc?: string[], scheduledAt?: string, attachments?: string[] }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + subject: rest[3] as string, + content: rest[4] as string, + draft: rest[5] as boolean, + html: rest[6] as boolean, + cc: rest[7] as string[], + bcc: rest[8] as string[], + scheduledAt: rest[9] as string, + attachments: rest[10] as string[] + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const subject = params.subject; + const content = params.content; + const draft = params.draft; + const html = params.html; + const cc = params.cc; + const bcc = params.bcc; + const scheduledAt = params.scheduledAt; + const attachments = params.attachments; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/email/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof subject !== 'undefined') { + payload['subject'] = subject; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof html !== 'undefined') { + payload['html'] = html; + } + if (typeof cc !== 'undefined') { + payload['cc'] = cc; + } + if (typeof bcc !== 'undefined') { + payload['bcc'] = bcc; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + if (typeof attachments !== 'undefined') { + payload['attachments'] = attachments; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new push notification. + * + * @param {string} params.messageId - Message 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. + * @param {string} params.title - Title for push notification. + * @param {string} params.body - Body for push notification. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {object} params.data - Additional key-value pair data for push notification. + * @param {string} params.action - Action for push notification. + * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} params.icon - Icon for push notification. Available only for Android and Web Platform. + * @param {string} params.sound - Sound for push notification. Available only for Android and iOS Platform. + * @param {string} params.color - Color for push notification. Available only for Android Platform. + * @param {string} params.tag - Tag for push notification. Available only for Android Platform. + * @param {number} params.badge - Badge for push notification. Available only for iOS Platform. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + createPush(params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; + /** + * Create a new push notification. + * + * @param {string} messageId - Message 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. + * @param {string} title - Title for push notification. + * @param {string} body - Body for push notification. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {object} data - Additional key-value pair data for push notification. + * @param {string} action - Action for push notification. + * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} icon - Icon for push notification. Available only for Android and Web Platform. + * @param {string} sound - Sound for push notification. Available only for Android and iOS Platform. + * @param {string} color - Color for push notification. Available only for Android Platform. + * @param {string} tag - Tag for push notification. Available only for Android Platform. + * @param {number} badge - Badge for push notification. Available only for iOS Platform. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device state and may not deliver notifications immediately. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPush(messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; + createPush( + paramsOrFirst: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, + ...rest: [(string)?, (string)?, (string[])?, (string[])?, (string[])?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] + ): Promise<Models.Message> { + let params: { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, title?: string, body?: string, topics?: string[], users?: string[], targets?: string[], data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + } else { + params = { + messageId: paramsOrFirst as string, + title: rest[0] as string, + body: rest[1] as string, + topics: rest[2] as string[], + users: rest[3] as string[], + targets: rest[4] as string[], + data: rest[5] as object, + action: rest[6] as string, + image: rest[7] as string, + icon: rest[8] as string, + sound: rest[9] as string, + color: rest[10] as string, + tag: rest[11] as string, + badge: rest[12] as number, + draft: rest[13] as boolean, + scheduledAt: rest[14] as string, + contentAvailable: rest[15] as boolean, + critical: rest[16] as boolean, + priority: rest[17] as MessagePriority + }; + } + + const messageId = params.messageId; + const title = params.title; + const body = params.body; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const data = params.data; + const action = params.action; + const image = params.image; + const icon = params.icon; + const sound = params.sound; + const color = params.color; + const tag = params.tag; + const badge = params.badge; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + const contentAvailable = params.contentAvailable; + const critical = params.critical; + const priority = params.priority; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/push'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof title !== 'undefined') { + payload['title'] = title; + } + if (typeof body !== 'undefined') { + payload['body'] = body; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof action !== 'undefined') { + payload['action'] = action; + } + if (typeof image !== 'undefined') { + payload['image'] = image; + } + if (typeof icon !== 'undefined') { + payload['icon'] = icon; + } + if (typeof sound !== 'undefined') { + payload['sound'] = sound; + } + if (typeof color !== 'undefined') { + payload['color'] = color; + } + if (typeof tag !== 'undefined') { + payload['tag'] = tag; + } + if (typeof badge !== 'undefined') { + payload['badge'] = badge; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + if (typeof contentAvailable !== 'undefined') { + payload['contentAvailable'] = contentAvailable; + } + if (typeof critical !== 'undefined') { + payload['critical'] = critical; + } + if (typeof priority !== 'undefined') { + payload['priority'] = priority; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.title - Title for push notification. + * @param {string} params.body - Body for push notification. + * @param {object} params.data - Additional Data for push notification. + * @param {string} params.action - Action for push notification. + * @param {string} params.image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} params.icon - Icon for push notification. Available only for Android and Web platforms. + * @param {string} params.sound - Sound for push notification. Available only for Android and iOS platforms. + * @param {string} params.color - Color for push notification. Available only for Android platforms. + * @param {string} params.tag - Tag for push notification. Available only for Android platforms. + * @param {number} params.badge - Badge for push notification. Available only for iOS platforms. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} params.contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} params.critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} params.priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + updatePush(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }): Promise<Models.Message>; + /** + * Update a push notification by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} title - Title for push notification. + * @param {string} body - Body for push notification. + * @param {object} data - Additional Data for push notification. + * @param {string} action - Action for push notification. + * @param {string} image - Image for push notification. Must be a compound bucket ID to file ID of a jpeg, png, or bmp image in Appwrite Storage. It should be formatted as <BUCKET_ID>:<FILE_ID>. + * @param {string} icon - Icon for push notification. Available only for Android and Web platforms. + * @param {string} sound - Sound for push notification. Available only for Android and iOS platforms. + * @param {string} color - Color for push notification. Available only for Android platforms. + * @param {string} tag - Tag for push notification. Available only for Android platforms. + * @param {number} badge - Badge for push notification. Available only for iOS platforms. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @param {boolean} contentAvailable - If set to true, the notification will be delivered in the background. Available only for iOS Platform. + * @param {boolean} critical - If set to true, the notification will be marked as critical. This requires the app to have the critical notification entitlement. Available only for iOS Platform. + * @param {MessagePriority} priority - Set the notification priority. "normal" will consider device battery state and may send notifications later. "high" will always attempt to immediately deliver the notification. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePush(messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority): Promise<Models.Message>; + updatePush( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (string)?, (object)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?, (MessagePriority)?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], title?: string, body?: string, data?: object, action?: string, image?: string, icon?: string, sound?: string, color?: string, tag?: string, badge?: number, draft?: boolean, scheduledAt?: string, contentAvailable?: boolean, critical?: boolean, priority?: MessagePriority }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + title: rest[3] as string, + body: rest[4] as string, + data: rest[5] as object, + action: rest[6] as string, + image: rest[7] as string, + icon: rest[8] as string, + sound: rest[9] as string, + color: rest[10] as string, + tag: rest[11] as string, + badge: rest[12] as number, + draft: rest[13] as boolean, + scheduledAt: rest[14] as string, + contentAvailable: rest[15] as boolean, + critical: rest[16] as boolean, + priority: rest[17] as MessagePriority + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const title = params.title; + const body = params.body; + const data = params.data; + const action = params.action; + const image = params.image; + const icon = params.icon; + const sound = params.sound; + const color = params.color; + const tag = params.tag; + const badge = params.badge; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + const contentAvailable = params.contentAvailable; + const critical = params.critical; + const priority = params.priority; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/push/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof title !== 'undefined') { + payload['title'] = title; + } + if (typeof body !== 'undefined') { + payload['body'] = body; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof action !== 'undefined') { + payload['action'] = action; + } + if (typeof image !== 'undefined') { + payload['image'] = image; + } + if (typeof icon !== 'undefined') { + payload['icon'] = icon; + } + if (typeof sound !== 'undefined') { + payload['sound'] = sound; + } + if (typeof color !== 'undefined') { + payload['color'] = color; + } + if (typeof tag !== 'undefined') { + payload['tag'] = tag; + } + if (typeof badge !== 'undefined') { + payload['badge'] = badge; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + if (typeof contentAvailable !== 'undefined') { + payload['contentAvailable'] = contentAvailable; + } + if (typeof critical !== 'undefined') { + payload['critical'] = critical; + } + if (typeof priority !== 'undefined') { + payload['priority'] = priority; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new SMS message. + * + * @param {string} params.messageId - Message 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. + * @param {string} params.content - SMS Content. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMS` instead. + */ + createSms(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Create a new SMS message. + * + * @param {string} messageId - Message 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. + * @param {string} content - SMS Content. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSms(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + createSms( + paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + content: rest[0] as string, + topics: rest[1] as string[], + users: rest[2] as string[], + targets: rest[3] as string[], + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const content = params.content; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + if (typeof content === 'undefined') { + throw new AppwriteException('Missing required parameter: "content"'); + } + + const apiPath = '/messaging/messages/sms'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new SMS message. + * + * @param {string} params.messageId - Message 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. + * @param {string} params.content - SMS Content. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + createSMS(params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Create a new SMS message. + * + * @param {string} messageId - Message 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. + * @param {string} content - SMS Content. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSMS(messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + createSMS( + paramsOrFirst: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string)?, (string[])?, (string[])?, (string[])?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, content: string, topics?: string[], users?: string[], targets?: string[], draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + content: rest[0] as string, + topics: rest[1] as string[], + users: rest[2] as string[], + targets: rest[3] as string[], + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const content = params.content; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + if (typeof content === 'undefined') { + throw new AppwriteException('Missing required parameter: "content"'); + } + + const apiPath = '/messaging/messages/sms'; + const payload: Payload = {}; + if (typeof messageId !== 'undefined') { + payload['messageId'] = messageId; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.content - Email Content. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMS` instead. + */ + updateSms(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} content - Email Content. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSms(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + updateSms( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + content: rest[3] as string, + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const content = params.content; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} params.messageId - Message ID. + * @param {string[]} params.topics - List of Topic IDs. + * @param {string[]} params.users - List of User IDs. + * @param {string[]} params.targets - List of Targets IDs. + * @param {string} params.content - Email Content. + * @param {boolean} params.draft - Is message a draft + * @param {string} params.scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + updateSMS(params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }): Promise<Models.Message>; + /** + * Update an SMS message by its unique ID. This endpoint only works on messages that are in draft status. Messages that are already processing, sent, or failed cannot be updated. + * + * + * @param {string} messageId - Message ID. + * @param {string[]} topics - List of Topic IDs. + * @param {string[]} users - List of User IDs. + * @param {string[]} targets - List of Targets IDs. + * @param {string} content - Email Content. + * @param {boolean} draft - Is message a draft + * @param {string} scheduledAt - Scheduled delivery time for message in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSMS(messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string): Promise<Models.Message>; + updateSMS( + paramsOrFirst: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string } | string, + ...rest: [(string[])?, (string[])?, (string[])?, (string)?, (boolean)?, (string)?] + ): Promise<Models.Message> { + let params: { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, topics?: string[], users?: string[], targets?: string[], content?: string, draft?: boolean, scheduledAt?: string }; + } else { + params = { + messageId: paramsOrFirst as string, + topics: rest[0] as string[], + users: rest[1] as string[], + targets: rest[2] as string[], + content: rest[3] as string, + draft: rest[4] as boolean, + scheduledAt: rest[5] as string + }; + } + + const messageId = params.messageId; + const topics = params.topics; + const users = params.users; + const targets = params.targets; + const content = params.content; + const draft = params.draft; + const scheduledAt = params.scheduledAt; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/sms/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof topics !== 'undefined') { + payload['topics'] = topics; + } + if (typeof users !== 'undefined') { + payload['users'] = users; + } + if (typeof targets !== 'undefined') { + payload['targets'] = targets; + } + if (typeof content !== 'undefined') { + payload['content'] = content; + } + if (typeof draft !== 'undefined') { + payload['draft'] = draft; + } + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a message by its unique ID. + * + * + * @param {string} params.messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + */ + getMessage(params: { messageId: string }): Promise<Models.Message>; + /** + * Get a message by its unique ID. + * + * + * @param {string} messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Message>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMessage(messageId: string): Promise<Models.Message>; + getMessage( + paramsOrFirst: { messageId: string } | string + ): Promise<Models.Message> { + let params: { messageId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string }; + } else { + params = { + messageId: paramsOrFirst as string + }; + } + + const messageId = params.messageId; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + * + * @param {string} params.messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { messageId: string }): Promise<{}>; + /** + * Delete a message. If the message is not a draft or scheduled, but has been sent, this will not recall the message. + * + * @param {string} messageId - Message ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(messageId: string): Promise<{}>; + delete( + paramsOrFirst: { messageId: string } | string + ): Promise<{}> { + let params: { messageId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string }; + } else { + params = { + messageId: paramsOrFirst as string + }; + } + + const messageId = params.messageId; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}'.replace('{messageId}', messageId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the message activity logs listed by its unique ID. + * + * @param {string} params.messageId - Message ID. + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listMessageLogs(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the message activity logs listed by its unique ID. + * + * @param {string} messageId - Message ID. + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMessageLogs(messageId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listMessageLogs( + paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { messageId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; + } else { + params = { + messageId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const messageId = params.messageId; + const queries = params.queries; + const total = params.total; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}/logs'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of the targets associated with a message. + * + * @param {string} params.messageId - Message ID. + * @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, providerId, identifier, providerType + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + */ + listTargets(params: { messageId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; + /** + * Get a list of the targets associated with a message. + * + * @param {string} messageId - Message ID. + * @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, providerId, identifier, providerType + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTargets(messageId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; + listTargets( + paramsOrFirst: { messageId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.TargetList> { + let params: { messageId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { messageId: string, queries?: string[], total?: boolean }; + } else { + params = { + messageId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const messageId = params.messageId; + const queries = params.queries; + const total = params.total; + + if (typeof messageId === 'undefined') { + throw new AppwriteException('Missing required parameter: "messageId"'); + } + + const apiPath = '/messaging/messages/{messageId}/targets'.replace('{messageId}', messageId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all providers from the current Appwrite project. + * + * @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: name, provider, type, enabled + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProviderList>} + */ + listProviders(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.ProviderList>; + /** + * Get a list of all providers from the current Appwrite project. + * + * @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: name, provider, type, enabled + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProviderList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listProviders(queries?: string[], search?: string, total?: boolean): Promise<Models.ProviderList>; + listProviders( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.ProviderList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/messaging/providers'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createAPNSProvider` instead. + */ + createApnsProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createApnsProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; + createApnsProvider( + paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + authKey: rest[1] as string, + authKeyId: rest[2] as string, + teamId: rest[3] as string, + bundleId: rest[4] as string, + sandbox: rest[5] as boolean, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/apns'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createAPNSProvider(params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Apple Push Notification service provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createAPNSProvider(providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean): Promise<Models.Provider>; + createAPNSProvider( + paramsOrFirst: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + authKey: rest[1] as string, + authKeyId: rest[2] as string, + teamId: rest[3] as string, + bundleId: rest[4] as string, + sandbox: rest[5] as boolean, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/apns'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateAPNSProvider` instead. + */ + updateApnsProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateApnsProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; + updateApnsProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + authKey: rest[2] as string, + authKeyId: rest[3] as string, + teamId: rest[4] as string, + bundleId: rest[5] as string, + sandbox: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.authKey - APNS authentication key. + * @param {string} params.authKeyId - APNS authentication key ID. + * @param {string} params.teamId - APNS team ID. + * @param {string} params.bundleId - APNS bundle ID. + * @param {boolean} params.sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateAPNSProvider(params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; + /** + * Update a Apple Push Notification service provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} authKey - APNS authentication key. + * @param {string} authKeyId - APNS authentication key ID. + * @param {string} teamId - APNS team ID. + * @param {string} bundleId - APNS bundle ID. + * @param {boolean} sandbox - Use APNS sandbox environment. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAPNSProvider(providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean): Promise<Models.Provider>; + updateAPNSProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + authKey: rest[2] as string, + authKeyId: rest[3] as string, + teamId: rest[4] as string, + bundleId: rest[5] as string, + sandbox: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const authKey = params.authKey; + const authKeyId = params.authKeyId; + const teamId = params.teamId; + const bundleId = params.bundleId; + const sandbox = params.sandbox; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/apns/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof authKeyId !== 'undefined') { + payload['authKeyId'] = authKeyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof bundleId !== 'undefined') { + payload['bundleId'] = bundleId; + } + if (typeof sandbox !== 'undefined') { + payload['sandbox'] = sandbox; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createFCMProvider` instead. + */ + createFcmProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFcmProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; + createFcmProvider( + paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, + ...rest: [(string)?, (object)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + serviceAccountJSON: rest[1] as object, + enabled: rest[2] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const serviceAccountJSON = params.serviceAccountJSON; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/fcm'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createFCMProvider(params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Firebase Cloud Messaging provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFCMProvider(providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean): Promise<Models.Provider>; + createFCMProvider( + paramsOrFirst: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean } | string, + ...rest: [(string)?, (object)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + serviceAccountJSON: rest[1] as object, + enabled: rest[2] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const serviceAccountJSON = params.serviceAccountJSON; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/fcm'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateFCMProvider` instead. + */ + updateFcmProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFcmProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; + updateFcmProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, + ...rest: [(string)?, (boolean)?, (object)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + serviceAccountJSON: rest[2] as object + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const serviceAccountJSON = params.serviceAccountJSON; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateFCMProvider(params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; + /** + * Update a Firebase Cloud Messaging provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {object} serviceAccountJSON - FCM service account JSON. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFCMProvider(providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; + updateFCMProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object } | string, + ...rest: [(string)?, (boolean)?, (object)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + serviceAccountJSON: rest[2] as object + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const serviceAccountJSON = params.serviceAccountJSON; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Mailgun provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Mailgun API Key. + * @param {string} params.domain - Mailgun Domain. + * @param {boolean} params.isEuRegion - Set as EU region. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createMailgunProvider(params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Mailgun provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} apiKey - Mailgun API Key. + * @param {string} domain - Mailgun Domain. + * @param {boolean} isEuRegion - Set as EU region. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. Reply to name must have reply to email as well. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. Reply to email must have reply to name as well. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMailgunProvider(providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createMailgunProvider( + paramsOrFirst: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, domain?: string, isEuRegion?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + domain: rest[2] as string, + isEuRegion: rest[3] as boolean, + fromName: rest[4] as string, + fromEmail: rest[5] as string, + replyToName: rest[6] as string, + replyToEmail: rest[7] as string, + enabled: rest[8] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const domain = params.domain; + const isEuRegion = params.isEuRegion; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/mailgun'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof isEuRegion !== 'undefined') { + payload['isEuRegion'] = isEuRegion; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Mailgun provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Mailgun API Key. + * @param {string} params.domain - Mailgun Domain. + * @param {boolean} params.isEuRegion - Set as EU region. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateMailgunProvider(params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + /** + * Update a Mailgun provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {string} apiKey - Mailgun API Key. + * @param {string} domain - Mailgun Domain. + * @param {boolean} isEuRegion - Set as EU region. + * @param {boolean} enabled - Set as enabled. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMailgunProvider(providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateMailgunProvider( + paramsOrFirst: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, apiKey?: string, domain?: string, isEuRegion?: boolean, enabled?: boolean, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + domain: rest[2] as string, + isEuRegion: rest[3] as boolean, + enabled: rest[4] as boolean, + fromName: rest[5] as string, + fromEmail: rest[6] as string, + replyToName: rest[7] as string, + replyToEmail: rest[8] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const domain = params.domain; + const isEuRegion = params.isEuRegion; + const enabled = params.enabled; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/mailgun/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof isEuRegion !== 'undefined') { + payload['isEuRegion'] = isEuRegion; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new MSG91 provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.templateId - Msg91 template ID + * @param {string} params.senderId - Msg91 sender ID. + * @param {string} params.authKey - Msg91 auth key. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createMsg91Provider(params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new MSG91 provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} templateId - Msg91 template ID + * @param {string} senderId - Msg91 sender ID. + * @param {string} authKey - Msg91 auth key. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMsg91Provider(providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean): Promise<Models.Provider>; + createMsg91Provider( + paramsOrFirst: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, templateId?: string, senderId?: string, authKey?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + templateId: rest[1] as string, + senderId: rest[2] as string, + authKey: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const templateId = params.templateId; + const senderId = params.senderId; + const authKey = params.authKey; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/msg91'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof templateId !== 'undefined') { + payload['templateId'] = templateId; + } + if (typeof senderId !== 'undefined') { + payload['senderId'] = senderId; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a MSG91 provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.templateId - Msg91 template ID. + * @param {string} params.senderId - Msg91 sender ID. + * @param {string} params.authKey - Msg91 auth key. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateMsg91Provider(params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }): Promise<Models.Provider>; + /** + * Update a MSG91 provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} templateId - Msg91 template ID. + * @param {string} senderId - Msg91 sender ID. + * @param {string} authKey - Msg91 auth key. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMsg91Provider(providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string): Promise<Models.Provider>; + updateMsg91Provider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, templateId?: string, senderId?: string, authKey?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + templateId: rest[2] as string, + senderId: rest[3] as string, + authKey: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const templateId = params.templateId; + const senderId = params.senderId; + const authKey = params.authKey; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/msg91/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof templateId !== 'undefined') { + payload['templateId'] = templateId; + } + if (typeof senderId !== 'undefined') { + payload['senderId'] = senderId; + } + if (typeof authKey !== 'undefined') { + payload['authKey'] = authKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Resend provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Resend API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createResendProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Resend provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} apiKey - Resend API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createResendProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createResendProvider( + paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + fromName: rest[2] as string, + fromEmail: rest[3] as string, + replyToName: rest[4] as string, + replyToEmail: rest[5] as string, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/resend'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Resend provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.apiKey - Resend API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateResendProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + /** + * Update a Resend provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} apiKey - Resend API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateResendProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateResendProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + apiKey: rest[2] as string, + fromName: rest[3] as string, + fromEmail: rest[4] as string, + replyToName: rest[5] as string, + replyToEmail: rest[6] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/resend/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Sendgrid provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.apiKey - Sendgrid API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createSendgridProvider(params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Sendgrid provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} apiKey - Sendgrid API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSendgridProvider(providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSendgridProvider( + paramsOrFirst: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + apiKey: rest[1] as string, + fromName: rest[2] as string, + fromEmail: rest[3] as string, + replyToName: rest[4] as string, + replyToEmail: rest[5] as string, + enabled: rest[6] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/sendgrid'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Sendgrid provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.apiKey - Sendgrid API key. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateSendgridProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + /** + * Update a Sendgrid provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} apiKey - Sendgrid API key. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSendgridProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string): Promise<Models.Provider>; + updateSendgridProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + apiKey: rest[2] as string, + fromName: rest[3] as string, + fromEmail: rest[4] as string, + replyToName: rest[5] as string, + replyToEmail: rest[6] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const apiKey = params.apiKey; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/sendgrid/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new SMTP provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - The default SMTP server port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.createSMTPProvider` instead. + */ + createSmtpProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new SMTP provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - The default SMTP server port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSmtpProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSmtpProvider( + paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof host === 'undefined') { + throw new AppwriteException('Missing required parameter: "host"'); + } + + const apiPath = '/messaging/providers/smtp'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new SMTP provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - The default SMTP server port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} params.replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createSMTPProvider(params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new SMTP provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - The default SMTP server port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the reply to field for the mail. Default value is sender name. + * @param {string} replyToEmail - Email set in the reply to field for the mail. Default value is sender email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSMTPProvider(providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + createSMTPProvider( + paramsOrFirst: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, host: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof host === 'undefined') { + throw new AppwriteException('Missing required parameter: "host"'); + } + + const apiPath = '/messaging/providers/smtp'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - SMTP port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead. + */ + updateSmtpProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - SMTP port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSmtpProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + updateSmtpProvider( + paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {string} params.host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} params.port - SMTP port. + * @param {string} params.username - Authentication username. + * @param {string} params.password - Authentication password. + * @param {SmtpEncryption} params.encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} params.autoTLS - Enable SMTP AutoTLS feature. + * @param {string} params.mailer - The value to use for the X-Mailer header. + * @param {string} params.fromName - Sender Name. + * @param {string} params.fromEmail - Sender email address. + * @param {string} params.replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} params.replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateSMTPProvider(params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Update a SMTP provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {string} host - SMTP hosts. Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host such as `smtp1.example.com:25;smtp2.example.com`. You can also specify encryption type, for example: `tls://smtp1.example.com:587;ssl://smtp2.example.com:465"`. Hosts will be tried in order. + * @param {number} port - SMTP port. + * @param {string} username - Authentication username. + * @param {string} password - Authentication password. + * @param {SmtpEncryption} encryption - Encryption type. Can be 'ssl' or 'tls' + * @param {boolean} autoTLS - Enable SMTP AutoTLS feature. + * @param {string} mailer - The value to use for the X-Mailer header. + * @param {string} fromName - Sender Name. + * @param {string} fromEmail - Sender email address. + * @param {string} replyToName - Name set in the Reply To field for the mail. Default value is Sender Name. + * @param {string} replyToEmail - Email set in the Reply To field for the mail. Default value is Sender Email. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSMTPProvider(providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean): Promise<Models.Provider>; + updateSMTPProvider( + paramsOrFirst: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (string)?, (string)?, (SmtpEncryption)?, (boolean)?, (string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, host?: string, port?: number, username?: string, password?: string, encryption?: SmtpEncryption, autoTLS?: boolean, mailer?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + host: rest[1] as string, + port: rest[2] as number, + username: rest[3] as string, + password: rest[4] as string, + encryption: rest[5] as SmtpEncryption, + autoTLS: rest[6] as boolean, + mailer: rest[7] as string, + fromName: rest[8] as string, + fromEmail: rest[9] as string, + replyToName: rest[10] as string, + replyToEmail: rest[11] as string, + enabled: rest[12] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const encryption = params.encryption; + const autoTLS = params.autoTLS; + const mailer = params.mailer; + const fromName = params.fromName; + const fromEmail = params.fromEmail; + const replyToName = params.replyToName; + const replyToEmail = params.replyToEmail; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof autoTLS !== 'undefined') { + payload['autoTLS'] = autoTLS; + } + if (typeof mailer !== 'undefined') { + payload['mailer'] = mailer; + } + if (typeof fromName !== 'undefined') { + payload['fromName'] = fromName; + } + if (typeof fromEmail !== 'undefined') { + payload['fromEmail'] = fromEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Telesign provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.customerId - Telesign customer ID. + * @param {string} params.apiKey - Telesign API key. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createTelesignProvider(params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Telesign provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} customerId - Telesign customer ID. + * @param {string} apiKey - Telesign API key. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTelesignProvider(providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; + createTelesignProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, customerId?: string, apiKey?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + customerId: rest[2] as string, + apiKey: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const customerId = params.customerId; + const apiKey = params.apiKey; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/telesign'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof customerId !== 'undefined') { + payload['customerId'] = customerId; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Telesign provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.customerId - Telesign customer ID. + * @param {string} params.apiKey - Telesign API key. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateTelesignProvider(params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Telesign provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} customerId - Telesign customer ID. + * @param {string} apiKey - Telesign API key. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTelesignProvider(providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string): Promise<Models.Provider>; + updateTelesignProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, customerId?: string, apiKey?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + customerId: rest[2] as string, + apiKey: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const customerId = params.customerId; + const apiKey = params.apiKey; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/telesign/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof customerId !== 'undefined') { + payload['customerId'] = customerId; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Textmagic provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.username - Textmagic username. + * @param {string} params.apiKey - Textmagic apiKey. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createTextmagicProvider(params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Textmagic provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} username - Textmagic username. + * @param {string} apiKey - Textmagic apiKey. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextmagicProvider(providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean): Promise<Models.Provider>; + createTextmagicProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, username?: string, apiKey?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + username: rest[2] as string, + apiKey: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const username = params.username; + const apiKey = params.apiKey; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/textmagic'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Textmagic provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.username - Textmagic username. + * @param {string} params.apiKey - Textmagic apiKey. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateTextmagicProvider(params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Textmagic provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} username - Textmagic username. + * @param {string} apiKey - Textmagic apiKey. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTextmagicProvider(providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string): Promise<Models.Provider>; + updateTextmagicProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, username?: string, apiKey?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + username: rest[2] as string, + apiKey: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const username = params.username; + const apiKey = params.apiKey; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/textmagic/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Twilio provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.accountSid - Twilio account secret ID. + * @param {string} params.authToken - Twilio authentication token. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createTwilioProvider(params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Twilio provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} accountSid - Twilio account secret ID. + * @param {string} authToken - Twilio authentication token. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTwilioProvider(providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean): Promise<Models.Provider>; + createTwilioProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, accountSid?: string, authToken?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + accountSid: rest[2] as string, + authToken: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const accountSid = params.accountSid; + const authToken = params.authToken; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/twilio'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof accountSid !== 'undefined') { + payload['accountSid'] = accountSid; + } + if (typeof authToken !== 'undefined') { + payload['authToken'] = authToken; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Twilio provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.accountSid - Twilio account secret ID. + * @param {string} params.authToken - Twilio authentication token. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateTwilioProvider(params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Twilio provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} accountSid - Twilio account secret ID. + * @param {string} authToken - Twilio authentication token. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTwilioProvider(providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string): Promise<Models.Provider>; + updateTwilioProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, accountSid?: string, authToken?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + accountSid: rest[2] as string, + authToken: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const accountSid = params.accountSid; + const authToken = params.authToken; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/twilio/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof accountSid !== 'undefined') { + payload['accountSid'] = accountSid; + } + if (typeof authToken !== 'undefined') { + payload['authToken'] = authToken; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Vonage provider. + * + * @param {string} params.providerId - Provider 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. + * @param {string} params.name - Provider name. + * @param {string} params.from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.apiKey - Vonage API key. + * @param {string} params.apiSecret - Vonage API secret. + * @param {boolean} params.enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + createVonageProvider(params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.Provider>; + /** + * Create a new Vonage provider. + * + * @param {string} providerId - Provider 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. + * @param {string} name - Provider name. + * @param {string} from - Sender Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} apiKey - Vonage API key. + * @param {string} apiSecret - Vonage API secret. + * @param {boolean} enabled - Set as enabled. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVonageProvider(providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.Provider>; + createVonageProvider( + paramsOrFirst: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name: string, from?: string, apiKey?: string, apiSecret?: string, enabled?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + from: rest[1] as string, + apiKey: rest[2] as string, + apiSecret: rest[3] as string, + enabled: rest[4] as boolean + }; + } + + const providerId = params.providerId; + const name = params.name; + const from = params.from; + const apiKey = params.apiKey; + const apiSecret = params.apiSecret; + const enabled = params.enabled; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/providers/vonage'; + const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof apiSecret !== 'undefined') { + payload['apiSecret'] = apiSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Vonage provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @param {string} params.name - Provider name. + * @param {boolean} params.enabled - Set as enabled. + * @param {string} params.apiKey - Vonage API key. + * @param {string} params.apiSecret - Vonage API secret. + * @param {string} params.from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + updateVonageProvider(params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }): Promise<Models.Provider>; + /** + * Update a Vonage provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @param {string} name - Provider name. + * @param {boolean} enabled - Set as enabled. + * @param {string} apiKey - Vonage API key. + * @param {string} apiSecret - Vonage API secret. + * @param {string} from - Sender number. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVonageProvider(providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string): Promise<Models.Provider>; + updateVonageProvider( + paramsOrFirst: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string } | string, + ...rest: [(string)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Provider> { + let params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, apiKey?: string, apiSecret?: string, from?: string }; + } else { + params = { + providerId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + apiKey: rest[2] as string, + apiSecret: rest[3] as string, + from: rest[4] as string + }; + } + + const providerId = params.providerId; + const name = params.name; + const enabled = params.enabled; + const apiKey = params.apiKey; + const apiSecret = params.apiSecret; + const from = params.from; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/vonage/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof apiSecret !== 'undefined') { + payload['apiSecret'] = apiSecret; + } + if (typeof from !== 'undefined') { + payload['from'] = from; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a provider by its unique ID. + * + * + * @param {string} params.providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + */ + getProvider(params: { providerId: string }): Promise<Models.Provider>; + /** + * Get a provider by its unique ID. + * + * + * @param {string} providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Provider>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getProvider(providerId: string): Promise<Models.Provider>; + getProvider( + paramsOrFirst: { providerId: string } | string + ): Promise<Models.Provider> { + let params: { providerId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string }; + } else { + params = { + providerId: paramsOrFirst as string + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a provider by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteProvider(params: { providerId: string }): Promise<{}>; + /** + * Delete a provider by its unique ID. + * + * @param {string} providerId - Provider ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteProvider(providerId: string): Promise<{}>; + deleteProvider( + paramsOrFirst: { providerId: string } | string + ): Promise<{}> { + let params: { providerId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string }; + } else { + params = { + providerId: paramsOrFirst as string + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the provider activity logs listed by its unique ID. + * + * @param {string} params.providerId - Provider ID. + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listProviderLogs(params: { providerId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the provider activity logs listed by its unique ID. + * + * @param {string} providerId - Provider ID. + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listProviderLogs(providerId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listProviderLogs( + paramsOrFirst: { providerId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { providerId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: string, queries?: string[], total?: boolean }; + } else { + params = { + providerId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const providerId = params.providerId; + const queries = params.queries; + const total = params.total; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/messaging/providers/{providerId}/logs'.replace('{providerId}', providerId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the subscriber activity logs listed by its unique ID. + * + * @param {string} params.subscriberId - Subscriber ID. + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listSubscriberLogs(params: { subscriberId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the subscriber activity logs listed by its unique ID. + * + * @param {string} subscriberId - Subscriber ID. + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSubscriberLogs(subscriberId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listSubscriberLogs( + paramsOrFirst: { subscriberId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { subscriberId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { subscriberId: string, queries?: string[], total?: boolean }; + } else { + params = { + subscriberId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const subscriberId = params.subscriberId; + const queries = params.queries; + const total = params.total; + + if (typeof subscriberId === 'undefined') { + throw new AppwriteException('Missing required parameter: "subscriberId"'); + } + + const apiPath = '/messaging/subscribers/{subscriberId}/logs'.replace('{subscriberId}', subscriberId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all topics from the current Appwrite project. + * + * @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: name, description, emailTotal, smsTotal, pushTotal + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TopicList>} + */ + listTopics(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TopicList>; + /** + * Get a list of all topics from the current Appwrite project. + * + * @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: name, description, emailTotal, smsTotal, pushTotal + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TopicList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTopics(queries?: string[], search?: string, total?: boolean): Promise<Models.TopicList>; + listTopics( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.TopicList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/messaging/topics'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new topic. + * + * @param {string} params.topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. + * @param {string} params.name - Topic Name. + * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + */ + createTopic(params: { topicId: string, name: string, subscribe?: string[] }): Promise<Models.Topic>; + /** + * Create a new topic. + * + * @param {string} topicId - Topic ID. Choose a custom Topic ID or a new Topic ID. + * @param {string} name - Topic Name. + * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTopic(topicId: string, name: string, subscribe?: string[]): Promise<Models.Topic>; + createTopic( + paramsOrFirst: { topicId: string, name: string, subscribe?: string[] } | string, + ...rest: [(string)?, (string[])?] + ): Promise<Models.Topic> { + let params: { topicId: string, name: string, subscribe?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, name: string, subscribe?: string[] }; + } else { + params = { + topicId: paramsOrFirst as string, + name: rest[0] as string, + subscribe: rest[1] as string[] + }; + } + + const topicId = params.topicId; + const name = params.name; + const subscribe = params.subscribe; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/messaging/topics'; + const payload: Payload = {}; + if (typeof topicId !== 'undefined') { + payload['topicId'] = topicId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof subscribe !== 'undefined') { + payload['subscribe'] = subscribe; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a topic by its unique ID. + * + * + * @param {string} params.topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + */ + getTopic(params: { topicId: string }): Promise<Models.Topic>; + /** + * Get a topic by its unique ID. + * + * + * @param {string} topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTopic(topicId: string): Promise<Models.Topic>; + getTopic( + paramsOrFirst: { topicId: string } | string + ): Promise<Models.Topic> { + let params: { topicId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string }; + } else { + params = { + topicId: paramsOrFirst as string + }; + } + + const topicId = params.topicId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a topic by its unique ID. + * + * + * @param {string} params.topicId - Topic ID. + * @param {string} params.name - Topic Name. + * @param {string[]} params.subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + */ + updateTopic(params: { topicId: string, name?: string, subscribe?: string[] }): Promise<Models.Topic>; + /** + * Update a topic by its unique ID. + * + * + * @param {string} topicId - Topic ID. + * @param {string} name - Topic Name. + * @param {string[]} subscribe - An array of role strings with subscribe permission. By default all users are granted with any subscribe permission. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Topic>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTopic(topicId: string, name?: string, subscribe?: string[]): Promise<Models.Topic>; + updateTopic( + paramsOrFirst: { topicId: string, name?: string, subscribe?: string[] } | string, + ...rest: [(string)?, (string[])?] + ): Promise<Models.Topic> { + let params: { topicId: string, name?: string, subscribe?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, name?: string, subscribe?: string[] }; + } else { + params = { + topicId: paramsOrFirst as string, + name: rest[0] as string, + subscribe: rest[1] as string[] + }; + } + + const topicId = params.topicId; + const name = params.name; + const subscribe = params.subscribe; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof subscribe !== 'undefined') { + payload['subscribe'] = subscribe; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a topic by its unique ID. + * + * @param {string} params.topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTopic(params: { topicId: string }): Promise<{}>; + /** + * Delete a topic by its unique ID. + * + * @param {string} topicId - Topic ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTopic(topicId: string): Promise<{}>; + deleteTopic( + paramsOrFirst: { topicId: string } | string + ): Promise<{}> { + let params: { topicId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string }; + } else { + params = { + topicId: paramsOrFirst as string + }; + } + + const topicId = params.topicId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}'.replace('{topicId}', topicId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the topic activity logs listed by its unique ID. + * + * @param {string} params.topicId - Topic ID. + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listTopicLogs(params: { topicId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the topic activity logs listed by its unique ID. + * + * @param {string} topicId - Topic ID. + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTopicLogs(topicId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listTopicLogs( + paramsOrFirst: { topicId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { topicId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], total?: boolean }; + } else { + params = { + topicId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const topicId = params.topicId; + const queries = params.queries; + const total = params.total; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}/logs'.replace('{topicId}', topicId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all subscribers from the current Appwrite project. + * + * @param {string} params.topicId - Topic ID. The topic ID subscribed to. + * @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: targetId, topicId, userId, providerType + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SubscriberList>} + */ + listSubscribers(params: { topicId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.SubscriberList>; + /** + * Get a list of all subscribers from the current Appwrite project. + * + * @param {string} topicId - Topic ID. The topic ID subscribed to. + * @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: targetId, topicId, userId, providerType + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SubscriberList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSubscribers(topicId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.SubscriberList>; + listSubscribers( + paramsOrFirst: { topicId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.SubscriberList> { + let params: { topicId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + topicId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const topicId = params.topicId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + + const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new subscriber. + * + * @param {string} params.topicId - Topic ID. The topic ID to subscribe to. + * @param {string} params.subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. + * @param {string} params.targetId - Target ID. The target ID to link to the specified Topic ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Subscriber>} + */ + createSubscriber(params: { topicId: string, subscriberId: string, targetId: string }): Promise<Models.Subscriber>; + /** + * Create a new subscriber. + * + * @param {string} topicId - Topic ID. The topic ID to subscribe to. + * @param {string} subscriberId - Subscriber ID. Choose a custom Subscriber ID or a new Subscriber ID. + * @param {string} targetId - Target ID. The target ID to link to the specified Topic ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Subscriber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSubscriber(topicId: string, subscriberId: string, targetId: string): Promise<Models.Subscriber>; + createSubscriber( + paramsOrFirst: { topicId: string, subscriberId: string, targetId: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Subscriber> { + let params: { topicId: string, subscriberId: string, targetId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string, targetId: string }; + } else { + params = { + topicId: paramsOrFirst as string, + subscriberId: rest[0] as string, + targetId: rest[1] as string + }; + } + + const topicId = params.topicId; + const subscriberId = params.subscriberId; + const targetId = params.targetId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + if (typeof subscriberId === 'undefined') { + throw new AppwriteException('Missing required parameter: "subscriberId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/messaging/topics/{topicId}/subscribers'.replace('{topicId}', topicId); + const payload: Payload = {}; + if (typeof subscriberId !== 'undefined') { + payload['subscriberId'] = subscriberId; + } + if (typeof targetId !== 'undefined') { + payload['targetId'] = targetId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a subscriber by its unique ID. + * + * + * @param {string} params.topicId - Topic ID. The topic ID subscribed to. + * @param {string} params.subscriberId - Subscriber ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Subscriber>} + */ + getSubscriber(params: { topicId: string, subscriberId: string }): Promise<Models.Subscriber>; + /** + * Get a subscriber by its unique ID. + * + * + * @param {string} topicId - Topic ID. The topic ID subscribed to. + * @param {string} subscriberId - Subscriber ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Subscriber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getSubscriber(topicId: string, subscriberId: string): Promise<Models.Subscriber>; + getSubscriber( + paramsOrFirst: { topicId: string, subscriberId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Subscriber> { + let params: { topicId: string, subscriberId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; + } else { + params = { + topicId: paramsOrFirst as string, + subscriberId: rest[0] as string + }; + } + + const topicId = params.topicId; + const subscriberId = params.subscriberId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + if (typeof subscriberId === 'undefined') { + throw new AppwriteException('Missing required parameter: "subscriberId"'); + } + + const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a subscriber by its unique ID. + * + * @param {string} params.topicId - Topic ID. The topic ID subscribed to. + * @param {string} params.subscriberId - Subscriber ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSubscriber(params: { topicId: string, subscriberId: string }): Promise<{}>; + /** + * Delete a subscriber by its unique ID. + * + * @param {string} topicId - Topic ID. The topic ID subscribed to. + * @param {string} subscriberId - Subscriber ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSubscriber(topicId: string, subscriberId: string): Promise<{}>; + deleteSubscriber( + paramsOrFirst: { topicId: string, subscriberId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { topicId: string, subscriberId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { topicId: string, subscriberId: string }; + } else { + params = { + topicId: paramsOrFirst as string, + subscriberId: rest[0] as string + }; + } + + const topicId = params.topicId; + const subscriberId = params.subscriberId; + + if (typeof topicId === 'undefined') { + throw new AppwriteException('Missing required parameter: "topicId"'); + } + if (typeof subscriberId === 'undefined') { + throw new AppwriteException('Missing required parameter: "subscriberId"'); + } + + const apiPath = '/messaging/topics/{topicId}/subscribers/{subscriberId}'.replace('{topicId}', topicId).replace('{subscriberId}', subscriberId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/presences.ts b/src/services/presences.ts new file mode 100644 index 00000000..80cfb5b3 --- /dev/null +++ b/src/services/presences.ts @@ -0,0 +1,383 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Presences { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List presence logs. Expired entries are filtered out automatically. + * + * + * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.PresenceList<Presence>>} + */ + list<Presence extends Models.Presence = Models.DefaultPresence>(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise<Models.PresenceList<Presence>>; + /** + * List presence logs. Expired entries are filtered out automatically. + * + * + * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.PresenceList<Presence>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list<Presence extends Models.Presence = Models.DefaultPresence>(queries?: string[], total?: boolean, ttl?: number): Promise<Models.PresenceList<Presence>>; + list<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], + ...rest: [(boolean)?, (number)?] + ): Promise<Models.PresenceList<Presence>> { + let params: { queries?: string[], total?: boolean, ttl?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean, ttl?: number }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean, + ttl: rest[1] as number + }; + } + + const queries = params.queries; + const total = params.total; + const ttl = params.ttl; + + + const apiPath = '/presences'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<Presence>} + */ + get<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string }): Promise<Presence>; + /** + * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. + * + * + * @param {string} presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<Presence>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string): Promise<Presence>; + get<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string } | string + ): Promise<Presence> { + let params: { presenceId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string }; + } else { + params = { + presenceId: paramsOrFirst as string + }; + } + + const presenceId = params.presenceId; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create or update a presence log by its user ID. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @param {string} params.userId - User ID. + * @param {string} params.status - Presence status. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.expiresAt - Presence expiry datetime. + * @param {object} params.metadata - Presence metadata object. + * @throws {AppwriteException} + * @returns {Promise<Presence>} + */ + upsert<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Presence>; + /** + * Create or update a presence log by its user ID. + * + * + * @param {string} presenceId - Presence unique ID. + * @param {string} userId - User ID. + * @param {string} status - Presence status. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} expiresAt - Presence expiry datetime. + * @param {object} metadata - Presence metadata object. + * @throws {AppwriteException} + * @returns {Promise<Presence>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsert<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; + upsert<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] + ): Promise<Presence> { + let params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + } else { + params = { + presenceId: paramsOrFirst as string, + userId: rest[0] as string, + status: rest[1] as string, + permissions: rest[2] as string[], + expiresAt: rest[3] as string, + metadata: rest[4] as object + }; + } + + const presenceId = params.presenceId; + const userId = params.userId; + const status = params.status; + const permissions = params.permissions; + const expiresAt = params.expiresAt; + const metadata = params.metadata; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof expiresAt !== 'undefined') { + payload['expiresAt'] = expiresAt; + } + if (typeof metadata !== 'undefined') { + payload['metadata'] = metadata; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @param {string} params.userId - User ID. + * @param {string} params.status - Presence status. + * @param {string} params.expiresAt - Presence expiry datetime. + * @param {object} params.metadata - Presence metadata object. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.purge - When true, purge cached responses used by list presences endpoint. + * @throws {AppwriteException} + * @returns {Promise<Presence>} + */ + updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Presence>; + /** + * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * + * @param {string} presenceId - Presence unique ID. + * @param {string} userId - User ID. + * @param {string} status - Presence status. + * @param {string} expiresAt - Presence expiry datetime. + * @param {object} metadata - Presence metadata object. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} purge - When true, purge cached responses used by list presences endpoint. + * @throws {AppwriteException} + * @returns {Promise<Presence>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; + updatePresence<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (object)?, (string[])?, (boolean)?] + ): Promise<Presence> { + let params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + } else { + params = { + presenceId: paramsOrFirst as string, + userId: rest[0] as string, + status: rest[1] as string, + expiresAt: rest[2] as string, + metadata: rest[3] as object, + permissions: rest[4] as string[], + purge: rest[5] as boolean + }; + } + + const presenceId = params.presenceId; + const userId = params.userId; + const status = params.status; + const expiresAt = params.expiresAt; + const metadata = params.metadata; + const permissions = params.permissions; + const purge = params.purge; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof status !== 'undefined') { + payload['status'] = status; + } + if (typeof expiresAt !== 'undefined') { + payload['expiresAt'] = expiresAt; + } + if (typeof metadata !== 'undefined') { + payload['metadata'] = metadata; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a presence log by its unique ID. + * + * + * @param {string} params.presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { presenceId: string }): Promise<{}>; + /** + * Delete a presence log by its unique ID. + * + * + * @param {string} presenceId - Presence unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(presenceId: string): Promise<{}>; + delete( + paramsOrFirst: { presenceId: string } | string + ): Promise<{}> { + let params: { presenceId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string }; + } else { + params = { + presenceId: paramsOrFirst as string + }; + } + + const presenceId = params.presenceId; + + if (typeof presenceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "presenceId"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/project.ts b/src/services/project.ts new file mode 100644 index 00000000..898b6973 --- /dev/null +++ b/src/services/project.ts @@ -0,0 +1,6459 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { ProjectAuthMethodId } from '../enums/project-auth-method-id'; +import { ProjectKeyScopes } from '../enums/project-key-scopes'; +import { ProjectOAuth2GooglePrompt } from '../enums/project-o-auth-2-google-prompt'; +import { ProjectOAuthProviderId } from '../enums/project-o-auth-provider-id'; +import { ProjectPolicyId } from '../enums/project-policy-id'; +import { ProjectProtocolId } from '../enums/project-protocol-id'; +import { ProjectServiceId } from '../enums/project-service-id'; +import { ProjectSMTPSecure } from '../enums/project-smtp-secure'; +import { ProjectEmailTemplateId } from '../enums/project-email-template-id'; +import { ProjectEmailTemplateLocale } from '../enums/project-email-template-locale'; + +export class Project { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a project. + * + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + get(): Promise<Models.Project> { + + const apiPath = '/project'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a project. + * + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(): Promise<{}> { + + const apiPath = '/project'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. + * + * @param {ProjectAuthMethodId} params.methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {boolean} params.enabled - Auth method status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateAuthMethod(params: { methodId: ProjectAuthMethodId, enabled: boolean }): Promise<Models.Project>; + /** + * Update properties of a specific auth method. Use this endpoint to enable or disable a method in your project. + * + * @param {ProjectAuthMethodId} methodId - Auth Method ID. Possible values: email-password,magic-url,email-otp,anonymous,invites,jwt,phone + * @param {boolean} enabled - Auth method status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAuthMethod(methodId: ProjectAuthMethodId, enabled: boolean): Promise<Models.Project>; + updateAuthMethod( + paramsOrFirst: { methodId: ProjectAuthMethodId, enabled: boolean } | ProjectAuthMethodId, + ...rest: [(boolean)?] + ): Promise<Models.Project> { + let params: { methodId: ProjectAuthMethodId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('methodId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { methodId: ProjectAuthMethodId, enabled: boolean }; + } else { + params = { + methodId: paramsOrFirst as ProjectAuthMethodId, + enabled: rest[0] as boolean + }; + } + + const methodId = params.methodId; + const enabled = params.enabled; + + if (typeof methodId === 'undefined') { + throw new AppwriteException('Missing required parameter: "methodId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/auth-methods/{methodId}'.replace('{methodId}', methodId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all API keys from the current project. + * + * @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: expire, accessedAt, name, scopes + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.KeyList>} + */ + listKeys(params?: { queries?: string[], total?: boolean }): Promise<Models.KeyList>; + /** + * Get a list of all API keys from the current project. + * + * @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: expire, accessedAt, name, scopes + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.KeyList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listKeys(queries?: string[], total?: boolean): Promise<Models.KeyList>; + listKeys( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.KeyList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/keys'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create an ephemeral API key if you need a short-lived key instead. + * + * @param {string} params.keyId - Key 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. + * @param {string} params.name - Key name. Max length: 128 chars. + * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + createKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }): Promise<Models.Key>; + /** + * Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create an ephemeral API key if you need a short-lived key instead. + * + * @param {string} keyId - Key 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. + * @param {string} name - Key name. Max length: 128 chars. + * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createKey(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise<Models.Key>; + createKey( + paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, + ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] + ): Promise<Models.Key> { + let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as ProjectKeyScopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/project/keys'; + const payload: Payload = {}; + if (typeof keyId !== 'undefined') { + payload['keyId'] = keyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create a standard API key if you need a longer-lived key instead. + * + * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {number} params.duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.EphemeralKey>} + */ + createEphemeralKey(params: { scopes: ProjectKeyScopes[], duration: number }): Promise<Models.EphemeralKey>; + /** + * Create a new ephemeral API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project. + * + * You can also create a standard API key if you need a longer-lived key instead. + * + * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {number} duration - Time in seconds before ephemeral key expires. Maximum duration is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.EphemeralKey>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEphemeralKey(scopes: ProjectKeyScopes[], duration: number): Promise<Models.EphemeralKey>; + createEphemeralKey( + paramsOrFirst: { scopes: ProjectKeyScopes[], duration: number } | ProjectKeyScopes[], + ...rest: [(number)?] + ): Promise<Models.EphemeralKey> { + let params: { scopes: ProjectKeyScopes[], duration: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('scopes' in paramsOrFirst || 'duration' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { scopes: ProjectKeyScopes[], duration: number }; + } else { + params = { + scopes: paramsOrFirst as ProjectKeyScopes[], + duration: rest[0] as number + }; + } + + const scopes = params.scopes; + const duration = params.duration; + + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + if (typeof duration === 'undefined') { + throw new AppwriteException('Missing required parameter: "duration"'); + } + + const apiPath = '/project/keys/ephemeral'; + const payload: Payload = {}; + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a key by its unique ID. + * + * @param {string} params.keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + getKey(params: { keyId: string }): Promise<Models.Key>; + /** + * Get a key by its unique ID. + * + * @param {string} keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getKey(keyId: string): Promise<Models.Key>; + getKey( + paramsOrFirst: { keyId: string } | string + ): Promise<Models.Key> { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} params.keyId - Key ID. + * @param {string} params.name - Key name. Max length: 128 chars. + * @param {ProjectKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + updateKey(params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }): Promise<Models.Key>; + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} keyId - Key ID. + * @param {string} name - Key name. Max length: 128 chars. + * @param {ProjectKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateKey(keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string): Promise<Models.Key>; + updateKey( + paramsOrFirst: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string } | string, + ...rest: [(string)?, (ProjectKeyScopes[])?, (string)?] + ): Promise<Models.Key> { + let params: { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: ProjectKeyScopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as ProjectKeyScopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} params.keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteKey(params: { keyId: string }): Promise<{}>; + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} keyId - Key ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteKey(keyId: string): Promise<{}>; + deleteKey( + paramsOrFirst: { keyId: string } | string + ): Promise<{}> { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/project/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project labels. Labels can be used to easily filter projects in an organization. + * + * @param {string[]} params.labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateLabels(params: { labels: string[] }): Promise<Models.Project>; + /** + * Update the project labels. Labels can be used to easily filter projects in an organization. + * + * @param {string[]} labels - Array of project labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLabels(labels: string[]): Promise<Models.Project>; + updateLabels( + paramsOrFirst: { labels: string[] } | string[] + ): Promise<Models.Project> { + let params: { labels: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { labels: string[] }; + } else { + params = { + labels: paramsOrFirst as string[] + }; + } + + const labels = params.labels; + + if (typeof labels === 'undefined') { + throw new AppwriteException('Missing required parameter: "labels"'); + } + + const apiPath = '/project/labels'; + const payload: Payload = {}; + if (typeof labels !== 'undefined') { + payload['labels'] = labels; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. + * + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumberList>} + */ + listMockPhones(params?: { queries?: string[], total?: boolean }): Promise<Models.MockNumberList>; + /** + * Get a list of all mock phones in the project. This endpoint returns an array of all mock phones and their OTPs. + * + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumberList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMockPhones(queries?: string[], total?: boolean): Promise<Models.MockNumberList>; + listMockPhones( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.MockNumberList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/mock-phones'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. + * + * @param {string} params.number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + */ + createMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; + /** + * Create a new mock phone for your project. Use this endpoint to register a mock phone number and its sign-in OTP for your testers. + * + * @param {string} number - Phone number to associate with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMockPhone(number: string, otp: string): Promise<Models.MockNumber>; + createMockPhone( + paramsOrFirst: { number: string, otp: string } | string, + ...rest: [(string)?] + ): Promise<Models.MockNumber> { + let params: { number: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string, otp: string }; + } else { + params = { + number: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const number = params.number; + const otp = params.otp; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/project/mock-phones'; + const payload: Payload = {}; + if (typeof number !== 'undefined') { + payload['number'] = number; + } + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + */ + getMockPhone(params: { number: string }): Promise<Models.MockNumber>; + /** + * Get a mock phone by its unique number. This endpoint returns the mock phone's OTP. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMockPhone(number: string): Promise<Models.MockNumber>; + getMockPhone( + paramsOrFirst: { number: string } | string + ): Promise<Models.MockNumber> { + let params: { number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string }; + } else { + params = { + number: paramsOrFirst as string + }; + } + + const number = params.number; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} params.otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + */ + updateMockPhone(params: { number: string, otp: string }): Promise<Models.MockNumber>; + /** + * Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @param {string} otp - One-time password (OTP) to associate with the mock phone. Must be a 6-digit numeric code. + * @throws {AppwriteException} + * @returns {Promise<Models.MockNumber>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMockPhone(number: string, otp: string): Promise<Models.MockNumber>; + updateMockPhone( + paramsOrFirst: { number: string, otp: string } | string, + ...rest: [(string)?] + ): Promise<Models.MockNumber> { + let params: { number: string, otp: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string, otp: string }; + } else { + params = { + number: paramsOrFirst as string, + otp: rest[0] as string + }; + } + + const number = params.number; + const otp = params.otp; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + if (typeof otp === 'undefined') { + throw new AppwriteException('Missing required parameter: "otp"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const payload: Payload = {}; + if (typeof otp !== 'undefined') { + payload['otp'] = otp; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. + * + * @param {string} params.number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMockPhone(params: { number: string }): Promise<{}>; + /** + * Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project. + * + * @param {string} number - Phone number associated with the mock phone. Must be a valid E.164 formatted phone number. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMockPhone(number: string): Promise<{}>; + deleteMockPhone( + paramsOrFirst: { number: string } | string + ): Promise<{}> { + let params: { number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { number: string }; + } else { + params = { + number: paramsOrFirst as string + }; + } + + const number = params.number; + + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/project/mock-phones/{number}'.replace('{number}', number); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. + * + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2ProviderList>} + */ + listOAuth2Providers(params?: { queries?: string[], total?: boolean }): Promise<Models.OAuth2ProviderList>; + /** + * Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty. + * + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2ProviderList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listOAuth2Providers(queries?: string[], total?: boolean): Promise<Models.OAuth2ProviderList>; + listOAuth2Providers( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.OAuth2ProviderList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/oauth2'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Amazon configuration. + * + * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Amazon>} + */ + updateOAuth2Amazon(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Amazon>; + /** + * Update the project OAuth2 Amazon configuration. + * + * @param {string} clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 + * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Amazon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Amazon(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Amazon>; + updateOAuth2Amazon( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Amazon> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/amazon'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Apple configuration. + * + * @param {string} params.serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + * @param {string} params.keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + * @param {string} params.teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + * @param {string} params.p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Apple>} + */ + updateOAuth2Apple(params?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }): Promise<Models.OAuth2Apple>; + /** + * Update the project OAuth2 Apple configuration. + * + * @param {string} serviceId - 'Service ID' of Apple OAuth2 app. For example: ip.appwrite.app.web + * @param {string} keyId - 'Key ID' of Apple OAuth2 app. For example: P4000000N8 + * @param {string} teamId - 'Team ID' of Apple OAuth2 app. For example: D4000000R6 + * @param {string} p8File - Contents of the Apple OAuth2 app .p8 private key file. The secret key wrapped by the PEM markers is 200 characters long. For example: -----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY----- + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Apple>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Apple(serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean): Promise<Models.OAuth2Apple>; + updateOAuth2Apple( + paramsOrFirst?: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Apple> { + let params: { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { serviceId?: string, keyId?: string, teamId?: string, p8File?: string, enabled?: boolean }; + } else { + params = { + serviceId: paramsOrFirst as string, + keyId: rest[0] as string, + teamId: rest[1] as string, + p8File: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const serviceId = params.serviceId; + const keyId = params.keyId; + const teamId = params.teamId; + const p8File = params.p8File; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/apple'; + const payload: Payload = {}; + if (typeof serviceId !== 'undefined') { + payload['serviceId'] = serviceId; + } + if (typeof keyId !== 'undefined') { + payload['keyId'] = keyId; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof p8File !== 'undefined') { + payload['p8File'] = p8File; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Auth0 configuration. + * + * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Auth0>} + */ + updateOAuth2Auth0(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Auth0>; + /** + * Update the project OAuth2 Auth0 configuration. + * + * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq + * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Auth0>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Auth0(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Auth0>; + updateOAuth2Auth0( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Auth0> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/auth0'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Authentik configuration. + * + * @param {string} params.clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} params.endpoint - Domain of Authentik instance. For example: example.authentik.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Authentik>} + */ + updateOAuth2Authentik(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Authentik>; + /** + * Update the project OAuth2 Authentik configuration. + * + * @param {string} clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv + * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} endpoint - Domain of Authentik instance. For example: example.authentik.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Authentik>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Authentik(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Authentik>; + updateOAuth2Authentik( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Authentik> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/authentik'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Autodesk configuration. + * + * @param {string} params.clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Autodesk>} + */ + updateOAuth2Autodesk(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Autodesk>; + /** + * Update the project OAuth2 Autodesk configuration. + * + * @param {string} clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 + * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Autodesk>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Autodesk(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Autodesk>; + updateOAuth2Autodesk( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Autodesk> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/autodesk'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Bitbucket configuration. + * + * @param {string} params.key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitbucket>} + */ + updateOAuth2Bitbucket(params?: { key?: string, secret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitbucket>; + /** + * Update the project OAuth2 Bitbucket configuration. + * + * @param {string} key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc + * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitbucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Bitbucket(key?: string, secret?: string, enabled?: boolean): Promise<Models.OAuth2Bitbucket>; + updateOAuth2Bitbucket( + paramsOrFirst?: { key?: string, secret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Bitbucket> { + let params: { key?: string, secret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { key?: string, secret?: string, enabled?: boolean }; + } else { + params = { + key: paramsOrFirst as string, + secret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const key = params.key; + const secret = params.secret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/bitbucket'; + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Bitly configuration. + * + * @param {string} params.clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitly>} + */ + updateOAuth2Bitly(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Bitly>; + /** + * Update the project OAuth2 Bitly configuration. + * + * @param {string} clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b + * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Bitly>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Bitly(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Bitly>; + updateOAuth2Bitly( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Bitly> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/bitly'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Box configuration. + * + * @param {string} params.clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Box>} + */ + updateOAuth2Box(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Box>; + /** + * Update the project OAuth2 Box configuration. + * + * @param {string} clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y + * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Box>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Box(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Box>; + updateOAuth2Box( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Box> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/box'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Dailymotion configuration. + * + * @param {string} params.apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dailymotion>} + */ + updateOAuth2Dailymotion(params?: { apiKey?: string, apiSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dailymotion>; + /** + * Update the project OAuth2 Dailymotion configuration. + * + * @param {string} apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f + * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dailymotion>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Dailymotion(apiKey?: string, apiSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dailymotion>; + updateOAuth2Dailymotion( + paramsOrFirst?: { apiKey?: string, apiSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Dailymotion> { + let params: { apiKey?: string, apiSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { apiKey?: string, apiSecret?: string, enabled?: boolean }; + } else { + params = { + apiKey: paramsOrFirst as string, + apiSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const apiKey = params.apiKey; + const apiSecret = params.apiSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/dailymotion'; + const payload: Payload = {}; + if (typeof apiKey !== 'undefined') { + payload['apiKey'] = apiKey; + } + if (typeof apiSecret !== 'undefined') { + payload['apiSecret'] = apiSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Discord configuration. + * + * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Discord>} + */ + updateOAuth2Discord(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Discord>; + /** + * Update the project OAuth2 Discord configuration. + * + * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 + * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Discord>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Discord(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Discord>; + updateOAuth2Discord( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Discord> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/discord'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Disqus configuration. + * + * @param {string} params.publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Disqus>} + */ + updateOAuth2Disqus(params?: { publicKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Disqus>; + /** + * Update the project OAuth2 Disqus configuration. + * + * @param {string} publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX + * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Disqus>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Disqus(publicKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Disqus>; + updateOAuth2Disqus( + paramsOrFirst?: { publicKey?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Disqus> { + let params: { publicKey?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { publicKey?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + publicKey: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const publicKey = params.publicKey; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/disqus'; + const payload: Payload = {}; + if (typeof publicKey !== 'undefined') { + payload['publicKey'] = publicKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Dropbox configuration. + * + * @param {string} params.appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dropbox>} + */ + updateOAuth2Dropbox(params?: { appKey?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Dropbox>; + /** + * Update the project OAuth2 Dropbox configuration. + * + * @param {string} appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t + * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Dropbox>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Dropbox(appKey?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Dropbox>; + updateOAuth2Dropbox( + paramsOrFirst?: { appKey?: string, appSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Dropbox> { + let params: { appKey?: string, appSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appKey?: string, appSecret?: string, enabled?: boolean }; + } else { + params = { + appKey: paramsOrFirst as string, + appSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const appKey = params.appKey; + const appSecret = params.appSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/dropbox'; + const payload: Payload = {}; + if (typeof appKey !== 'undefined') { + payload['appKey'] = appKey; + } + if (typeof appSecret !== 'undefined') { + payload['appSecret'] = appSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Etsy configuration. + * + * @param {string} params.keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Etsy>} + */ + updateOAuth2Etsy(params?: { keyString?: string, sharedSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Etsy>; + /** + * Update the project OAuth2 Etsy configuration. + * + * @param {string} keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 + * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Etsy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Etsy(keyString?: string, sharedSecret?: string, enabled?: boolean): Promise<Models.OAuth2Etsy>; + updateOAuth2Etsy( + paramsOrFirst?: { keyString?: string, sharedSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Etsy> { + let params: { keyString?: string, sharedSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyString?: string, sharedSecret?: string, enabled?: boolean }; + } else { + params = { + keyString: paramsOrFirst as string, + sharedSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const keyString = params.keyString; + const sharedSecret = params.sharedSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/etsy'; + const payload: Payload = {}; + if (typeof keyString !== 'undefined') { + payload['keyString'] = keyString; + } + if (typeof sharedSecret !== 'undefined') { + payload['sharedSecret'] = sharedSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Facebook configuration. + * + * @param {string} params.appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Facebook>} + */ + updateOAuth2Facebook(params?: { appId?: string, appSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Facebook>; + /** + * Update the project OAuth2 Facebook configuration. + * + * @param {string} appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 + * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Facebook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Facebook(appId?: string, appSecret?: string, enabled?: boolean): Promise<Models.OAuth2Facebook>; + updateOAuth2Facebook( + paramsOrFirst?: { appId?: string, appSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Facebook> { + let params: { appId?: string, appSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId?: string, appSecret?: string, enabled?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + appSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const appId = params.appId; + const appSecret = params.appSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/facebook'; + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof appSecret !== 'undefined') { + payload['appSecret'] = appSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Figma configuration. + * + * @param {string} params.clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Figma>} + */ + updateOAuth2Figma(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Figma>; + /** + * Update the project OAuth2 Figma configuration. + * + * @param {string} clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 + * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Figma>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Figma(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Figma>; + updateOAuth2Figma( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Figma> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/figma'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 FusionAuth configuration. + * + * @param {string} params.clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} params.endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2FusionAuth>} + */ + updateOAuth2FusionAuth(params?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2FusionAuth>; + /** + * Update the project OAuth2 FusionAuth configuration. + * + * @param {string} clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 + * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2FusionAuth>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2FusionAuth(clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2FusionAuth>; + updateOAuth2FusionAuth( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2FusionAuth> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/fusionauth'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 GitHub configuration. + * + * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github>} + */ + updateOAuth2GitHub(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Github>; + /** + * Update the project OAuth2 GitHub configuration. + * + * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 + * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2GitHub(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Github>; + updateOAuth2GitHub( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Github> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/github'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Gitlab configuration. + * + * @param {string} params.applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} params.endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Gitlab>} + */ + updateOAuth2Gitlab(params?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }): Promise<Models.OAuth2Gitlab>; + /** + * Update the project OAuth2 Gitlab configuration. + * + * @param {string} applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 + * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Gitlab>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Gitlab(applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean): Promise<Models.OAuth2Gitlab>; + updateOAuth2Gitlab( + paramsOrFirst?: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Gitlab> { + let params: { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { applicationId?: string, secret?: string, endpoint?: string, enabled?: boolean }; + } else { + params = { + applicationId: paramsOrFirst as string, + secret: rest[0] as string, + endpoint: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const applicationId = params.applicationId; + const secret = params.secret; + const endpoint = params.endpoint; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/gitlab'; + const payload: Payload = {}; + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Google configuration. + * + * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret + * @param {ProjectOAuth2GooglePrompt[]} params.prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Google>} + */ + updateOAuth2Google(params?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }): Promise<Models.OAuth2Google>; + /** + * Update the project OAuth2 Google configuration. + * + * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret + * @param {ProjectOAuth2GooglePrompt[]} prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Google>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Google(clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean): Promise<Models.OAuth2Google>; + updateOAuth2Google( + paramsOrFirst?: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean } | string, + ...rest: [(string)?, (ProjectOAuth2GooglePrompt[])?, (boolean)?] + ): Promise<Models.OAuth2Google> { + let params: { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, prompt?: ProjectOAuth2GooglePrompt[], enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + prompt: rest[1] as ProjectOAuth2GooglePrompt[], + enabled: rest[2] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const prompt = params.prompt; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/google'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Keycloak configuration. + * + * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} params.endpoint - Domain of Keycloak instance. For example: keycloak.example.com + * @param {string} params.realmName - Keycloak realm name. For example: appwrite-realm + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Keycloak>} + */ + updateOAuth2Keycloak(params?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }): Promise<Models.OAuth2Keycloak>; + /** + * Update the project OAuth2 Keycloak configuration. + * + * @param {string} clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} endpoint - Domain of Keycloak instance. For example: keycloak.example.com + * @param {string} realmName - Keycloak realm name. For example: appwrite-realm + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Keycloak>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Keycloak(clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean): Promise<Models.OAuth2Keycloak>; + updateOAuth2Keycloak( + paramsOrFirst?: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Keycloak> { + let params: { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, endpoint?: string, realmName?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + endpoint: rest[1] as string, + realmName: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const endpoint = params.endpoint; + const realmName = params.realmName; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/keycloak'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof endpoint !== 'undefined') { + payload['endpoint'] = endpoint; + } + if (typeof realmName !== 'undefined') { + payload['realmName'] = realmName; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Kick configuration. + * + * @param {string} params.clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Kick>} + */ + updateOAuth2Kick(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Kick>; + /** + * Update the project OAuth2 Kick configuration. + * + * @param {string} clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 + * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Kick>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Kick(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Kick>; + updateOAuth2Kick( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Kick> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/kick'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Linkedin configuration. + * + * @param {string} params.clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Linkedin>} + */ + updateOAuth2Linkedin(params?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Linkedin>; + /** + * Update the project OAuth2 Linkedin configuration. + * + * @param {string} clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Linkedin>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Linkedin(clientId?: string, primaryClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Linkedin>; + updateOAuth2Linkedin( + paramsOrFirst?: { clientId?: string, primaryClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Linkedin> { + let params: { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, primaryClientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + primaryClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const primaryClientSecret = params.primaryClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/linkedin'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof primaryClientSecret !== 'undefined') { + payload['primaryClientSecret'] = primaryClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Microsoft configuration. + * + * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Microsoft>} + */ + updateOAuth2Microsoft(params?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }): Promise<Models.OAuth2Microsoft>; + /** + * Update the project OAuth2 Microsoft configuration. + * + * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 + * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Microsoft>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Microsoft(applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean): Promise<Models.OAuth2Microsoft>; + updateOAuth2Microsoft( + paramsOrFirst?: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Microsoft> { + let params: { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { applicationId?: string, applicationSecret?: string, tenant?: string, enabled?: boolean }; + } else { + params = { + applicationId: paramsOrFirst as string, + applicationSecret: rest[0] as string, + tenant: rest[1] as string, + enabled: rest[2] as boolean + }; + } + + const applicationId = params.applicationId; + const applicationSecret = params.applicationSecret; + const tenant = params.tenant; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/microsoft'; + const payload: Payload = {}; + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + if (typeof applicationSecret !== 'undefined') { + payload['applicationSecret'] = applicationSecret; + } + if (typeof tenant !== 'undefined') { + payload['tenant'] = tenant; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Notion configuration. + * + * @param {string} params.oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Notion>} + */ + updateOAuth2Notion(params?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Notion>; + /** + * Update the project OAuth2 Notion configuration. + * + * @param {string} oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 + * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Notion>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Notion(oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Notion>; + updateOAuth2Notion( + paramsOrFirst?: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Notion> { + let params: { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauthClientId?: string, oauthClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauthClientId: paramsOrFirst as string, + oauthClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauthClientId = params.oauthClientId; + const oauthClientSecret = params.oauthClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/notion'; + const payload: Payload = {}; + if (typeof oauthClientId !== 'undefined') { + payload['oauthClientId'] = oauthClientId; + } + if (typeof oauthClientSecret !== 'undefined') { + payload['oauthClientSecret'] = oauthClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Oidc configuration. + * + * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration + * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize + * @param {string} params.tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} params.userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Oidc>} + */ + updateOAuth2Oidc(params?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }): Promise<Models.OAuth2Oidc>; + /** + * Update the project OAuth2 Oidc configuration. + * + * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG + * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration + * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize + * @param {string} tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token + * @param {string} userInfoURL - OpenID Connect user info endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/userinfo + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Oidc>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Oidc(clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean): Promise<Models.OAuth2Oidc>; + updateOAuth2Oidc( + paramsOrFirst?: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Oidc> { + let params: { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, wellKnownURL?: string, authorizationURL?: string, tokenURL?: string, userInfoURL?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + wellKnownURL: rest[1] as string, + authorizationURL: rest[2] as string, + tokenURL: rest[3] as string, + userInfoURL: rest[4] as string, + enabled: rest[5] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const wellKnownURL = params.wellKnownURL; + const authorizationURL = params.authorizationURL; + const tokenURL = params.tokenURL; + const userInfoURL = params.userInfoURL; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/oidc'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof wellKnownURL !== 'undefined') { + payload['wellKnownURL'] = wellKnownURL; + } + if (typeof authorizationURL !== 'undefined') { + payload['authorizationURL'] = authorizationURL; + } + if (typeof tokenURL !== 'undefined') { + payload['tokenURL'] = tokenURL; + } + if (typeof userInfoURL !== 'undefined') { + payload['userInfoURL'] = userInfoURL; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Okta configuration. + * + * @param {string} params.clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ + * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Okta>} + */ + updateOAuth2Okta(params?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }): Promise<Models.OAuth2Okta>; + /** + * Update the project OAuth2 Okta configuration. + * + * @param {string} clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 + * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ + * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Okta>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Okta(clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean): Promise<Models.OAuth2Okta>; + updateOAuth2Okta( + paramsOrFirst?: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.OAuth2Okta> { + let params: { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, domain?: string, authorizationServerId?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + domain: rest[1] as string, + authorizationServerId: rest[2] as string, + enabled: rest[3] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const domain = params.domain; + const authorizationServerId = params.authorizationServerId; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/okta'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof authorizationServerId !== 'undefined') { + payload['authorizationServerId'] = authorizationServerId; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Paypal configuration. + * + * @param {string} params.clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + */ + updateOAuth2Paypal(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; + /** + * Update the project OAuth2 Paypal configuration. + * + * @param {string} clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Paypal(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; + updateOAuth2Paypal( + paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Paypal> { + let params: { clientId?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/paypal'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 PaypalSandbox configuration. + * + * @param {string} params.clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + */ + updateOAuth2PaypalSandbox(params?: { clientId?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Paypal>; + /** + * Update the project OAuth2 PaypalSandbox configuration. + * + * @param {string} clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Paypal>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2PaypalSandbox(clientId?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2Paypal>; + updateOAuth2PaypalSandbox( + paramsOrFirst?: { clientId?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Paypal> { + let params: { clientId?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/paypalSandbox'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Podio configuration. + * + * @param {string} params.clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Podio>} + */ + updateOAuth2Podio(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Podio>; + /** + * Update the project OAuth2 Podio configuration. + * + * @param {string} clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app + * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Podio>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Podio(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Podio>; + updateOAuth2Podio( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Podio> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/podio'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Salesforce configuration. + * + * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Salesforce>} + */ + updateOAuth2Salesforce(params?: { customerKey?: string, customerSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Salesforce>; + /** + * Update the project OAuth2 Salesforce configuration. + * + * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq + * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Salesforce>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Salesforce(customerKey?: string, customerSecret?: string, enabled?: boolean): Promise<Models.OAuth2Salesforce>; + updateOAuth2Salesforce( + paramsOrFirst?: { customerKey?: string, customerSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Salesforce> { + let params: { customerKey?: string, customerSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { customerKey?: string, customerSecret?: string, enabled?: boolean }; + } else { + params = { + customerKey: paramsOrFirst as string, + customerSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const customerKey = params.customerKey; + const customerSecret = params.customerSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/salesforce'; + const payload: Payload = {}; + if (typeof customerKey !== 'undefined') { + payload['customerKey'] = customerKey; + } + if (typeof customerSecret !== 'undefined') { + payload['customerSecret'] = customerSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Slack configuration. + * + * @param {string} params.clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Slack>} + */ + updateOAuth2Slack(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Slack>; + /** + * Update the project OAuth2 Slack configuration. + * + * @param {string} clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 + * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Slack>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Slack(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Slack>; + updateOAuth2Slack( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Slack> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/slack'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Spotify configuration. + * + * @param {string} params.clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Spotify>} + */ + updateOAuth2Spotify(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Spotify>; + /** + * Update the project OAuth2 Spotify configuration. + * + * @param {string} clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace + * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Spotify>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Spotify(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Spotify>; + updateOAuth2Spotify( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Spotify> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/spotify'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Stripe configuration. + * + * @param {string} params.clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Stripe>} + */ + updateOAuth2Stripe(params?: { clientId?: string, apiSecretKey?: string, enabled?: boolean }): Promise<Models.OAuth2Stripe>; + /** + * Update the project OAuth2 Stripe configuration. + * + * @param {string} clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR + * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Stripe>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Stripe(clientId?: string, apiSecretKey?: string, enabled?: boolean): Promise<Models.OAuth2Stripe>; + updateOAuth2Stripe( + paramsOrFirst?: { clientId?: string, apiSecretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Stripe> { + let params: { clientId?: string, apiSecretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, apiSecretKey?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + apiSecretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const apiSecretKey = params.apiSecretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/stripe'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof apiSecretKey !== 'undefined') { + payload['apiSecretKey'] = apiSecretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Tradeshift configuration. + * + * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + */ + updateOAuth2Tradeshift(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; + /** + * Update the project OAuth2 Tradeshift configuration. + * + * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Tradeshift(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; + updateOAuth2Tradeshift( + paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Tradeshift> { + let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauth2ClientId: paramsOrFirst as string, + oauth2ClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauth2ClientId = params.oauth2ClientId; + const oauth2ClientSecret = params.oauth2ClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/tradeshift'; + const payload: Payload = {}; + if (typeof oauth2ClientId !== 'undefined') { + payload['oauth2ClientId'] = oauth2ClientId; + } + if (typeof oauth2ClientSecret !== 'undefined') { + payload['oauth2ClientSecret'] = oauth2ClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Tradeshift Sandbox configuration. + * + * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + */ + updateOAuth2TradeshiftSandbox(params?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Tradeshift>; + /** + * Update the project OAuth2 Tradeshift Sandbox configuration. + * + * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Tradeshift>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2TradeshiftSandbox(oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Tradeshift>; + updateOAuth2TradeshiftSandbox( + paramsOrFirst?: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Tradeshift> { + let params: { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { oauth2ClientId?: string, oauth2ClientSecret?: string, enabled?: boolean }; + } else { + params = { + oauth2ClientId: paramsOrFirst as string, + oauth2ClientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const oauth2ClientId = params.oauth2ClientId; + const oauth2ClientSecret = params.oauth2ClientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/tradeshiftBox'; + const payload: Payload = {}; + if (typeof oauth2ClientId !== 'undefined') { + payload['oauth2ClientId'] = oauth2ClientId; + } + if (typeof oauth2ClientSecret !== 'undefined') { + payload['oauth2ClientSecret'] = oauth2ClientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Twitch configuration. + * + * @param {string} params.clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Twitch>} + */ + updateOAuth2Twitch(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Twitch>; + /** + * Update the project OAuth2 Twitch configuration. + * + * @param {string} clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p + * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Twitch>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Twitch(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Twitch>; + updateOAuth2Twitch( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Twitch> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/twitch'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 WordPress configuration. + * + * @param {string} params.clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 + * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2WordPress>} + */ + updateOAuth2WordPress(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2WordPress>; + /** + * Update the project OAuth2 WordPress configuration. + * + * @param {string} clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 + * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2WordPress>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2WordPress(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2WordPress>; + updateOAuth2WordPress( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2WordPress> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/wordpress'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 X configuration. + * + * @param {string} params.customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2X>} + */ + updateOAuth2X(params?: { customerKey?: string, secretKey?: string, enabled?: boolean }): Promise<Models.OAuth2X>; + /** + * Update the project OAuth2 X configuration. + * + * @param {string} customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT + * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2X>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2X(customerKey?: string, secretKey?: string, enabled?: boolean): Promise<Models.OAuth2X>; + updateOAuth2X( + paramsOrFirst?: { customerKey?: string, secretKey?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2X> { + let params: { customerKey?: string, secretKey?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { customerKey?: string, secretKey?: string, enabled?: boolean }; + } else { + params = { + customerKey: paramsOrFirst as string, + secretKey: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const customerKey = params.customerKey; + const secretKey = params.secretKey; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/x'; + const payload: Payload = {}; + if (typeof customerKey !== 'undefined') { + payload['customerKey'] = customerKey; + } + if (typeof secretKey !== 'undefined') { + payload['secretKey'] = secretKey; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Yahoo configuration. + * + * @param {string} params.clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yahoo>} + */ + updateOAuth2Yahoo(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yahoo>; + /** + * Update the project OAuth2 Yahoo configuration. + * + * @param {string} clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm + * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yahoo>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Yahoo(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yahoo>; + updateOAuth2Yahoo( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Yahoo> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/yahoo'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Yandex configuration. + * + * @param {string} params.clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yandex>} + */ + updateOAuth2Yandex(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Yandex>; + /** + * Update the project OAuth2 Yandex configuration. + * + * @param {string} clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c + * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Yandex>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Yandex(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Yandex>; + updateOAuth2Yandex( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Yandex> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/yandex'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Zoho configuration. + * + * @param {string} params.clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B + * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Zoho>} + */ + updateOAuth2Zoho(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoho>; + /** + * Update the project OAuth2 Zoho configuration. + * + * @param {string} clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B + * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Zoho>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Zoho(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoho>; + updateOAuth2Zoho( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Zoho> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/zoho'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the project OAuth2 Zoom configuration. + * + * @param {string} params.clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ + * @param {string} params.clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Zoom>} + */ + updateOAuth2Zoom(params?: { clientId?: string, clientSecret?: string, enabled?: boolean }): Promise<Models.OAuth2Zoom>; + /** + * Update the project OAuth2 Zoom configuration. + * + * @param {string} clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ + * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Zoom>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateOAuth2Zoom(clientId?: string, clientSecret?: string, enabled?: boolean): Promise<Models.OAuth2Zoom>; + updateOAuth2Zoom( + paramsOrFirst?: { clientId?: string, clientSecret?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.OAuth2Zoom> { + let params: { clientId?: string, clientSecret?: string, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { clientId?: string, clientSecret?: string, enabled?: boolean }; + } else { + params = { + clientId: paramsOrFirst as string, + clientSecret: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const clientId = params.clientId; + const clientSecret = params.clientSecret; + const enabled = params.enabled; + + + const apiPath = '/project/oauth2/zoom'; + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['clientId'] = clientId; + } + if (typeof clientSecret !== 'undefined') { + payload['clientSecret'] = clientSecret; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. + * + * @param {ProjectOAuthProviderId} params.providerId - OAuth2 provider key. For example: github, google, apple. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} + */ + getOAuth2Provider(params: { providerId: ProjectOAuthProviderId }): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; + /** + * Get a single OAuth2 provider configuration. Credential fields (client secret, p8 file, key/team IDs) are write-only and always returned empty. + * + * @param {ProjectOAuthProviderId} providerId - OAuth2 provider key. For example: github, google, apple. + * @throws {AppwriteException} + * @returns {Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getOAuth2Provider(providerId: ProjectOAuthProviderId): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft>; + getOAuth2Provider( + paramsOrFirst: { providerId: ProjectOAuthProviderId } | ProjectOAuthProviderId + ): Promise<Models.OAuth2Github | Models.OAuth2Discord | Models.OAuth2Figma | Models.OAuth2Dropbox | Models.OAuth2Dailymotion | Models.OAuth2Bitbucket | Models.OAuth2Bitly | Models.OAuth2Box | Models.OAuth2Autodesk | Models.OAuth2Google | Models.OAuth2Zoom | Models.OAuth2Zoho | Models.OAuth2Yandex | Models.OAuth2X | Models.OAuth2WordPress | Models.OAuth2Twitch | Models.OAuth2Stripe | Models.OAuth2Spotify | Models.OAuth2Slack | Models.OAuth2Podio | Models.OAuth2Notion | Models.OAuth2Salesforce | Models.OAuth2Yahoo | Models.OAuth2Linkedin | Models.OAuth2Disqus | Models.OAuth2Amazon | Models.OAuth2Etsy | Models.OAuth2Facebook | Models.OAuth2Tradeshift | Models.OAuth2Paypal | Models.OAuth2Gitlab | Models.OAuth2Authentik | Models.OAuth2Auth0 | Models.OAuth2FusionAuth | Models.OAuth2Keycloak | Models.OAuth2Oidc | Models.OAuth2Apple | Models.OAuth2Okta | Models.OAuth2Kick | Models.OAuth2Microsoft> { + let params: { providerId: ProjectOAuthProviderId }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('providerId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { providerId: ProjectOAuthProviderId }; + } else { + params = { + providerId: paramsOrFirst as ProjectOAuthProviderId + }; + } + + const providerId = params.providerId; + + if (typeof providerId === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerId"'); + } + + const apiPath = '/project/oauth2/{providerId}'.replace('{providerId}', providerId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. + * + * @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: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformList>} + */ + listPlatforms(params?: { queries?: string[], total?: boolean }): Promise<Models.PlatformList>; + /** + * Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations. + * + * @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: type, name, hostname, bundleIdentifier, applicationId, packageIdentifierName, packageName + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listPlatforms(queries?: string[], total?: boolean): Promise<Models.PlatformList>; + listPlatforms( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.PlatformList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/platforms'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + */ + createAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; + /** + * Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; + createAndroidPlatform( + paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformAndroid> { + let params: { platformId: string, name: string, applicationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + applicationId: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const applicationId = params.applicationId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof applicationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "applicationId"'); + } + + const apiPath = '/project/platforms/android'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + */ + updateAndroidPlatform(params: { platformId: string, name: string, applicationId: string }): Promise<Models.PlatformAndroid>; + /** + * Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} applicationId - Android application ID. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformAndroid>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateAndroidPlatform(platformId: string, name: string, applicationId: string): Promise<Models.PlatformAndroid>; + updateAndroidPlatform( + paramsOrFirst: { platformId: string, name: string, applicationId: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformAndroid> { + let params: { platformId: string, name: string, applicationId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, applicationId: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + applicationId: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const applicationId = params.applicationId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof applicationId === 'undefined') { + throw new AppwriteException('Missing required parameter: "applicationId"'); + } + + const apiPath = '/project/platforms/android/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof applicationId !== 'undefined') { + payload['applicationId'] = applicationId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + */ + createApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; + /** + * Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; + createApplePlatform( + paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformApple> { + let params: { platformId: string, name: string, bundleIdentifier: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + bundleIdentifier: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const bundleIdentifier = params.bundleIdentifier; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof bundleIdentifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); + } + + const apiPath = '/project/platforms/apple'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof bundleIdentifier !== 'undefined') { + payload['bundleIdentifier'] = bundleIdentifier; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + */ + updateApplePlatform(params: { platformId: string, name: string, bundleIdentifier: string }): Promise<Models.PlatformApple>; + /** + * Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} bundleIdentifier - Apple bundle identifier. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformApple>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateApplePlatform(platformId: string, name: string, bundleIdentifier: string): Promise<Models.PlatformApple>; + updateApplePlatform( + paramsOrFirst: { platformId: string, name: string, bundleIdentifier: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformApple> { + let params: { platformId: string, name: string, bundleIdentifier: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, bundleIdentifier: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + bundleIdentifier: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const bundleIdentifier = params.bundleIdentifier; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof bundleIdentifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "bundleIdentifier"'); + } + + const apiPath = '/project/platforms/apple/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof bundleIdentifier !== 'undefined') { + payload['bundleIdentifier'] = bundleIdentifier; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + */ + createLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; + /** + * Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; + createLinuxPlatform( + paramsOrFirst: { platformId: string, name: string, packageName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformLinux> { + let params: { platformId: string, name: string, packageName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageName = params.packageName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageName"'); + } + + const apiPath = '/project/platforms/linux'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageName !== 'undefined') { + payload['packageName'] = packageName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + */ + updateLinuxPlatform(params: { platformId: string, name: string, packageName: string }): Promise<Models.PlatformLinux>; + /** + * Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageName - Linux package name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformLinux>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLinuxPlatform(platformId: string, name: string, packageName: string): Promise<Models.PlatformLinux>; + updateLinuxPlatform( + paramsOrFirst: { platformId: string, name: string, packageName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformLinux> { + let params: { platformId: string, name: string, packageName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageName = params.packageName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageName"'); + } + + const apiPath = '/project/platforms/linux/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageName !== 'undefined') { + payload['packageName'] = packageName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + */ + createWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; + /** + * Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; + createWebPlatform( + paramsOrFirst: { platformId: string, name: string, hostname: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWeb> { + let params: { platformId: string, name: string, hostname: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + hostname: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const hostname = params.hostname; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof hostname === 'undefined') { + throw new AppwriteException('Missing required parameter: "hostname"'); + } + + const apiPath = '/project/platforms/web'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof hostname !== 'undefined') { + payload['hostname'] = hostname; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + */ + updateWebPlatform(params: { platformId: string, name: string, hostname: string }): Promise<Models.PlatformWeb>; + /** + * Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} hostname - Platform web hostname. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateWebPlatform(platformId: string, name: string, hostname: string): Promise<Models.PlatformWeb>; + updateWebPlatform( + paramsOrFirst: { platformId: string, name: string, hostname: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWeb> { + let params: { platformId: string, name: string, hostname: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, hostname: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + hostname: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const hostname = params.hostname; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof hostname === 'undefined') { + throw new AppwriteException('Missing required parameter: "hostname"'); + } + + const apiPath = '/project/platforms/web/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof hostname !== 'undefined') { + payload['hostname'] = hostname; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} params.platformId - Platform 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. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + */ + createWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; + /** + * Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API. + * + * @param {string} platformId - Platform 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. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; + createWindowsPlatform( + paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWindows> { + let params: { platformId: string, name: string, packageIdentifierName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageIdentifierName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageIdentifierName = params.packageIdentifierName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageIdentifierName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); + } + + const apiPath = '/project/platforms/windows'; + const payload: Payload = {}; + if (typeof platformId !== 'undefined') { + payload['platformId'] = platformId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageIdentifierName !== 'undefined') { + payload['packageIdentifierName'] = packageIdentifierName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. + * + * @param {string} params.platformId - Platform ID. + * @param {string} params.name - Platform name. Max length: 128 chars. + * @param {string} params.packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + */ + updateWindowsPlatform(params: { platformId: string, name: string, packageIdentifierName: string }): Promise<Models.PlatformWindows>; + /** + * Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. + * + * @param {string} platformId - Platform ID. + * @param {string} name - Platform name. Max length: 128 chars. + * @param {string} packageIdentifierName - Windows package identifier name. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWindows>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateWindowsPlatform(platformId: string, name: string, packageIdentifierName: string): Promise<Models.PlatformWindows>; + updateWindowsPlatform( + paramsOrFirst: { platformId: string, name: string, packageIdentifierName: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.PlatformWindows> { + let params: { platformId: string, name: string, packageIdentifierName: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string, name: string, packageIdentifierName: string }; + } else { + params = { + platformId: paramsOrFirst as string, + name: rest[0] as string, + packageIdentifierName: rest[1] as string + }; + } + + const platformId = params.platformId; + const name = params.name; + const packageIdentifierName = params.packageIdentifierName; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof packageIdentifierName === 'undefined') { + throw new AppwriteException('Missing required parameter: "packageIdentifierName"'); + } + + const apiPath = '/project/platforms/windows/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof packageIdentifierName !== 'undefined') { + payload['packageIdentifierName'] = packageIdentifierName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. + * + * @param {string} params.platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} + */ + getPlatform(params: { platformId: string }): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; + /** + * Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. + * + * @param {string} platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPlatform(platformId: string): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux>; + getPlatform( + paramsOrFirst: { platformId: string } | string + ): Promise<Models.PlatformWeb | Models.PlatformApple | Models.PlatformAndroid | Models.PlatformWindows | Models.PlatformLinux> { + let params: { platformId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string }; + } else { + params = { + platformId: paramsOrFirst as string + }; + } + + const platformId = params.platformId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. + * + * @param {string} params.platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deletePlatform(params: { platformId: string }): Promise<{}>; + /** + * Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. + * + * @param {string} platformId - Platform ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deletePlatform(platformId: string): Promise<{}>; + deletePlatform( + paramsOrFirst: { platformId: string } | string + ): Promise<{}> { + let params: { platformId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { platformId: string }; + } else { + params = { + platformId: paramsOrFirst as string + }; + } + + const platformId = params.platformId; + + if (typeof platformId === 'undefined') { + throw new AppwriteException('Missing required parameter: "platformId"'); + } + + const apiPath = '/project/platforms/{platformId}'.replace('{platformId}', platformId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all project policies and their current configuration. + * + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyList>} + */ + listPolicies(params?: { queries?: string[], total?: boolean }): Promise<Models.PolicyList>; + /** + * Get a list of all project policies and their current configuration. + * + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listPolicies(queries?: string[], total?: boolean): Promise<Models.PolicyList>; + listPolicies( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.PolicyList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/policies'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. + * + * @param {boolean} params.enabled - Set whether or not to block aliased emails during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateDenyAliasedEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Configures if aliased emails such as subaddresses and emails with suffixes are denied during new users sign-ups and email updates. + * + * @param {boolean} enabled - Set whether or not to block aliased emails during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyAliasedEmailPolicy(enabled: boolean): Promise<Models.Project>; + updateDenyAliasedEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/deny-aliased-email'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. + * + * @param {boolean} params.enabled - Set whether or not to block disposable email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateDenyDisposableEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Configures if disposable emails from known temporary domains are denied during new users sign-ups and email updates. + * + * @param {boolean} enabled - Set whether or not to block disposable email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyDisposableEmailPolicy(enabled: boolean): Promise<Models.Project>; + updateDenyDisposableEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/deny-disposable-email'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. + * + * @param {boolean} params.enabled - Set whether or not to block free email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateDenyFreeEmailPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Configures if emails from free providers such as Gmail or Yahoo are denied during new users sign-ups and email updates. + * + * @param {boolean} enabled - Set whether or not to block free email addresses during signup and email updates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDenyFreeEmailPolicy(enabled: boolean): Promise<Models.Project>; + updateDenyFreeEmailPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/deny-free-email'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Updating this policy allows you to control if team members can see other members information. When enabled, all team members can see ID, name, email, phone number, and MFA status of other members.. + * + * @param {boolean} params.userId - Set to true if you want make user ID visible to all team members, or false to hide it. + * @param {boolean} params.userEmail - Set to true if you want make user email visible to all team members, or false to hide it. + * @param {boolean} params.userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. + * @param {boolean} params.userName - Set to true if you want make user name visible to all team members, or false to hide it. + * @param {boolean} params.userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateMembershipPrivacyPolicy(params?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if team members can see other members information. When enabled, all team members can see ID, name, email, phone number, and MFA status of other members.. + * + * @param {boolean} userId - Set to true if you want make user ID visible to all team members, or false to hide it. + * @param {boolean} userEmail - Set to true if you want make user email visible to all team members, or false to hide it. + * @param {boolean} userPhone - Set to true if you want make user phone number visible to all team members, or false to hide it. + * @param {boolean} userName - Set to true if you want make user name visible to all team members, or false to hide it. + * @param {boolean} userMFA - Set to true if you want make user MFA status visible to all team members, or false to hide it. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMembershipPrivacyPolicy(userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean): Promise<Models.Project>; + updateMembershipPrivacyPolicy( + paramsOrFirst?: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean } | boolean, + ...rest: [(boolean)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Project> { + let params: { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId?: boolean, userEmail?: boolean, userPhone?: boolean, userName?: boolean, userMFA?: boolean }; + } else { + params = { + userId: paramsOrFirst as boolean, + userEmail: rest[0] as boolean, + userPhone: rest[1] as boolean, + userName: rest[2] as boolean, + userMFA: rest[3] as boolean + }; + } + + const userId = params.userId; + const userEmail = params.userEmail; + const userPhone = params.userPhone; + const userName = params.userName; + const userMFA = params.userMFA; + + + const apiPath = '/project/policies/membership-privacy'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof userEmail !== 'undefined') { + payload['userEmail'] = userEmail; + } + if (typeof userPhone !== 'undefined') { + payload['userPhone'] = userPhone; + } + if (typeof userName !== 'undefined') { + payload['userName'] = userName; + } + if (typeof userMFA !== 'undefined') { + payload['userMFA'] = userMFA; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. + * + * @param {boolean} params.enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updatePasswordDictionaryPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. + * + * @param {boolean} enabled - Toggle password dictionary policy. Set to true if you want password change to block passwords in the dictionary, or false to allow them. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePasswordDictionaryPolicy(enabled: boolean): Promise<Models.Project>; + updatePasswordDictionaryPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/password-dictionary'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. + * + * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. + * + * @param {number} params.total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updatePasswordHistoryPolicy(params: { total?: number }): Promise<Models.Project>; + /** + * Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. + * + * Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. + * + * @param {number} total - Set the password history length per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePasswordHistoryPolicy(total?: number): Promise<Models.Project>; + updatePasswordHistoryPolicy( + paramsOrFirst?: { total?: number } | number + ): Promise<Models.Project> { + let params: { total?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { total?: number }; + } else { + params = { + total: paramsOrFirst as number + }; + } + + const total = params.total; + + if (typeof total === 'undefined') { + throw new AppwriteException('Missing required parameter: "total"'); + } + + const apiPath = '/project/policies/password-history'; + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. + * + * @param {boolean} params.enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updatePasswordPersonalDataPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. + * + * @param {boolean} enabled - Toggle password personal data policy. Set to true if you want to block passwords including user's personal data, or false to allow it. When changing this policy, existing passwords remain valid. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePasswordPersonalDataPolicy(enabled: boolean): Promise<Models.Project>; + updatePasswordPersonalDataPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/password-personal-data'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. + * + * @param {boolean} params.enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionAlertPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. + * + * @param {boolean} enabled - Toggle session alert policy. Set to true if you want users to receive email notifications when a sessions are created for their users, or false to not send email alerts. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionAlertPolicy(enabled: boolean): Promise<Models.Project>; + updateSessionAlertPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/session-alert'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update maximum duration how long sessions created within a project should stay active for. + * + * @param {number} params.duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionDurationPolicy(params: { duration: number }): Promise<Models.Project>; + /** + * Update maximum duration how long sessions created within a project should stay active for. + * + * @param {number} duration - Maximum session length in seconds. Minium allowed value is 5 second, and maximum is 1 year, which is 31536000 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionDurationPolicy(duration: number): Promise<Models.Project>; + updateSessionDurationPolicy( + paramsOrFirst: { duration: number } | number + ): Promise<Models.Project> { + let params: { duration: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { duration: number }; + } else { + params = { + duration: paramsOrFirst as number + }; + } + + const duration = params.duration; + + if (typeof duration === 'undefined') { + throw new AppwriteException('Missing required parameter: "duration"'); + } + + const apiPath = '/project/policies/session-duration'; + const payload: Payload = {}; + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. + * + * @param {boolean} params.enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionInvalidationPolicy(params: { enabled: boolean }): Promise<Models.Project>; + /** + * Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. + * + * @param {boolean} enabled - Toggle session invalidation policy. Set to true if you want password change to invalidate all sessions of an user, or false to keep sessions active. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionInvalidationPolicy(enabled: boolean): Promise<Models.Project>; + updateSessionInvalidationPolicy( + paramsOrFirst: { enabled: boolean } | boolean + ): Promise<Models.Project> { + let params: { enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { enabled: boolean }; + } else { + params = { + enabled: paramsOrFirst as boolean + }; + } + + const enabled = params.enabled; + + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/policies/session-invalidation'; + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. + * + * @param {number} params.total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSessionLimitPolicy(params: { total?: number }): Promise<Models.Project>; + /** + * Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. + * + * @param {number} total - Set the maximum number of sessions allowed per user. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSessionLimitPolicy(total?: number): Promise<Models.Project>; + updateSessionLimitPolicy( + paramsOrFirst?: { total?: number } | number + ): Promise<Models.Project> { + let params: { total?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { total?: number }; + } else { + params = { + total: paramsOrFirst as number + }; + } + + const total = params.total; + + if (typeof total === 'undefined') { + throw new AppwriteException('Missing required parameter: "total"'); + } + + const apiPath = '/project/policies/session-limit'; + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. + * + * @param {number} params.total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateUserLimitPolicy(params: { total?: number }): Promise<Models.Project>; + /** + * Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. + * + * @param {number} total - Set the maximum number of users allowed in the project. Value can be between 1 and 5000, or null to disable the limit. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateUserLimitPolicy(total?: number): Promise<Models.Project>; + updateUserLimitPolicy( + paramsOrFirst?: { total?: number } | number + ): Promise<Models.Project> { + let params: { total?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { total?: number }; + } else { + params = { + total: paramsOrFirst as number + }; + } + + const total = params.total; + + if (typeof total === 'undefined') { + throw new AppwriteException('Missing required parameter: "total"'); + } + + const apiPath = '/project/policies/user-limit'; + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. + * + * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} + */ + getPolicy(params: { policyId: ProjectPolicyId }): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; + /** + * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. + * + * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @throws {AppwriteException} + * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPolicy(policyId: ProjectPolicyId): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; + getPolicy( + paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId + ): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy> { + let params: { policyId: ProjectPolicyId }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { policyId: ProjectPolicyId }; + } else { + params = { + policyId: paramsOrFirst as ProjectPolicyId + }; + } + + const policyId = params.policyId; + + if (typeof policyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "policyId"'); + } + + const apiPath = '/project/policies/{policyId}'.replace('{policyId}', policyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. + * + * @param {ProjectProtocolId} params.protocolId - Protocol name. Can be one of: rest, graphql, websocket + * @param {boolean} params.enabled - Protocol status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateProtocol(params: { protocolId: ProjectProtocolId, enabled: boolean }): Promise<Models.Project>; + /** + * Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. + * + * @param {ProjectProtocolId} protocolId - Protocol name. Can be one of: rest, graphql, websocket + * @param {boolean} enabled - Protocol status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateProtocol(protocolId: ProjectProtocolId, enabled: boolean): Promise<Models.Project>; + updateProtocol( + paramsOrFirst: { protocolId: ProjectProtocolId, enabled: boolean } | ProjectProtocolId, + ...rest: [(boolean)?] + ): Promise<Models.Project> { + let params: { protocolId: ProjectProtocolId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('protocolId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { protocolId: ProjectProtocolId, enabled: boolean }; + } else { + params = { + protocolId: paramsOrFirst as ProjectProtocolId, + enabled: rest[0] as boolean + }; + } + + const protocolId = params.protocolId; + const enabled = params.enabled; + + if (typeof protocolId === 'undefined') { + throw new AppwriteException('Missing required parameter: "protocolId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/protocols/{protocolId}'.replace('{protocolId}', protocolId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. + * + * @param {ProjectServiceId} params.serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor + * @param {boolean} params.enabled - Service status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateService(params: { serviceId: ProjectServiceId, enabled: boolean }): Promise<Models.Project>; + /** + * Update properties of a specific service. Use this endpoint to enable or disable a service in your project. + * + * @param {ProjectServiceId} serviceId - Service name. Can be one of: account, avatars, databases, tablesdb, locale, health, project, storage, teams, users, vcs, sites, functions, proxy, graphql, migrations, messaging, advisor + * @param {boolean} enabled - Service status. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateService(serviceId: ProjectServiceId, enabled: boolean): Promise<Models.Project>; + updateService( + paramsOrFirst: { serviceId: ProjectServiceId, enabled: boolean } | ProjectServiceId, + ...rest: [(boolean)?] + ): Promise<Models.Project> { + let params: { serviceId: ProjectServiceId, enabled: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('serviceId' in paramsOrFirst || 'enabled' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { serviceId: ProjectServiceId, enabled: boolean }; + } else { + params = { + serviceId: paramsOrFirst as ProjectServiceId, + enabled: rest[0] as boolean + }; + } + + const serviceId = params.serviceId; + const enabled = params.enabled; + + if (typeof serviceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "serviceId"'); + } + if (typeof enabled === 'undefined') { + throw new AppwriteException('Missing required parameter: "enabled"'); + } + + const apiPath = '/project/services/{serviceId}'.replace('{serviceId}', serviceId); + const payload: Payload = {}; + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. + * + * @param {string} params.host - SMTP server hostname (domain) + * @param {number} params.port - SMTP server port + * @param {string} params.username - SMTP server username. Leave empty for no authorization. + * @param {string} params.password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). + * @param {string} params.senderEmail - Email address shown in inbox as the sender of the email. + * @param {string} params.senderName - Name shown in inbox as the sender of the email. + * @param {string} params.replyToEmail - Email used when user replies to the email. + * @param {string} params.replyToName - Name used when user replies to the email. + * @param {ProjectSMTPSecure} params.secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. + * @param {boolean} params.enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateSMTP(params?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }): Promise<Models.Project>; + /** + * Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. + * + * @param {string} host - SMTP server hostname (domain) + * @param {number} port - SMTP server port + * @param {string} username - SMTP server username. Leave empty for no authorization. + * @param {string} password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). + * @param {string} senderEmail - Email address shown in inbox as the sender of the email. + * @param {string} senderName - Name shown in inbox as the sender of the email. + * @param {string} replyToEmail - Email used when user replies to the email. + * @param {string} replyToName - Name used when user replies to the email. + * @param {ProjectSMTPSecure} secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. + * @param {boolean} enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSMTP(host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean): Promise<Models.Project>; + updateSMTP( + paramsOrFirst?: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean } | string, + ...rest: [(number)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (ProjectSMTPSecure)?, (boolean)?] + ): Promise<Models.Project> { + let params: { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { host?: string, port?: number, username?: string, password?: string, senderEmail?: string, senderName?: string, replyToEmail?: string, replyToName?: string, secure?: ProjectSMTPSecure, enabled?: boolean }; + } else { + params = { + host: paramsOrFirst as string, + port: rest[0] as number, + username: rest[1] as string, + password: rest[2] as string, + senderEmail: rest[3] as string, + senderName: rest[4] as string, + replyToEmail: rest[5] as string, + replyToName: rest[6] as string, + secure: rest[7] as ProjectSMTPSecure, + enabled: rest[8] as boolean + }; + } + + const host = params.host; + const port = params.port; + const username = params.username; + const password = params.password; + const senderEmail = params.senderEmail; + const senderName = params.senderName; + const replyToEmail = params.replyToEmail; + const replyToName = params.replyToName; + const secure = params.secure; + const enabled = params.enabled; + + + const apiPath = '/project/smtp'; + const payload: Payload = {}; + if (typeof host !== 'undefined') { + payload['host'] = host; + } + if (typeof port !== 'undefined') { + payload['port'] = port; + } + if (typeof username !== 'undefined') { + payload['username'] = username; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof senderEmail !== 'undefined') { + payload['senderEmail'] = senderEmail; + } + if (typeof senderName !== 'undefined') { + payload['senderName'] = senderName; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + if (typeof secure !== 'undefined') { + payload['secure'] = secure; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Send a test email to verify SMTP configuration. + * + * @param {string[]} params.emails - Array of emails to send test email to. Maximum of 10 emails are allowed. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + createSMTPTest(params: { emails: string[] }): Promise<{}>; + /** + * Send a test email to verify SMTP configuration. + * + * @param {string[]} emails - Array of emails to send test email to. Maximum of 10 emails are allowed. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSMTPTest(emails: string[]): Promise<{}>; + createSMTPTest( + paramsOrFirst: { emails: string[] } | string[] + ): Promise<{}> { + let params: { emails: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { emails: string[] }; + } else { + params = { + emails: paramsOrFirst as string[] + }; + } + + const emails = params.emails; + + if (typeof emails === 'undefined') { + throw new AppwriteException('Missing required parameter: "emails"'); + } + + const apiPath = '/project/smtp/tests'; + const payload: Payload = {}; + if (typeof emails !== 'undefined') { + payload['emails'] = emails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. + * + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplateList>} + */ + listEmailTemplates(params?: { queries?: string[], total?: boolean }): Promise<Models.EmailTemplateList>; + /** + * Get a list of all custom email templates configured for the project. This endpoint returns an array of all configured email templates and their locales. + * + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplateList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listEmailTemplates(queries?: string[], total?: boolean): Promise<Models.EmailTemplateList>; + listEmailTemplates( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.EmailTemplateList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/templates/email'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. + * + * @param {ProjectEmailTemplateId} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @param {string} params.subject - Subject of the email template. Can be up to 255 characters. + * @param {string} params.message - Plain or HTML body of the email template message. Can be up to 10MB of content. + * @param {string} params.senderName - Name of the email sender. + * @param {string} params.senderEmail - Email of the sender. + * @param {string} params.replyToEmail - Reply to email. + * @param {string} params.replyToName - Reply to name. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + */ + updateEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }): Promise<Models.EmailTemplate>; + /** + * Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. + * + * @param {ProjectEmailTemplateId} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @param {string} subject - Subject of the email template. Can be up to 255 characters. + * @param {string} message - Plain or HTML body of the email template message. Can be up to 10MB of content. + * @param {string} senderName - Name of the email sender. + * @param {string} senderEmail - Email of the sender. + * @param {string} replyToEmail - Reply to email. + * @param {string} replyToName - Reply to name. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string): Promise<Models.EmailTemplate>; + updateEmailTemplate( + paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string } | ProjectEmailTemplateId, + ...rest: [(ProjectEmailTemplateLocale)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.EmailTemplate> { + let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst || 'subject' in paramsOrFirst || 'message' in paramsOrFirst || 'senderName' in paramsOrFirst || 'senderEmail' in paramsOrFirst || 'replyToEmail' in paramsOrFirst || 'replyToName' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale, subject?: string, message?: string, senderName?: string, senderEmail?: string, replyToEmail?: string, replyToName?: string }; + } else { + params = { + templateId: paramsOrFirst as ProjectEmailTemplateId, + locale: rest[0] as ProjectEmailTemplateLocale, + subject: rest[1] as string, + message: rest[2] as string, + senderName: rest[3] as string, + senderEmail: rest[4] as string, + replyToEmail: rest[5] as string, + replyToName: rest[6] as string + }; + } + + const templateId = params.templateId; + const locale = params.locale; + const subject = params.subject; + const message = params.message; + const senderName = params.senderName; + const senderEmail = params.senderEmail; + const replyToEmail = params.replyToEmail; + const replyToName = params.replyToName; + + if (typeof templateId === 'undefined') { + throw new AppwriteException('Missing required parameter: "templateId"'); + } + + const apiPath = '/project/templates/email'; + const payload: Payload = {}; + if (typeof templateId !== 'undefined') { + payload['templateId'] = templateId; + } + if (typeof locale !== 'undefined') { + payload['locale'] = locale; + } + if (typeof subject !== 'undefined') { + payload['subject'] = subject; + } + if (typeof message !== 'undefined') { + payload['message'] = message; + } + if (typeof senderName !== 'undefined') { + payload['senderName'] = senderName; + } + if (typeof senderEmail !== 'undefined') { + payload['senderEmail'] = senderEmail; + } + if (typeof replyToEmail !== 'undefined') { + payload['replyToEmail'] = replyToEmail; + } + if (typeof replyToName !== 'undefined') { + payload['replyToName'] = replyToName; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. + * + * @param {ProjectEmailTemplateId} params.templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} params.locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + */ + getEmailTemplate(params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }): Promise<Models.EmailTemplate>; + /** + * Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. + * + * @param {ProjectEmailTemplateId} templateId - Custom email template type. Can be one of: verification, magicSession, recovery, invitation, mfaChallenge, sessionAlert, otpSession + * @param {ProjectEmailTemplateLocale} locale - Custom email template locale. If left empty, the fallback locale (en) will be used. + * @throws {AppwriteException} + * @returns {Promise<Models.EmailTemplate>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getEmailTemplate(templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale): Promise<Models.EmailTemplate>; + getEmailTemplate( + paramsOrFirst: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale } | ProjectEmailTemplateId, + ...rest: [(ProjectEmailTemplateLocale)?] + ): Promise<Models.EmailTemplate> { + let params: { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('templateId' in paramsOrFirst || 'locale' in paramsOrFirst))) { + params = (paramsOrFirst || {}) as { templateId: ProjectEmailTemplateId, locale?: ProjectEmailTemplateLocale }; + } else { + params = { + templateId: paramsOrFirst as ProjectEmailTemplateId, + locale: rest[0] as ProjectEmailTemplateLocale + }; + } + + const templateId = params.templateId; + const locale = params.locale; + + if (typeof templateId === 'undefined') { + throw new AppwriteException('Missing required parameter: "templateId"'); + } + + const apiPath = '/project/templates/email/{templateId}'.replace('{templateId}', templateId); + const payload: Payload = {}; + if (typeof locale !== 'undefined') { + payload['locale'] = locale; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all project environment variables. + * + * @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: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + */ + listVariables(params?: { queries?: string[], total?: boolean }): Promise<Models.VariableList>; + /** + * Get a list of all project environment variables. + * + * @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: key, resourceType, resourceId, secret + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listVariables(queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.VariableList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/project/variables'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. + * + * @param {string} params.variableId - Variable 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. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + createVariable(params: { variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Create a new project environment variable. These variables can be accessed by all functions and sites in the project. + * + * @param {string} variableId - Variable 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. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVariable(variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; + createVariable( + paramsOrFirst: { variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { variableId: string, key: string, value: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string, key: string, value: string, secret?: boolean }; + } else { + params = { + variableId: paramsOrFirst as string, + key: rest[0] as string, + value: rest[1] as string, + secret: rest[2] as boolean + }; + } + + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof value === 'undefined') { + throw new AppwriteException('Missing required parameter: "value"'); + } + + const apiPath = '/project/variables'; + const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a variable by its unique ID. + * + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + getVariable(params: { variableId: string }): Promise<Models.Variable>; + /** + * Get a variable by its unique ID. + * + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getVariable(variableId: string): Promise<Models.Variable>; + getVariable( + paramsOrFirst: { variableId: string } | string + ): Promise<Models.Variable> { + let params: { variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string }; + } else { + params = { + variableId: paramsOrFirst as string + }; + } + + const variableId = params.variableId; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update variable by its unique ID. + * + * @param {string} params.variableId - Variable unique ID. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + updateVariable(params: { variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Update variable by its unique ID. + * + * @param {string} variableId - Variable unique ID. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only projects can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVariable(variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; + updateVariable( + paramsOrFirst: { variableId: string, key?: string, value?: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { variableId: string, key?: string, value?: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string, key?: string, value?: string, secret?: boolean }; + } else { + params = { + variableId: paramsOrFirst as string, + key: rest[0] as string, + value: rest[1] as string, + secret: rest[2] as boolean + }; + } + + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a variable by its unique ID. + * + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteVariable(params: { variableId: string }): Promise<{}>; + /** + * Delete a variable by its unique ID. + * + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteVariable(variableId: string): Promise<{}>; + deleteVariable( + paramsOrFirst: { variableId: string } | string + ): Promise<{}> { + let params: { variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { variableId: string }; + } else { + params = { + variableId: paramsOrFirst as string + }; + } + + const variableId = params.variableId; + + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/project/variables/{variableId}'.replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/proxy.ts b/src/services/proxy.ts new file mode 100644 index 00000000..83e4ecc8 --- /dev/null +++ b/src/services/proxy.ts @@ -0,0 +1,541 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { StatusCode } from '../enums/status-code'; +import { ProxyResourceType } from '../enums/proxy-resource-type'; + +export class Proxy { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the proxy rules. You can use the query params to filter your results. + * + * @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: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRuleList>} + */ + listRules(params?: { queries?: string[], total?: boolean }): Promise<Models.ProxyRuleList>; + /** + * Get a list of all the proxy rules. You can use the query params to filter your results. + * + * @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: domain, type, trigger, deploymentResourceType, deploymentResourceId, deploymentId, deploymentVcsProviderBranch + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRuleList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRules(queries?: string[], total?: boolean): Promise<Models.ProxyRuleList>; + listRules( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.ProxyRuleList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/proxy/rules'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new proxy rule for serving Appwrite's API on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createAPIRule(params: { domain: string }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for serving Appwrite's API on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createAPIRule(domain: string): Promise<Models.ProxyRule>; + createAPIRule( + paramsOrFirst: { domain: string } | string + ): Promise<Models.ProxyRule> { + let params: { domain: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string }; + } else { + params = { + domain: paramsOrFirst as string + }; + } + + const domain = params.domain; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + + const apiPath = '/proxy/rules/api'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new proxy rule for executing Appwrite Function on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @param {string} params.functionId - ID of function to be executed. + * @param {string} params.branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createFunctionRule(params: { domain: string, functionId: string, branch?: string }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for executing Appwrite Function on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @param {string} functionId - ID of function to be executed. + * @param {string} branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFunctionRule(domain: string, functionId: string, branch?: string): Promise<Models.ProxyRule>; + createFunctionRule( + paramsOrFirst: { domain: string, functionId: string, branch?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ProxyRule> { + let params: { domain: string, functionId: string, branch?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string, functionId: string, branch?: string }; + } else { + params = { + domain: paramsOrFirst as string, + functionId: rest[0] as string, + branch: rest[1] as string + }; + } + + const domain = params.domain; + const functionId = params.functionId; + const branch = params.branch; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + if (typeof functionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "functionId"'); + } + + const apiPath = '/proxy/rules/function'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof functionId !== 'undefined') { + payload['functionId'] = functionId; + } + if (typeof branch !== 'undefined') { + payload['branch'] = branch; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new proxy rule for to redirect from custom domain to another domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @param {string} params.url - Target URL of redirection + * @param {StatusCode} params.statusCode - Status code of redirection + * @param {string} params.resourceId - ID of parent resource. + * @param {ProxyResourceType} params.resourceType - Type of parent resource. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createRedirectRule(params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for to redirect from custom domain to another domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @param {string} url - Target URL of redirection + * @param {StatusCode} statusCode - Status code of redirection + * @param {string} resourceId - ID of parent resource. + * @param {ProxyResourceType} resourceType - Type of parent resource. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRedirectRule(domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType): Promise<Models.ProxyRule>; + createRedirectRule( + paramsOrFirst: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType } | string, + ...rest: [(string)?, (StatusCode)?, (string)?, (ProxyResourceType)?] + ): Promise<Models.ProxyRule> { + let params: { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string, url: string, statusCode: StatusCode, resourceId: string, resourceType: ProxyResourceType }; + } else { + params = { + domain: paramsOrFirst as string, + url: rest[0] as string, + statusCode: rest[1] as StatusCode, + resourceId: rest[2] as string, + resourceType: rest[3] as ProxyResourceType + }; + } + + const domain = params.domain; + const url = params.url; + const statusCode = params.statusCode; + const resourceId = params.resourceId; + const resourceType = params.resourceType; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof statusCode === 'undefined') { + throw new AppwriteException('Missing required parameter: "statusCode"'); + } + if (typeof resourceId === 'undefined') { + throw new AppwriteException('Missing required parameter: "resourceId"'); + } + if (typeof resourceType === 'undefined') { + throw new AppwriteException('Missing required parameter: "resourceType"'); + } + + const apiPath = '/proxy/rules/redirect'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof statusCode !== 'undefined') { + payload['statusCode'] = statusCode; + } + if (typeof resourceId !== 'undefined') { + payload['resourceId'] = resourceId; + } + if (typeof resourceType !== 'undefined') { + payload['resourceType'] = resourceType; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new proxy rule for serving Appwrite Site on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} params.domain - Domain name. + * @param {string} params.siteId - ID of site to be executed. + * @param {string} params.branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + createSiteRule(params: { domain: string, siteId: string, branch?: string }): Promise<Models.ProxyRule>; + /** + * Create a new proxy rule for serving Appwrite Site on custom domain. + * + * Rule ID is automatically generated as MD5 hash of a rule domain for performance purposes. + * + * @param {string} domain - Domain name. + * @param {string} siteId - ID of site to be executed. + * @param {string} branch - Name of VCS branch to deploy changes automatically + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSiteRule(domain: string, siteId: string, branch?: string): Promise<Models.ProxyRule>; + createSiteRule( + paramsOrFirst: { domain: string, siteId: string, branch?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ProxyRule> { + let params: { domain: string, siteId: string, branch?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { domain: string, siteId: string, branch?: string }; + } else { + params = { + domain: paramsOrFirst as string, + siteId: rest[0] as string, + branch: rest[1] as string + }; + } + + const domain = params.domain; + const siteId = params.siteId; + const branch = params.branch; + + if (typeof domain === 'undefined') { + throw new AppwriteException('Missing required parameter: "domain"'); + } + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/proxy/rules/site'; + const payload: Payload = {}; + if (typeof domain !== 'undefined') { + payload['domain'] = domain; + } + if (typeof siteId !== 'undefined') { + payload['siteId'] = siteId; + } + if (typeof branch !== 'undefined') { + payload['branch'] = branch; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a proxy rule by its unique ID. + * + * @param {string} params.ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + getRule(params: { ruleId: string }): Promise<Models.ProxyRule>; + /** + * Get a proxy rule by its unique ID. + * + * @param {string} ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRule(ruleId: string): Promise<Models.ProxyRule>; + getRule( + paramsOrFirst: { ruleId: string } | string + ): Promise<Models.ProxyRule> { + let params: { ruleId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ruleId: string }; + } else { + params = { + ruleId: paramsOrFirst as string + }; + } + + const ruleId = params.ruleId; + + if (typeof ruleId === 'undefined') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a proxy rule by its unique ID. + * + * @param {string} params.ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteRule(params: { ruleId: string }): Promise<{}>; + /** + * Delete a proxy rule by its unique ID. + * + * @param {string} ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteRule(ruleId: string): Promise<{}>; + deleteRule( + paramsOrFirst: { ruleId: string } | string + ): Promise<{}> { + let params: { ruleId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ruleId: string }; + } else { + params = { + ruleId: paramsOrFirst as string + }; + } + + const ruleId = params.ruleId; + + if (typeof ruleId === 'undefined') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + const apiPath = '/proxy/rules/{ruleId}'.replace('{ruleId}', ruleId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. + * + * @param {string} params.ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + */ + updateRuleStatus(params: { ruleId: string }): Promise<Models.ProxyRule>; + /** + * If not succeeded yet, retry verification process of a proxy rule domain. This endpoint triggers domain verification by checking DNS records. If verification is successful, a TLS certificate will be automatically provisioned for the domain asynchronously in the background. + * + * @param {string} ruleId - Rule ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ProxyRule>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRuleStatus(ruleId: string): Promise<Models.ProxyRule>; + updateRuleStatus( + paramsOrFirst: { ruleId: string } | string + ): Promise<Models.ProxyRule> { + let params: { ruleId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ruleId: string }; + } else { + params = { + ruleId: paramsOrFirst as string + }; + } + + const ruleId = params.ruleId; + + if (typeof ruleId === 'undefined') { + throw new AppwriteException('Missing required parameter: "ruleId"'); + } + + const apiPath = '/proxy/rules/{ruleId}/status'.replace('{ruleId}', ruleId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/sites.ts b/src/services/sites.ts new file mode 100644 index 00000000..a45f6478 --- /dev/null +++ b/src/services/sites.ts @@ -0,0 +1,1917 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { InputFile } from '../inputFile'; + +import { Framework } from '../enums/framework'; +import { BuildRuntime } from '../enums/build-runtime'; +import { Adapter } from '../enums/adapter'; +import { TemplateReferenceType } from '../enums/template-reference-type'; +import { VCSReferenceType } from '../enums/vcs-reference-type'; +import { DeploymentDownloadType } from '../enums/deployment-download-type'; + +export class Sites { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's sites. You can use the query params to filter your results. + * + * @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: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SiteList>} + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.SiteList>; + /** + * Get a list of all the project's sites. You can use the query params to filter your results. + * + * @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: name, enabled, framework, deploymentId, buildCommand, installCommand, outputDirectory, installationId + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SiteList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.SiteList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.SiteList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/sites'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new site. + * + * @param {string} params.siteId - Site 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. + * @param {string} params.name - Site name. Max length: 128 chars. + * @param {Framework} params.framework - Sites framework. + * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. + * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} params.timeout - Maximum request time in seconds. + * @param {string} params.installCommand - Install Command. + * @param {string} params.buildCommand - Build Command. + * @param {string} params.startCommand - Custom start command. Leave empty to use default. + * @param {string} params.outputDirectory - Output Directory for site. + * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} params.fallbackFile - Fallback file for single page application sites. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} params.providerBranch - Production branch for the repo linked to the site. + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to site code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the site deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; + /** + * Create a new site. + * + * @param {string} siteId - Site 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. + * @param {string} name - Site name. Max length: 128 chars. + * @param {Framework} framework - Sites framework. + * @param {BuildRuntime} buildRuntime - Runtime to use during build step. + * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} timeout - Maximum request time in seconds. + * @param {string} installCommand - Install Command. + * @param {string} buildCommand - Build Command. + * @param {string} startCommand - Custom start command. Leave empty to use default. + * @param {string} outputDirectory - Output Directory for site. + * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} fallbackFile - Fallback file for single page application sites. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} providerBranch - Production branch for the repo linked to the site. + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to site code in the linked repo. + * @param {string} buildSpecification - Build specification for the site deployments. + * @param {string} runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; + create( + paramsOrFirst: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Site> { + let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + siteId: paramsOrFirst as string, + name: rest[0] as string, + framework: rest[1] as Framework, + buildRuntime: rest[2] as BuildRuntime, + enabled: rest[3] as boolean, + logging: rest[4] as boolean, + timeout: rest[5] as number, + installCommand: rest[6] as string, + buildCommand: rest[7] as string, + startCommand: rest[8] as string, + outputDirectory: rest[9] as string, + adapter: rest[10] as Adapter, + installationId: rest[11] as string, + fallbackFile: rest[12] as string, + providerRepositoryId: rest[13] as string, + providerBranch: rest[14] as string, + providerSilentMode: rest[15] as boolean, + providerRootDirectory: rest[16] as string, + buildSpecification: rest[17] as string, + runtimeSpecification: rest[18] as string, + deploymentRetention: rest[19] as number + }; + } + + const siteId = params.siteId; + const name = params.name; + const framework = params.framework; + const buildRuntime = params.buildRuntime; + const enabled = params.enabled; + const logging = params.logging; + const timeout = params.timeout; + const installCommand = params.installCommand; + const buildCommand = params.buildCommand; + const startCommand = params.startCommand; + const outputDirectory = params.outputDirectory; + const adapter = params.adapter; + const installationId = params.installationId; + const fallbackFile = params.fallbackFile; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof framework === 'undefined') { + throw new AppwriteException('Missing required parameter: "framework"'); + } + if (typeof buildRuntime === 'undefined') { + throw new AppwriteException('Missing required parameter: "buildRuntime"'); + } + + const apiPath = '/sites'; + const payload: Payload = {}; + if (typeof siteId !== 'undefined') { + payload['siteId'] = siteId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof framework !== 'undefined') { + payload['framework'] = framework; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof installCommand !== 'undefined') { + payload['installCommand'] = installCommand; + } + if (typeof buildCommand !== 'undefined') { + payload['buildCommand'] = buildCommand; + } + if (typeof startCommand !== 'undefined') { + payload['startCommand'] = startCommand; + } + if (typeof outputDirectory !== 'undefined') { + payload['outputDirectory'] = outputDirectory; + } + if (typeof buildRuntime !== 'undefined') { + payload['buildRuntime'] = buildRuntime; + } + if (typeof adapter !== 'undefined') { + payload['adapter'] = adapter; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof fallbackFile !== 'undefined') { + payload['fallbackFile'] = fallbackFile; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all frameworks that are currently available on the server instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.FrameworkList>} + */ + listFrameworks(): Promise<Models.FrameworkList> { + + const apiPath = '/sites/frameworks'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List allowed site specifications for this instance. + * + * @throws {AppwriteException} + * @returns {Promise<Models.SpecificationList>} + */ + listSpecifications(): Promise<Models.SpecificationList> { + + const apiPath = '/sites/specifications'; + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a site by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + get(params: { siteId: string }): Promise<Models.Site>; + /** + * Get a site by its unique ID. + * + * @param {string} siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(siteId: string): Promise<Models.Site>; + get( + paramsOrFirst: { siteId: string } | string + ): Promise<Models.Site> { + let params: { siteId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string }; + } else { + params = { + siteId: paramsOrFirst as string + }; + } + + const siteId = params.siteId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update site by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.name - Site name. Max length: 128 chars. + * @param {Framework} params.framework - Sites framework. + * @param {boolean} params.enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} params.logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} params.timeout - Maximum request time in seconds. + * @param {string} params.installCommand - Install Command. + * @param {string} params.buildCommand - Build Command. + * @param {string} params.startCommand - Custom start command. Leave empty to use default. + * @param {string} params.outputDirectory - Output Directory for site. + * @param {BuildRuntime} params.buildRuntime - Runtime to use during build step. + * @param {Adapter} params.adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} params.fallbackFile - Fallback file for single page application sites. + * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} params.providerBranch - Production branch for the repo linked to the site. + * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} params.providerRootDirectory - Path to site code in the linked repo. + * @param {string} params.buildSpecification - Build specification for the site deployments. + * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; + /** + * Update site by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} name - Site name. Max length: 128 chars. + * @param {Framework} framework - Sites framework. + * @param {boolean} enabled - Is site enabled? When set to 'disabled', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled. + * @param {boolean} logging - When disabled, request logs will exclude logs and errors, and site responses will be slightly faster. + * @param {number} timeout - Maximum request time in seconds. + * @param {string} installCommand - Install Command. + * @param {string} buildCommand - Build Command. + * @param {string} startCommand - Custom start command. Leave empty to use default. + * @param {string} outputDirectory - Output Directory for site. + * @param {BuildRuntime} buildRuntime - Runtime to use during build step. + * @param {Adapter} adapter - Framework adapter defining rendering strategy. Allowed values are: static, ssr + * @param {string} fallbackFile - Fallback file for single page application sites. + * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. + * @param {string} providerRepositoryId - Repository ID of the repo linked to the site. + * @param {string} providerBranch - Production branch for the repo linked to the site. + * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. + * @param {string} providerRootDirectory - Path to site code in the linked repo. + * @param {string} buildSpecification - Build specification for the site deployments. + * @param {string} runtimeSpecification - Runtime specification for the SSR executions. + * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; + update( + paramsOrFirst: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + ): Promise<Models.Site> { + let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + } else { + params = { + siteId: paramsOrFirst as string, + name: rest[0] as string, + framework: rest[1] as Framework, + enabled: rest[2] as boolean, + logging: rest[3] as boolean, + timeout: rest[4] as number, + installCommand: rest[5] as string, + buildCommand: rest[6] as string, + startCommand: rest[7] as string, + outputDirectory: rest[8] as string, + buildRuntime: rest[9] as BuildRuntime, + adapter: rest[10] as Adapter, + fallbackFile: rest[11] as string, + installationId: rest[12] as string, + providerRepositoryId: rest[13] as string, + providerBranch: rest[14] as string, + providerSilentMode: rest[15] as boolean, + providerRootDirectory: rest[16] as string, + buildSpecification: rest[17] as string, + runtimeSpecification: rest[18] as string, + deploymentRetention: rest[19] as number + }; + } + + const siteId = params.siteId; + const name = params.name; + const framework = params.framework; + const enabled = params.enabled; + const logging = params.logging; + const timeout = params.timeout; + const installCommand = params.installCommand; + const buildCommand = params.buildCommand; + const startCommand = params.startCommand; + const outputDirectory = params.outputDirectory; + const buildRuntime = params.buildRuntime; + const adapter = params.adapter; + const fallbackFile = params.fallbackFile; + const installationId = params.installationId; + const providerRepositoryId = params.providerRepositoryId; + const providerBranch = params.providerBranch; + const providerSilentMode = params.providerSilentMode; + const providerRootDirectory = params.providerRootDirectory; + const buildSpecification = params.buildSpecification; + const runtimeSpecification = params.runtimeSpecification; + const deploymentRetention = params.deploymentRetention; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof framework === 'undefined') { + throw new AppwriteException('Missing required parameter: "framework"'); + } + + const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof framework !== 'undefined') { + payload['framework'] = framework; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof logging !== 'undefined') { + payload['logging'] = logging; + } + if (typeof timeout !== 'undefined') { + payload['timeout'] = timeout; + } + if (typeof installCommand !== 'undefined') { + payload['installCommand'] = installCommand; + } + if (typeof buildCommand !== 'undefined') { + payload['buildCommand'] = buildCommand; + } + if (typeof startCommand !== 'undefined') { + payload['startCommand'] = startCommand; + } + if (typeof outputDirectory !== 'undefined') { + payload['outputDirectory'] = outputDirectory; + } + if (typeof buildRuntime !== 'undefined') { + payload['buildRuntime'] = buildRuntime; + } + if (typeof adapter !== 'undefined') { + payload['adapter'] = adapter; + } + if (typeof fallbackFile !== 'undefined') { + payload['fallbackFile'] = fallbackFile; + } + if (typeof installationId !== 'undefined') { + payload['installationId'] = installationId; + } + if (typeof providerRepositoryId !== 'undefined') { + payload['providerRepositoryId'] = providerRepositoryId; + } + if (typeof providerBranch !== 'undefined') { + payload['providerBranch'] = providerBranch; + } + if (typeof providerSilentMode !== 'undefined') { + payload['providerSilentMode'] = providerSilentMode; + } + if (typeof providerRootDirectory !== 'undefined') { + payload['providerRootDirectory'] = providerRootDirectory; + } + if (typeof buildSpecification !== 'undefined') { + payload['buildSpecification'] = buildSpecification; + } + if (typeof runtimeSpecification !== 'undefined') { + payload['runtimeSpecification'] = runtimeSpecification; + } + if (typeof deploymentRetention !== 'undefined') { + payload['deploymentRetention'] = deploymentRetention; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a site by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { siteId: string }): Promise<{}>; + /** + * Delete a site by its unique ID. + * + * @param {string} siteId - Site ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(siteId: string): Promise<{}>; + delete( + paramsOrFirst: { siteId: string } | string + ): Promise<{}> { + let params: { siteId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string }; + } else { + params = { + siteId: paramsOrFirst as string + }; + } + + const siteId = params.siteId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}'.replace('{siteId}', siteId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + */ + updateSiteDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Site>; + /** + * Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Site>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSiteDeployment(siteId: string, deploymentId: string): Promise<Models.Site>; + updateSiteDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Site> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployment'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all the site's code deployments. You can use the query params to filter your results. + * + * @param {string} params.siteId - Site ID. + * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + */ + listDeployments(params: { siteId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.DeploymentList>; + /** + * Get a list of all the site's code deployments. You can use the query params to filter your results. + * + * @param {string} siteId - Site ID. + * @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: buildSize, sourceSize, totalSize, buildDuration, status, activate, type + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DeploymentList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listDeployments(siteId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.DeploymentList>; + listDeployments( + paramsOrFirst: { siteId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.DeploymentList> { + let params: { siteId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const siteId = params.siteId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. + * + * @param {string} params.siteId - Site ID. + * @param {File | InputFile} params.code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {string} params.installCommand - Install Commands. + * @param {string} params.buildCommand - Build Commands. + * @param {string} params.outputDirectory - Output Directory. + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDeployment(params: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void }): Promise<Models.Deployment>; + /** + * Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the site's deployment to use your new deployment ID. + * + * @param {string} siteId - Site ID. + * @param {File | InputFile} code - Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory. + * @param {string} installCommand - Install Commands. + * @param {string} buildCommand - Build Commands. + * @param {string} outputDirectory - Output Directory. + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDeployment(siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; + createDeployment( + paramsOrFirst: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File | InputFile)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; + let onProgress: ((progress: UploadProgress) => void); + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, code: File | InputFile, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean }; + onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + } else { + params = { + siteId: paramsOrFirst as string, + code: rest[0] as File | InputFile, + installCommand: rest[1] as string, + buildCommand: rest[2] as string, + outputDirectory: rest[3] as string, + activate: rest[4] as boolean + }; + onProgress = rest[5] as ((progress: UploadProgress) => void); + } + + const siteId = params.siteId; + const code = params.code; + const installCommand = params.installCommand; + const buildCommand = params.buildCommand; + const outputDirectory = params.outputDirectory; + const activate = params.activate; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof code === 'undefined') { + throw new AppwriteException('Missing required parameter: "code"'); + } + + const apiPath = '/sites/{siteId}/deployments'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof installCommand !== 'undefined') { + payload['installCommand'] = installCommand; + } + if (typeof buildCommand !== 'undefined') { + payload['buildCommand'] = buildCommand; + } + if (typeof outputDirectory !== 'undefined') { + payload['outputDirectory'] = outputDirectory; + } + if (typeof code !== 'undefined') { + payload['code'] = code; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'multipart/form-data', + } + + return this.client.chunkedUpload( + 'post', + uri, + apiHeaders, + payload, + onProgress + ); + } + + /** + * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createDuplicateDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDuplicateDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; + createDuplicateDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/duplicate'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof deploymentId !== 'undefined') { + payload['deploymentId'] = deploymentId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.repository - Repository name of the template. + * @param {string} params.owner - The name of the owner of the template. + * @param {string} params.rootDirectory - Path to site code in the template repo. + * @param {TemplateReferenceType} params.type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} params.reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createTemplateDeployment(params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment based on a template. + * + * Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/products/sites/templates) to find the template details. + * + * @param {string} siteId - Site ID. + * @param {string} repository - Repository name of the template. + * @param {string} owner - The name of the owner of the template. + * @param {string} rootDirectory - Path to site code in the template repo. + * @param {TemplateReferenceType} type - Type for the reference provided. Can be commit, branch, or tag + * @param {string} reference - Reference value, can be a commit hash, branch name, or release tag + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTemplateDeployment(siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createTemplateDeployment( + paramsOrFirst: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (TemplateReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, repository: string, owner: string, rootDirectory: string, type: TemplateReferenceType, reference: string, activate?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + repository: rest[0] as string, + owner: rest[1] as string, + rootDirectory: rest[2] as string, + type: rest[3] as TemplateReferenceType, + reference: rest[4] as string, + activate: rest[5] as boolean + }; + } + + const siteId = params.siteId; + const repository = params.repository; + const owner = params.owner; + const rootDirectory = params.rootDirectory; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof repository === 'undefined') { + throw new AppwriteException('Missing required parameter: "repository"'); + } + if (typeof owner === 'undefined') { + throw new AppwriteException('Missing required parameter: "owner"'); + } + if (typeof rootDirectory === 'undefined') { + throw new AppwriteException('Missing required parameter: "rootDirectory"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/sites/{siteId}/deployments/template'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof repository !== 'undefined') { + payload['repository'] = repository; + } + if (typeof owner !== 'undefined') { + payload['owner'] = owner; + } + if (typeof rootDirectory !== 'undefined') { + payload['rootDirectory'] = rootDirectory; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a deployment when a site is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} params.siteId - Site ID. + * @param {VCSReferenceType} params.type - Type of reference passed. Allowed values are: branch, commit + * @param {string} params.reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} params.activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + createVcsDeployment(params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }): Promise<Models.Deployment>; + /** + * Create a deployment when a site is connected to VCS. + * + * This endpoint lets you create deployment from a branch, commit, or a tag. + * + * @param {string} siteId - Site ID. + * @param {VCSReferenceType} type - Type of reference passed. Allowed values are: branch, commit + * @param {string} reference - VCS reference to create deployment from. Depending on type this can be: branch name, commit hash + * @param {boolean} activate - Automatically activate the deployment when it is finished building. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVcsDeployment(siteId: string, type: VCSReferenceType, reference: string, activate?: boolean): Promise<Models.Deployment>; + createVcsDeployment( + paramsOrFirst: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean } | string, + ...rest: [(VCSReferenceType)?, (string)?, (boolean)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, type: VCSReferenceType, reference: string, activate?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + type: rest[0] as VCSReferenceType, + reference: rest[1] as string, + activate: rest[2] as boolean + }; + } + + const siteId = params.siteId; + const type = params.type; + const reference = params.reference; + const activate = params.activate; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof reference === 'undefined') { + throw new AppwriteException('Missing required parameter: "reference"'); + } + + const apiPath = '/sites/{siteId}/deployments/vcs'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof reference !== 'undefined') { + payload['reference'] = reference; + } + if (typeof activate !== 'undefined') { + payload['activate'] = activate; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a site deployment by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + getDeployment(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Get a site deployment by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeployment(siteId: string, deploymentId: string): Promise<Models.Deployment>; + getDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a site deployment by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteDeployment(params: { siteId: string, deploymentId: string }): Promise<{}>; + /** + * Delete a site deployment by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteDeployment(siteId: string, deploymentId: string): Promise<{}>; + deleteDeployment( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): Promise<ArrayBuffer>; + /** + * Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>; + getDeploymentDownload( + paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType } | string, + ...rest: [(string)?, (DeploymentDownloadType)?] + ): Promise<ArrayBuffer> { + let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string, + type: rest[1] as DeploymentDownloadType + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + const type = params.type; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/download'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + if (typeof type !== 'undefined') { + payload['type'] = type; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + */ + updateDeploymentStatus(params: { siteId: string, deploymentId: string }): Promise<Models.Deployment>; + /** + * Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + * + * @param {string} siteId - Site ID. + * @param {string} deploymentId - Deployment ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Deployment>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDeploymentStatus(siteId: string, deploymentId: string): Promise<Models.Deployment>; + updateDeploymentStatus( + paramsOrFirst: { siteId: string, deploymentId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, deploymentId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, deploymentId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + deploymentId: rest[0] as string + }; + } + + const siteId = params.siteId; + const deploymentId = params.deploymentId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof deploymentId === 'undefined') { + throw new AppwriteException('Missing required parameter: "deploymentId"'); + } + + const apiPath = '/sites/{siteId}/deployments/{deploymentId}/status'.replace('{siteId}', siteId).replace('{deploymentId}', deploymentId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all site logs. You can use the query params to filter your results. + * + * @param {string} params.siteId - Site ID. + * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + */ + listLogs(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; + /** + * Get a list of all site logs. You can use the query params to filter your results. + * + * @param {string} siteId - Site ID. + * @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: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ExecutionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listLogs(siteId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; + listLogs( + paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.ExecutionList> { + let params: { siteId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const siteId = params.siteId; + const queries = params.queries; + const total = params.total; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}/logs'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a site request log by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + */ + getLog(params: { siteId: string, logId: string }): Promise<Models.Execution>; + /** + * Get a site request log by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Execution>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getLog(siteId: string, logId: string): Promise<Models.Execution>; + getLog( + paramsOrFirst: { siteId: string, logId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Execution> { + let params: { siteId: string, logId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, logId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + logId: rest[0] as string + }; + } + + const siteId = params.siteId; + const logId = params.logId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof logId === 'undefined') { + throw new AppwriteException('Missing required parameter: "logId"'); + } + + const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a site log by its unique ID. + * + * @param {string} params.siteId - Site ID. + * @param {string} params.logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteLog(params: { siteId: string, logId: string }): Promise<{}>; + /** + * Delete a site log by its unique ID. + * + * @param {string} siteId - Site ID. + * @param {string} logId - Log ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteLog(siteId: string, logId: string): Promise<{}>; + deleteLog( + paramsOrFirst: { siteId: string, logId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { siteId: string, logId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, logId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + logId: rest[0] as string + }; + } + + const siteId = params.siteId; + const logId = params.logId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof logId === 'undefined') { + throw new AppwriteException('Missing required parameter: "logId"'); + } + + const apiPath = '/sites/{siteId}/logs/{logId}'.replace('{siteId}', siteId).replace('{logId}', logId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all variables of a specific site. + * + * @param {string} params.siteId - Site unique ID. + * @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: key, resourceType, resourceId, secret + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + */ + listVariables(params: { siteId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; + /** + * Get a list of all variables of a specific site. + * + * @param {string} siteId - Site unique ID. + * @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: key, resourceType, resourceId, secret + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.VariableList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listVariables(siteId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables( + paramsOrFirst: { siteId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.VariableList> { + let params: { siteId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, queries?: string[], total?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const siteId = params.siteId; + const queries = params.queries; + const total = params.total; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + + const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable 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. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + createVariable(params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable 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. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVariable(siteId: string, variableId: string, key: string, value: string, secret?: boolean): Promise<Models.Variable>; + createVariable( + paramsOrFirst: { siteId: string, variableId: string, key: string, value: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key: string, value: string, secret?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof value === 'undefined') { + throw new AppwriteException('Missing required parameter: "value"'); + } + + const apiPath = '/sites/{siteId}/variables'.replace('{siteId}', siteId); + const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a variable by its unique ID. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + getVariable(params: { siteId: string, variableId: string }): Promise<Models.Variable>; + /** + * Get a variable by its unique ID. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getVariable(siteId: string, variableId: string): Promise<Models.Variable>; + getVariable( + paramsOrFirst: { siteId: string, variableId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Variable> { + let params: { siteId: string, variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update variable by its unique ID. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable unique ID. + * @param {string} params.key - Variable key. Max length: 255 chars. + * @param {string} params.value - Variable value. Max length: 8192 chars. + * @param {boolean} params.secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + */ + updateVariable(params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }): Promise<Models.Variable>; + /** + * Update variable by its unique ID. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable unique ID. + * @param {string} key - Variable key. Max length: 255 chars. + * @param {string} value - Variable value. Max length: 8192 chars. + * @param {boolean} secret - Secret variables can be updated or deleted, but only sites can read them during build and runtime. + * @throws {AppwriteException} + * @returns {Promise<Models.Variable>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVariable(siteId: string, variableId: string, key?: string, value?: string, secret?: boolean): Promise<Models.Variable>; + updateVariable( + paramsOrFirst: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean } | string, + ...rest: [(string)?, (string)?, (string)?, (boolean)?] + ): Promise<Models.Variable> { + let params: { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string, key?: string, value?: string, secret?: boolean }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string, + key: rest[1] as string, + value: rest[2] as string, + secret: rest[3] as boolean + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + const key = params.key; + const value = params.value; + const secret = params.secret; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a variable by its unique ID. + * + * @param {string} params.siteId - Site unique ID. + * @param {string} params.variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteVariable(params: { siteId: string, variableId: string }): Promise<{}>; + /** + * Delete a variable by its unique ID. + * + * @param {string} siteId - Site unique ID. + * @param {string} variableId - Variable unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteVariable(siteId: string, variableId: string): Promise<{}>; + deleteVariable( + paramsOrFirst: { siteId: string, variableId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { siteId: string, variableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { siteId: string, variableId: string }; + } else { + params = { + siteId: paramsOrFirst as string, + variableId: rest[0] as string + }; + } + + const siteId = params.siteId; + const variableId = params.variableId; + + if (typeof siteId === 'undefined') { + throw new AppwriteException('Missing required parameter: "siteId"'); + } + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); + } + + const apiPath = '/sites/{siteId}/variables/{variableId}'.replace('{siteId}', siteId).replace('{variableId}', variableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/storage.ts b/src/services/storage.ts new file mode 100644 index 00000000..f38792b7 --- /dev/null +++ b/src/services/storage.ts @@ -0,0 +1,1082 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +import { InputFile } from '../inputFile'; + +import { Compression } from '../enums/compression'; +import { ImageGravity } from '../enums/image-gravity'; +import { ImageFormat } from '../enums/image-format'; + +export class Storage { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the storage buckets. You can use the query params to filter your results. + * + * @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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.BucketList>} + */ + listBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.BucketList>; + /** + * Get a list of all the storage buckets. You can use the query params to filter your results. + * + * @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: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.BucketList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>; + listBuckets( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.BucketList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/storage/buckets'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new storage bucket. + * + * @param {string} params.bucketId - 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. + * @param {string} params.name - Bucket name + * @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} params.transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + */ + createBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; + /** + * Create a new storage bucket. + * + * @param {string} bucketId - 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. + * @param {string} name - Bucket name + * @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; + createBucket( + paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Bucket> { + let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + } else { + params = { + bucketId: paramsOrFirst as string, + name: rest[0] as string, + permissions: rest[1] as string[], + fileSecurity: rest[2] as boolean, + enabled: rest[3] as boolean, + maximumFileSize: rest[4] as number, + allowedFileExtensions: rest[5] as string[], + compression: rest[6] as Compression, + encryption: rest[7] as boolean, + antivirus: rest[8] as boolean, + transformations: rest[9] as boolean + }; + } + + const bucketId = params.bucketId; + const name = params.name; + const permissions = params.permissions; + const fileSecurity = params.fileSecurity; + const enabled = params.enabled; + const maximumFileSize = params.maximumFileSize; + const allowedFileExtensions = params.allowedFileExtensions; + const compression = params.compression; + const encryption = params.encryption; + const antivirus = params.antivirus; + const transformations = params.transformations; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/storage/buckets'; + const payload: Payload = {}; + if (typeof bucketId !== 'undefined') { + payload['bucketId'] = bucketId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof fileSecurity !== 'undefined') { + payload['fileSecurity'] = fileSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof maximumFileSize !== 'undefined') { + payload['maximumFileSize'] = maximumFileSize; + } + if (typeof allowedFileExtensions !== 'undefined') { + payload['allowedFileExtensions'] = allowedFileExtensions; + } + if (typeof compression !== 'undefined') { + payload['compression'] = compression; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof antivirus !== 'undefined') { + payload['antivirus'] = antivirus; + } + if (typeof transformations !== 'undefined') { + payload['transformations'] = transformations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + * + * @param {string} params.bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + */ + getBucket(params: { bucketId: string }): Promise<Models.Bucket>; + /** + * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata. + * + * @param {string} bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getBucket(bucketId: string): Promise<Models.Bucket>; + getBucket( + paramsOrFirst: { bucketId: string } | string + ): Promise<Models.Bucket> { + let params: { bucketId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string }; + } else { + params = { + bucketId: paramsOrFirst as string + }; + } + + const bucketId = params.bucketId; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a storage bucket by its unique ID. + * + * @param {string} params.bucketId - Bucket unique ID. + * @param {string} params.name - Bucket name + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} params.transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + */ + updateBucket(params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }): Promise<Models.Bucket>; + /** + * Update a storage bucket by its unique ID. + * + * @param {string} bucketId - Bucket unique ID. + * @param {string} name - Bucket name + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled. + * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB. + * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long. + * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled + * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled + * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled + * @param {boolean} transformations - Are image transformations enabled? + * @throws {AppwriteException} + * @returns {Promise<Models.Bucket>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>; + updateBucket( + paramsOrFirst: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?, (boolean)?, (number)?, (string[])?, (Compression)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Bucket> { + let params: { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean }; + } else { + params = { + bucketId: paramsOrFirst as string, + name: rest[0] as string, + permissions: rest[1] as string[], + fileSecurity: rest[2] as boolean, + enabled: rest[3] as boolean, + maximumFileSize: rest[4] as number, + allowedFileExtensions: rest[5] as string[], + compression: rest[6] as Compression, + encryption: rest[7] as boolean, + antivirus: rest[8] as boolean, + transformations: rest[9] as boolean + }; + } + + const bucketId = params.bucketId; + const name = params.name; + const permissions = params.permissions; + const fileSecurity = params.fileSecurity; + const enabled = params.enabled; + const maximumFileSize = params.maximumFileSize; + const allowedFileExtensions = params.allowedFileExtensions; + const compression = params.compression; + const encryption = params.encryption; + const antivirus = params.antivirus; + const transformations = params.transformations; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof fileSecurity !== 'undefined') { + payload['fileSecurity'] = fileSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof maximumFileSize !== 'undefined') { + payload['maximumFileSize'] = maximumFileSize; + } + if (typeof allowedFileExtensions !== 'undefined') { + payload['allowedFileExtensions'] = allowedFileExtensions; + } + if (typeof compression !== 'undefined') { + payload['compression'] = compression; + } + if (typeof encryption !== 'undefined') { + payload['encryption'] = encryption; + } + if (typeof antivirus !== 'undefined') { + payload['antivirus'] = antivirus; + } + if (typeof transformations !== 'undefined') { + payload['transformations'] = transformations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a storage bucket by its unique ID. + * + * @param {string} params.bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteBucket(params: { bucketId: string }): Promise<{}>; + /** + * Delete a storage bucket by its unique ID. + * + * @param {string} bucketId - Bucket unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteBucket(bucketId: string): Promise<{}>; + deleteBucket( + paramsOrFirst: { bucketId: string } | string + ): Promise<{}> { + let params: { bucketId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string }; + } else { + params = { + bucketId: paramsOrFirst as string + }; + } + + const bucketId = params.bucketId; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + + const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all the user files. You can use the query params to filter your results. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @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: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.FileList>} + */ + listFiles(params: { bucketId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.FileList>; + /** + * Get a list of all the user files. You can use the query params to filter your results. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @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: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.FileList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.FileList>; + listFiles( + paramsOrFirst: { bucketId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.FileList> { + let params: { bucketId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + bucketId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const bucketId = params.bucketId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. + * + * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. + * + * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. + * + * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + * + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File 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. + * @param {File | InputFile} params.file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). + * @param {string[]} params.permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @throws {AppwriteException} + * @returns {Promise<Models.File>} + */ + createFile(params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void }): Promise<Models.File>; + /** + * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console. + * + * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes. + * + * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one. + * + * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally. + * + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File 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. + * @param {File | InputFile} file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file). + * @param {string[]} permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @throws {AppwriteException} + * @returns {Promise<Models.File>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFile(bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>; + createFile( + paramsOrFirst: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[], onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(string)?, (File | InputFile)?, (string[])?,((progress: UploadProgress) => void)?] + ): Promise<Models.File> { + let params: { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[] }; + let onProgress: ((progress: UploadProgress) => void); + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, file: File | InputFile, permissions?: string[] }; + onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + file: rest[1] as File | InputFile, + permissions: rest[2] as string[] + }; + onProgress = rest[3] as ((progress: UploadProgress) => void); + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const file = params.file; + const permissions = params.permissions; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + if (typeof file === 'undefined') { + throw new AppwriteException('Missing required parameter: "file"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId); + const payload: Payload = {}; + if (typeof fileId !== 'undefined') { + payload['fileId'] = fileId; + } + if (typeof file !== 'undefined') { + payload['file'] = file; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'multipart/form-data', + } + + return this.client.chunkedUpload( + 'post', + uri, + apiHeaders, + payload, + onProgress + ); + } + + /** + * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File ID. + * @throws {AppwriteException} + * @returns {Promise<Models.File>} + */ + getFile(params: { bucketId: string, fileId: string }): Promise<Models.File>; + /** + * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File ID. + * @throws {AppwriteException} + * @returns {Promise<Models.File>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFile(bucketId: string, fileId: string): Promise<Models.File>; + getFile( + paramsOrFirst: { bucketId: string, fileId: string } | string, + ...rest: [(string)?] + ): Promise<Models.File> { + let params: { bucketId: string, fileId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a file by its unique ID. Only users with write permissions have access to update this resource. + * + * @param {string} params.bucketId - Bucket unique ID. + * @param {string} params.fileId - File ID. + * @param {string} params.name - File name. + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @throws {AppwriteException} + * @returns {Promise<Models.File>} + */ + updateFile(params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }): Promise<Models.File>; + /** + * Update a file by its unique ID. Only users with write permissions have access to update this resource. + * + * @param {string} bucketId - Bucket unique ID. + * @param {string} fileId - File ID. + * @param {string} name - File name. + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @throws {AppwriteException} + * @returns {Promise<Models.File>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>; + updateFile( + paramsOrFirst: { bucketId: string, fileId: string, name?: string, permissions?: string[] } | string, + ...rest: [(string)?, (string)?, (string[])?] + ): Promise<Models.File> { + let params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, name?: string, permissions?: string[] }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[] + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const name = params.name; + const permissions = params.permissions; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteFile(params: { bucketId: string, fileId: string }): Promise<{}>; + /** + * Delete a file by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteFile(bucketId: string, fileId: string): Promise<{}>; + deleteFile( + paramsOrFirst: { bucketId: string, fileId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { bucketId: string, fileId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} params.bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File ID. + * @param {string} params.token - File token for accessing this file. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getFileDownload(params: { bucketId: string, fileId: string, token?: string }): Promise<ArrayBuffer>; + /** + * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + * + * @param {string} bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File ID. + * @param {string} token - File token for accessing this file. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFileDownload(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>; + getFileDownload( + paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<ArrayBuffer> { + let params: { bucketId: string, fileId: string, token?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + token: rest[1] as string + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const token = params.token; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof token !== 'undefined') { + payload['token'] = token; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File ID + * @param {number} params.width - Resize preview image width, Pass an integer between 0 to 4000. + * @param {number} params.height - Resize preview image height, Pass an integer between 0 to 4000. + * @param {ImageGravity} params.gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right + * @param {number} params.quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @param {number} params.borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. + * @param {string} params.borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix. + * @param {number} params.borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000. + * @param {number} params.opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. + * @param {number} params.rotation - Preview image rotation in degrees. Pass an integer between -360 and 360. + * @param {string} params.background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. + * @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp). + * @param {string} params.token - File token for accessing this file. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getFilePreview(params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }): Promise<ArrayBuffer>; + /** + * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File ID + * @param {number} width - Resize preview image width, Pass an integer between 0 to 4000. + * @param {number} height - Resize preview image height, Pass an integer between 0 to 4000. + * @param {ImageGravity} gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right + * @param {number} quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality. + * @param {number} borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0. + * @param {string} borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix. + * @param {number} borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000. + * @param {number} opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1. + * @param {number} rotation - Preview image rotation in degrees. Pass an integer between -360 and 360. + * @param {string} background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. + * @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp). + * @param {string} token - File token for accessing this file. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): Promise<ArrayBuffer>; + getFilePreview( + paramsOrFirst: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string } | string, + ...rest: [(string)?, (number)?, (number)?, (ImageGravity)?, (number)?, (number)?, (string)?, (number)?, (number)?, (number)?, (string)?, (ImageFormat)?, (string)?] + ): Promise<ArrayBuffer> { + let params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + width: rest[1] as number, + height: rest[2] as number, + gravity: rest[3] as ImageGravity, + quality: rest[4] as number, + borderWidth: rest[5] as number, + borderColor: rest[6] as string, + borderRadius: rest[7] as number, + opacity: rest[8] as number, + rotation: rest[9] as number, + background: rest[10] as string, + output: rest[11] as ImageFormat, + token: rest[12] as string + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const width = params.width; + const height = params.height; + const gravity = params.gravity; + const quality = params.quality; + const borderWidth = params.borderWidth; + const borderColor = params.borderColor; + const borderRadius = params.borderRadius; + const opacity = params.opacity; + const rotation = params.rotation; + const background = params.background; + const output = params.output; + const token = params.token; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof width !== 'undefined') { + payload['width'] = width; + } + if (typeof height !== 'undefined') { + payload['height'] = height; + } + if (typeof gravity !== 'undefined') { + payload['gravity'] = gravity; + } + if (typeof quality !== 'undefined') { + payload['quality'] = quality; + } + if (typeof borderWidth !== 'undefined') { + payload['borderWidth'] = borderWidth; + } + if (typeof borderColor !== 'undefined') { + payload['borderColor'] = borderColor; + } + if (typeof borderRadius !== 'undefined') { + payload['borderRadius'] = borderRadius; + } + if (typeof opacity !== 'undefined') { + payload['opacity'] = opacity; + } + if (typeof rotation !== 'undefined') { + payload['rotation'] = rotation; + } + if (typeof background !== 'undefined') { + payload['background'] = background; + } + if (typeof output !== 'undefined') { + payload['output'] = output; + } + if (typeof token !== 'undefined') { + payload['token'] = token; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } + + /** + * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File ID. + * @param {string} params.token - File token for accessing this file. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + */ + getFileView(params: { bucketId: string, fileId: string, token?: string }): Promise<ArrayBuffer>; + /** + * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File ID. + * @param {string} token - File token for accessing this file. + * @throws {AppwriteException} + * @returns {Promise<ArrayBuffer>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getFileView(bucketId: string, fileId: string, token?: string): Promise<ArrayBuffer>; + getFileView( + paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<ArrayBuffer> { + let params: { bucketId: string, fileId: string, token?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + token: rest[1] as string + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const token = params.token; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof token !== 'undefined') { + payload['token'] = token; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); + } +} diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts new file mode 100644 index 00000000..40766d5e --- /dev/null +++ b/src/services/tables-db.ts @@ -0,0 +1,6167 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { RelationshipType } from '../enums/relationship-type'; +import { RelationMutate } from '../enums/relation-mutate'; +import { TablesDBIndexType } from '../enums/tables-db-index-type'; +import { OrderBy } from '../enums/order-by'; + +export class TablesDB { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + * + * @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 columns: name + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + */ + list(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.DatabaseList>; + /** + * Get a list of all databases from the current Appwrite project. You can use the search parameter to filter your results. + * + * @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 columns: name + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.DatabaseList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], search?: string, total?: boolean): Promise<Models.DatabaseList>; + list( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.DatabaseList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/tablesdb'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Database. + * + * + * @param {string} params.databaseId - 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. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + */ + create(params: { databaseId: string, name: string, enabled?: boolean }): Promise<Models.Database>; + /** + * Create a new Database. + * + * + * @param {string} databaseId - 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. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database>; + create( + paramsOrFirst: { databaseId: string, name: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/tablesdb'; + const payload: Payload = {}; + if (typeof databaseId !== 'undefined') { + payload['databaseId'] = databaseId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * List transactions across all databases. + * + * @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). + * @throws {AppwriteException} + * @returns {Promise<Models.TransactionList>} + */ + listTransactions(params?: { queries?: string[] }): Promise<Models.TransactionList>; + /** + * List transactions across all databases. + * + * @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). + * @throws {AppwriteException} + * @returns {Promise<Models.TransactionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTransactions(queries?: string[]): Promise<Models.TransactionList>; + listTransactions( + paramsOrFirst?: { queries?: string[] } | string[] + ): Promise<Models.TransactionList> { + let params: { queries?: string[] }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[] }; + } else { + params = { + queries: paramsOrFirst as string[] + }; + } + + const queries = params.queries; + + + const apiPath = '/tablesdb/transactions'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new transaction. + * + * @param {number} params.ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + createTransaction(params?: { ttl?: number }): Promise<Models.Transaction>; + /** + * Create a new transaction. + * + * @param {number} ttl - Seconds before the transaction expires. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTransaction(ttl?: number): Promise<Models.Transaction>; + createTransaction( + paramsOrFirst?: { ttl?: number } | number + ): Promise<Models.Transaction> { + let params: { ttl?: number }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { ttl?: number }; + } else { + params = { + ttl: paramsOrFirst as number + }; + } + + const ttl = params.ttl; + + + const apiPath = '/tablesdb/transactions'; + const payload: Payload = {}; + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a transaction by its unique ID. + * + * @param {string} params.transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + getTransaction(params: { transactionId: string }): Promise<Models.Transaction>; + /** + * Get a transaction by its unique ID. + * + * @param {string} transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTransaction(transactionId: string): Promise<Models.Transaction>; + getTransaction( + paramsOrFirst: { transactionId: string } | string + ): Promise<Models.Transaction> { + let params: { transactionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string }; + } else { + params = { + transactionId: paramsOrFirst as string + }; + } + + const transactionId = params.transactionId; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} params.transactionId - Transaction ID. + * @param {boolean} params.commit - Commit transaction? + * @param {boolean} params.rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise<Models.Transaction>; + /** + * Update a transaction, to either commit or roll back its operations. + * + * @param {string} transactionId - Transaction ID. + * @param {boolean} commit - Commit transaction? + * @param {boolean} rollback - Rollback transaction? + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>; + updateTransaction( + paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string, + ...rest: [(boolean)?, (boolean)?] + ): Promise<Models.Transaction> { + let params: { transactionId: string, commit?: boolean, rollback?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean }; + } else { + params = { + transactionId: paramsOrFirst as string, + commit: rest[0] as boolean, + rollback: rest[1] as boolean + }; + } + + const transactionId = params.transactionId; + const commit = params.commit; + const rollback = params.rollback; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + if (typeof commit !== 'undefined') { + payload['commit'] = commit; + } + if (typeof rollback !== 'undefined') { + payload['rollback'] = rollback; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a transaction by its unique ID. + * + * @param {string} params.transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTransaction(params: { transactionId: string }): Promise<{}>; + /** + * Delete a transaction by its unique ID. + * + * @param {string} transactionId - Transaction ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTransaction(transactionId: string): Promise<{}>; + deleteTransaction( + paramsOrFirst: { transactionId: string } | string + ): Promise<{}> { + let params: { transactionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string }; + } else { + params = { + transactionId: paramsOrFirst as string + }; + } + + const transactionId = params.transactionId; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create multiple operations in a single transaction. + * + * @param {string} params.transactionId - Transaction ID. + * @param {object[]} params.operations - Array of staged operations. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + */ + createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; + /** + * Create multiple operations in a single transaction. + * + * @param {string} transactionId - Transaction ID. + * @param {object[]} operations - Array of staged operations. + * @throws {AppwriteException} + * @returns {Promise<Models.Transaction>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>; + createOperations( + paramsOrFirst: { transactionId: string, operations?: object[] } | string, + ...rest: [(object[])?] + ): Promise<Models.Transaction> { + let params: { transactionId: string, operations?: object[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; + } else { + params = { + transactionId: paramsOrFirst as string, + operations: rest[0] as object[] + }; + } + + const transactionId = params.transactionId; + const operations = params.operations; + + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); + } + + const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); + const payload: Payload = {}; + if (typeof operations !== 'undefined') { + payload['operations'] = operations; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + */ + get(params: { databaseId: string }): Promise<Models.Database>; + /** + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(databaseId: string): Promise<Models.Database>; + get( + paramsOrFirst: { databaseId: string } | string + ): Promise<Models.Database> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a database by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.name - Database name. Max length: 128 chars. + * @param {boolean} params.enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + */ + update(params: { databaseId: string, name?: string, enabled?: boolean }): Promise<Models.Database>; + /** + * Update a database by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} name - Database name. Max length: 128 chars. + * @param {boolean} enabled - Is database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(databaseId: string, name?: string, enabled?: boolean): Promise<Models.Database>; + update( + paramsOrFirst: { databaseId: string, name?: string, enabled?: boolean } | string, + ...rest: [(string)?, (boolean)?] + ): Promise<Models.Database> { + let params: { databaseId: string, name?: string, enabled?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, name?: string, enabled?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean + }; + } + + const databaseId = params.databaseId; + const name = params.name; + const enabled = params.enabled; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} params.databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { databaseId: string }): Promise<{}>; + /** + * Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database. + * + * @param {string} databaseId - Database ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(databaseId: string): Promise<{}>; + delete( + paramsOrFirst: { databaseId: string } | string + ): Promise<{}> { + let params: { databaseId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string }; + } else { + params = { + databaseId: paramsOrFirst as string + }; + } + + const databaseId = params.databaseId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @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 columns: name, enabled, rowSecurity + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TableList>} + */ + listTables(params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.TableList>; + /** + * Get a list of all tables that belong to the provided databaseId. You can use the search parameter to filter your results. + * + * @param {string} databaseId - Database ID. + * @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 columns: name, enabled, rowSecurity + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TableList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTables(databaseId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.TableList>; + listTables( + paramsOrFirst: { databaseId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.TableList> { + let params: { databaseId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - 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. + * @param {string} params.name - Table name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {object[]} params.columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} params.indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + */ + createTable(params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }): Promise<Models.Table>; + /** + * Create a new Table. Before using this route, you should create a new database resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - 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. + * @param {string} name - Table name. Max length: 128 chars. + * @param {string[]} permissions - An array of permissions strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {object[]} columns - Array of column definitions to create. Each column should contain: key (string), type (string: string, integer, float, boolean, datetime, relationship), size (integer, required for string type), required (boolean, optional), default (mixed, optional), array (boolean, optional), and type-specific options. + * @param {object[]} indexes - Array of index definitions to create. Each index should contain: key (string), type (string: key, fulltext, unique, spatial), attributes (array of column keys), orders (array of ASC/DESC, optional), and lengths (array of integers, optional). + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTable(databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[]): Promise<Models.Table>; + createTable( + paramsOrFirst: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (object[])?, (object[])?] + ): Promise<Models.Table> { + let params: { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, columns?: object[], indexes?: object[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + rowSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + columns: rest[5] as object[], + indexes: rest[6] as object[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const name = params.name; + const permissions = params.permissions; + const rowSecurity = params.rowSecurity; + const enabled = params.enabled; + const columns = params.columns; + const indexes = params.indexes; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables'.replace('{databaseId}', databaseId); + const payload: Payload = {}; + if (typeof tableId !== 'undefined') { + payload['tableId'] = tableId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof rowSecurity !== 'undefined') { + payload['rowSecurity'] = rowSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof columns !== 'undefined') { + payload['columns'] = columns; + } + if (typeof indexes !== 'undefined') { + payload['indexes'] = indexes; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + */ + getTable(params: { databaseId: string, tableId: string }): Promise<Models.Table>; + /** + * Get a table by its unique ID. This endpoint response returns a JSON object with the table metadata. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTable(databaseId: string, tableId: string): Promise<Models.Table>; + getTable( + paramsOrFirst: { databaseId: string, tableId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Table> { + let params: { databaseId: string, tableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a table by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.name - Table name. Max length: 128 chars. + * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} params.enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {boolean} params.purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + */ + updateTable(params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }): Promise<Models.Table>; + /** + * Update a table by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} name - Table name. Max length: 128 chars. + * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} rowSecurity - Enables configuring permissions for individual rows. A user needs one of row or table-level permissions to access a row. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {boolean} enabled - Is table enabled? When set to 'disabled', users cannot access the table but Server SDKs with and API key can still read and write to the table. No data is lost when this is toggled. + * @param {boolean} purge - When true, purge all cached list responses for this table as part of the update. Use this to force readers to see fresh data immediately instead of waiting for the cache TTL to expire. + * @throws {AppwriteException} + * @returns {Promise<Models.Table>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTable(databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean): Promise<Models.Table>; + updateTable( + paramsOrFirst: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.Table> { + let params: { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, name?: string, permissions?: string[], rowSecurity?: boolean, enabled?: boolean, purge?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + name: rest[1] as string, + permissions: rest[2] as string[], + rowSecurity: rest[3] as boolean, + enabled: rest[4] as boolean, + purge: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const name = params.name; + const permissions = params.permissions; + const rowSecurity = params.rowSecurity; + const enabled = params.enabled; + const purge = params.purge; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof rowSecurity !== 'undefined') { + payload['rowSecurity'] = rowSecurity; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof purge !== 'undefined') { + payload['purge'] = purge; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTable(params: { databaseId: string, tableId: string }): Promise<{}>; + /** + * Delete a table by its unique ID. Only users with write permissions have access to delete this resource. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTable(databaseId: string, tableId: string): Promise<{}>; + deleteTable( + paramsOrFirst: { databaseId: string, tableId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { databaseId: string, tableId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List columns in the table. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @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 columns: key, type, size, required, array, status, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnList>} + */ + listColumns(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnList>; + /** + * List columns in the table. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @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 columns: key, type, size, required, array, status, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listColumns(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnList>; + listColumns( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.ColumnList> { + let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a bigint column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + */ + createBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnBigint>; + /** + * Create a bigint column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnBigint>; + createBigIntColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.ColumnBigint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a bigint column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + */ + updateBigIntColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnBigint>; + /** + * Update a bigint column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBigint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBigIntColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnBigint>; + updateBigIntColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.ColumnBigint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/bigint/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a boolean column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + */ + createBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }): Promise<Models.ColumnBoolean>; + /** + * Create a boolean column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.ColumnBoolean>; + createBooleanColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnBoolean> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a boolean column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {boolean} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + */ + updateBooleanColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }): Promise<Models.ColumnBoolean>; + /** + * Update a boolean column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {boolean} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateBooleanColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.ColumnBoolean>; + updateBooleanColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (boolean)?, (string)?] + ): Promise<Models.ColumnBoolean> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as boolean, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/boolean/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a date time column according to the ISO 8601 standard. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + */ + createDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnDatetime>; + /** + * Create a date time column according to the ISO 8601 standard. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for the column in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnDatetime>; + createDatetimeColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnDatetime> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a date time column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + */ + updateDatetimeColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnDatetime>; + /** + * Update a date time column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnDatetime>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateDatetimeColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnDatetime>; + updateDatetimeColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnDatetime> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/datetime/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create an email column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + */ + createEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEmail>; + /** + * Create an email column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEmail>; + createEmailColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnEmail> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an email column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + */ + updateEmailColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEmail>; + /** + * Update an email column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEmail>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEmail>; + updateEmailColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnEmail> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/email/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {string[]} params.elements - Array of enum values. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + */ + createEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnEnum>; + /** + * Create an enumeration column. The `elements` param acts as a white-list of accepted values for this column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {string[]} elements - Array of enum values. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnEnum>; + createEnumColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnEnum> { + let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an enum column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {string[]} params.elements - Updated list of enum values. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + */ + updateEnumColumn(params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnEnum>; + /** + * Update an enum column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {string[]} elements - Updated list of enum values. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnEnum>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEnumColumn(databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnEnum>; + updateEnumColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnEnum> { + let params: { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + elements: rest[2] as string[], + required: rest[3] as boolean, + xdefault: rest[4] as string, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const elements = params.elements; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof elements === 'undefined') { + throw new AppwriteException('Missing required parameter: "elements"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/enum/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof elements !== 'undefined') { + payload['elements'] = elements; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a float column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number} params.min - Minimum value + * @param {number} params.max - Maximum value + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + */ + createFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }): Promise<Models.ColumnFloat>; + /** + * Create a float column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number} min - Minimum value + * @param {number} max - Maximum value + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.ColumnFloat>; + createFloatColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (boolean)?] + ): Promise<Models.ColumnFloat> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number, + max: rest[4] as number, + xdefault: rest[5] as number, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a float column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number} params.xdefault - Default value. Cannot be set when required. + * @param {number} params.min - Minimum value + * @param {number} params.max - Maximum value + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + */ + updateFloatColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }): Promise<Models.ColumnFloat>; + /** + * Update a float column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number} xdefault - Default value. Cannot be set when required. + * @param {number} min - Minimum value + * @param {number} max - Maximum value + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnFloat>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateFloatColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string): Promise<Models.ColumnFloat>; + updateFloatColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number)?, (number)?, (number)?, (string)?] + ): Promise<Models.ColumnFloat> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number, min?: number, max?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number, + min: rest[4] as number, + max: rest[5] as number, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/float/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create an integer column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + */ + createIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }): Promise<Models.ColumnInteger>; + /** + * Create an integer column. Optionally, minimum and maximum values can be provided. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean): Promise<Models.ColumnInteger>; + createIntegerColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (boolean)?] + ): Promise<Models.ColumnInteger> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, min?: number | bigint, max?: number | bigint, xdefault?: number | bigint, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + min: rest[3] as number | bigint, + max: rest[4] as number | bigint, + xdefault: rest[5] as number | bigint, + array: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const min = params.min; + const max = params.max; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an integer column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {number | bigint} params.xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} params.min - Minimum value + * @param {number | bigint} params.max - Maximum value + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + */ + updateIntegerColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }): Promise<Models.ColumnInteger>; + /** + * Update an integer column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {number | bigint} xdefault - Default value. Cannot be set when column is required. + * @param {number | bigint} min - Minimum value + * @param {number | bigint} max - Maximum value + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnInteger>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIntegerColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string): Promise<Models.ColumnInteger>; + updateIntegerColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (number | bigint)?, (number | bigint)?, (number | bigint)?, (string)?] + ): Promise<Models.ColumnInteger> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: number | bigint, min?: number | bigint, max?: number | bigint, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as number | bigint, + min: rest[4] as number | bigint, + max: rest[5] as number | bigint, + newKey: rest[6] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const min = params.min; + const max = params.max; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/integer/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create IP address column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + */ + createIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnIp>; + /** + * Create IP address column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnIp>; + createIpColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnIp> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an ip column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + */ + updateIpColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnIp>; + /** + * Update an ip column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIp>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateIpColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnIp>; + updateIpColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnIp> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/ip/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric line column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + */ + createLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnLine>; + /** + * Create a geometric line column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnLine>; + createLineColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.ColumnLine> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a line column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + */ + updateLineColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnLine>; + /** + * Update a line column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, two-dimensional array of coordinate pairs, [[longitude, latitude], [longitude, latitude], …], listing the vertices of the line in order. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLine>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLineColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnLine>; + updateLineColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.ColumnLine> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/line/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a longtext column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + */ + createLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnLongtext>; + /** + * Create a longtext column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnLongtext>; + createLongtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnLongtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a longtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + */ + updateLongtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnLongtext>; + /** + * Update a longtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnLongtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLongtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnLongtext>; + updateLongtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnLongtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/longtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a mediumtext column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + */ + createMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnMediumtext>; + /** + * Create a mediumtext column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnMediumtext>; + createMediumtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnMediumtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a mediumtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + */ + updateMediumtextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnMediumtext>; + /** + * Update a mediumtext column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnMediumtext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMediumtextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnMediumtext>; + updateMediumtextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnMediumtext> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/mediumtext/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric point column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + */ + createPointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPoint>; + /** + * Create a geometric point column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPoint>; + createPointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.ColumnPoint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a point column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + */ + updatePointColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPoint>; + /** + * Update a point column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, array of two numbers [longitude, latitude], representing a single coordinate. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPoint>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePointColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPoint>; + updatePointColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.ColumnPoint> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/point/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a geometric polygon column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + */ + createPolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }): Promise<Models.ColumnPolygon>; + /** + * Create a geometric polygon column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[]): Promise<Models.ColumnPolygon>; + createPolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?] + ): Promise<Models.ColumnPolygon> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a polygon column. Changing the `default` value will not update already existing rows. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {any[]} params.xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + */ + updatePolygonColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }): Promise<Models.ColumnPolygon>; + /** + * Update a polygon column. Changing the `default` value will not update already existing rows. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {any[]} xdefault - Default value for column when not provided, three-dimensional array where the outer array holds one or more linear rings, [[[longitude, latitude], …], …], the first ring is the exterior boundary, any additional rings are interior holes, and each ring must start and end with the same coordinate pair. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnPolygon>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePolygonColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string): Promise<Models.ColumnPolygon>; + updatePolygonColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (any[])?, (string)?] + ): Promise<Models.ColumnPolygon> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: any[], newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as any[], + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/polygon/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.relatedTableId - Related Table ID. + * @param {RelationshipType} params.type - Relation type + * @param {boolean} params.twoWay - Is Two Way? + * @param {string} params.key - Column Key. + * @param {string} params.twoWayKey - Two Way Column Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + */ + createRelationshipColumn(params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }): Promise<Models.ColumnRelationship>; + /** + * Create relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} relatedTableId - Related Table ID. + * @param {RelationshipType} type - Relation type + * @param {boolean} twoWay - Is Two Way? + * @param {string} key - Column Key. + * @param {string} twoWayKey - Two Way Column Key. + * @param {RelationMutate} onDelete - Constraints option + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRelationshipColumn(databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.ColumnRelationship>; + createRelationshipColumn( + paramsOrFirst: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate } | string, + ...rest: [(string)?, (string)?, (RelationshipType)?, (boolean)?, (string)?, (string)?, (RelationMutate)?] + ): Promise<Models.ColumnRelationship> { + let params: { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, relatedTableId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + relatedTableId: rest[1] as string, + type: rest[2] as RelationshipType, + twoWay: rest[3] as boolean, + key: rest[4] as string, + twoWayKey: rest[5] as string, + onDelete: rest[6] as RelationMutate + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const relatedTableId = params.relatedTableId; + const type = params.type; + const twoWay = params.twoWay; + const key = params.key; + const twoWayKey = params.twoWayKey; + const onDelete = params.onDelete; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof relatedTableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "relatedTableId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof relatedTableId !== 'undefined') { + payload['relatedTableId'] = relatedTableId; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof twoWay !== 'undefined') { + payload['twoWay'] = twoWay; + } + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof twoWayKey !== 'undefined') { + payload['twoWayKey'] = twoWayKey; + } + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a string column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {number} params.size - Column size for text columns, in number of characters. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated This API has been deprecated since 1.9.0. Please use `TablesDB.createTextColumn` instead. + */ + createStringColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnString>; + /** + * Create a string column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {number} size - Column size for text columns, in number of characters. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createStringColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnString>; + createStringColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnString> { + let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a string column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} params.size - Maximum size of the string column. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.updateTextColumn` instead. + */ + updateStringColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnString>; + /** + * Update a string column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} size - Maximum size of the string column. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStringColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnString>; + updateStringColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.ColumnString> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/string/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a text column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + */ + createTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnText>; + /** + * Create a text column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnText>; + createTextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnText> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean, + encrypt: rest[5] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a text column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + */ + updateTextColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnText>; + /** + * Update a text column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnText>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTextColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnText>; + updateTextColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnText> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/text/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a URL column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + */ + createUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }): Promise<Models.ColumnUrl>; + /** + * Create a URL column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.ColumnUrl>; + createUrlColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (boolean)?] + ): Promise<Models.ColumnUrl> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, array?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + array: rest[4] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update an url column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + */ + updateUrlColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }): Promise<Models.ColumnUrl>; + /** + * Update an url column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnUrl>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateUrlColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.ColumnUrl>; + updateUrlColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.ColumnUrl> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + newKey: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/url/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a varchar column. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {number} params.size - Column size for varchar columns, in number of characters. Maximum size is 16381. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} params.array - Is column an array? + * @param {boolean} params.encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + */ + createVarcharColumn(params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }): Promise<Models.ColumnVarchar>; + /** + * Create a varchar column. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {number} size - Column size for varchar columns, in number of characters. Maximum size is 16381. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {boolean} array - Is column an array? + * @param {boolean} encrypt - Toggle encryption for the column. Encryption enhances security by not storing any plain text values in the database. However, encrypted columns cannot be queried. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createVarcharColumn(databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.ColumnVarchar>; + createVarcharColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean } | string, + ...rest: [(string)?, (string)?, (number)?, (boolean)?, (string)?, (boolean)?, (boolean)?] + ): Promise<Models.ColumnVarchar> { + let params: { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + size: rest[2] as number, + required: rest[3] as boolean, + xdefault: rest[4] as string, + array: rest[5] as boolean, + encrypt: rest[6] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const size = params.size; + const required = params.required; + const xdefault = params.xdefault; + const array = params.array; + const encrypt = params.encrypt; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof size === 'undefined') { + throw new AppwriteException('Missing required parameter: "size"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof array !== 'undefined') { + payload['array'] = array; + } + if (typeof encrypt !== 'undefined') { + payload['encrypt'] = encrypt; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a varchar column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Column Key. + * @param {boolean} params.required - Is column required? + * @param {string} params.xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} params.size - Maximum size of the varchar column. + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + */ + updateVarcharColumn(params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }): Promise<Models.ColumnVarchar>; + /** + * Update a varchar column. Changing the `default` value will not update already existing rows. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Column Key. + * @param {boolean} required - Is column required? + * @param {string} xdefault - Default value for column when not provided. Cannot be set when column is required. + * @param {number} size - Maximum size of the varchar column. + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnVarchar>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateVarcharColumn(databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.ColumnVarchar>; + updateVarcharColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string } | string, + ...rest: [(string)?, (string)?, (boolean)?, (string)?, (number)?, (string)?] + ): Promise<Models.ColumnVarchar> { + let params: { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + required: rest[2] as boolean, + xdefault: rest[3] as string, + size: rest[4] as number, + newKey: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const required = params.required; + const xdefault = params.xdefault; + const size = params.size; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof required === 'undefined') { + throw new AppwriteException('Missing required parameter: "required"'); + } + if (typeof xdefault === 'undefined') { + throw new AppwriteException('Missing required parameter: "xdefault"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/varchar/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof required !== 'undefined') { + payload['required'] = required; + } + if (typeof xdefault !== 'undefined') { + payload['default'] = xdefault; + } + if (typeof size !== 'undefined') { + payload['size'] = size; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get column by ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} + */ + getColumn(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; + /** + * Get column by ID. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getColumn(databaseId: string, tableId: string, key: string): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString>; + getColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ColumnBoolean | Models.ColumnInteger | Models.ColumnFloat | Models.ColumnEmail | Models.ColumnEnum | Models.ColumnUrl | Models.ColumnIp | Models.ColumnDatetime | Models.ColumnRelationship | Models.ColumnString> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Deletes a column. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteColumn(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + /** + * Deletes a column. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteColumn(databaseId: string, tableId: string, key: string): Promise<{}>; + deleteColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.key - Column Key. + * @param {RelationMutate} params.onDelete - Constraints option + * @param {string} params.newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + */ + updateRelationshipColumn(params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }): Promise<Models.ColumnRelationship>; + /** + * Update relationship column. [Learn more about relationship columns](https://appwrite.io/docs/databases-relationships#relationship-columns). + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} key - Column Key. + * @param {RelationMutate} onDelete - Constraints option + * @param {string} newKey - New Column Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnRelationship>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRelationshipColumn(databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.ColumnRelationship>; + updateRelationshipColumn( + paramsOrFirst: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string } | string, + ...rest: [(string)?, (string)?, (RelationMutate)?, (string)?] + ): Promise<Models.ColumnRelationship> { + let params: { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, onDelete?: RelationMutate, newKey?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + onDelete: rest[2] as RelationMutate, + newKey: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const onDelete = params.onDelete; + const newKey = params.newKey; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/columns/{key}/relationship'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + if (typeof onDelete !== 'undefined') { + payload['onDelete'] = onDelete; + } + if (typeof newKey !== 'undefined') { + payload['newKey'] = newKey; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * List indexes on the table. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @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 columns: key, type, status, attributes, error + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndexList>} + */ + listIndexes(params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }): Promise<Models.ColumnIndexList>; + /** + * List indexes on the table. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @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 columns: key, type, status, attributes, error + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndexList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIndexes(databaseId: string, tableId: string, queries?: string[], total?: boolean): Promise<Models.ColumnIndexList>; + listIndexes( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.ColumnIndexList> { + let params: { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], total?: boolean }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const total = params.total; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. + * Type can be `key`, `fulltext`, or `unique`. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Index Key. + * @param {TablesDBIndexType} params.type - Index type. + * @param {string[]} params.columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. + * @param {OrderBy[]} params.orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} params.lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + */ + createIndex(params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }): Promise<Models.ColumnIndex>; + /** + * Creates an index on the columns listed. Your index should include all the columns you will query in a single request. + * Type can be `key`, `fulltext`, or `unique`. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Index Key. + * @param {TablesDBIndexType} type - Index type. + * @param {string[]} columns - Array of columns to index. Maximum of 100 columns are allowed, each 32 characters long. + * @param {OrderBy[]} orders - Array of index orders. Maximum of 100 orders are allowed. + * @param {number[]} lengths - Length of index. Maximum of 100 + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createIndex(databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[]): Promise<Models.ColumnIndex>; + createIndex( + paramsOrFirst: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] } | string, + ...rest: [(string)?, (string)?, (TablesDBIndexType)?, (string[])?, (OrderBy[])?, (number[])?] + ): Promise<Models.ColumnIndex> { + let params: { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string, type: TablesDBIndexType, columns: string[], orders?: OrderBy[], lengths?: number[] }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string, + type: rest[2] as TablesDBIndexType, + columns: rest[3] as string[], + orders: rest[4] as OrderBy[], + lengths: rest[5] as number[] + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + const type = params.type; + const columns = params.columns; + const orders = params.orders; + const lengths = params.lengths; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + if (typeof columns === 'undefined') { + throw new AppwriteException('Missing required parameter: "columns"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof key !== 'undefined') { + payload['key'] = key; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof columns !== 'undefined') { + payload['columns'] = columns; + } + if (typeof orders !== 'undefined') { + payload['orders'] = orders; + } + if (typeof lengths !== 'undefined') { + payload['lengths'] = lengths; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get index by ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + */ + getIndex(params: { databaseId: string, tableId: string, key: string }): Promise<Models.ColumnIndex>; + /** + * Get index by ID. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<Models.ColumnIndex>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getIndex(databaseId: string, tableId: string, key: string): Promise<Models.ColumnIndex>; + getIndex( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ColumnIndex> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an index. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteIndex(params: { databaseId: string, tableId: string, key: string }): Promise<{}>; + /** + * Delete an index. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} key - Index Key. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteIndex(databaseId: string, tableId: string, key: string): Promise<{}>; + deleteIndex( + paramsOrFirst: { databaseId: string, tableId: string, key: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, tableId: string, key: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). + * @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. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }): Promise<Models.RowList<Row>>; + /** + * Get a list of all the user's rows in a given table. You can use the query params to filter your results. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table). + * @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. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, table, schema version (columns and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; row writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.RowList<Row>>; + listRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number } | string, + ...rest: [(string)?, (string[])?, (string)?, (boolean)?, (number)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string, + total: rest[3] as boolean, + ttl: rest[4] as number + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const transactionId = params.transactionId; + const total = params.total; + const ttl = params.ttl; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + if (typeof ttl !== 'undefined') { + payload['ttl'] = ttl; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {string} params.rowId - Row 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. + * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON object. + * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + */ + createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }): Promise<Row>; + /** + * Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {string} rowId - Row 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. + * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON object. + * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string): Promise<Row>; + createRow<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof data === 'undefined') { + throw new AppwriteException('Missing required parameter: "data"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rowId !== 'undefined') { + payload['rowId'] = rowId; + } + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {object[]} params.rows - Array of rows data as JSON objects. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + createRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Create new Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows. + * @param {object[]} rows - Array of rows data as JSON objects. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; + createRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rows: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rows = params.rows; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rows === 'undefined') { + throw new AppwriteException('Missing required parameter: "rows"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rows !== 'undefined') { + payload['rows'] = rows; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {object[]} params.rows - Array of row data as JSON objects. May contain partial rows. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + upsertRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Create or update Rows. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {object[]} rows - Array of row data as JSON objects. May contain partial rows. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rows: object[], transactionId?: string): Promise<Models.RowList<Row>>; + upsertRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rows: object[], transactionId?: string } | string, + ...rest: [(string)?, (object[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rows: rest[1] as object[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rows = params.rows; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rows === 'undefined') { + throw new AppwriteException('Missing required parameter: "rows"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof rows !== 'undefined') { + payload['rows'] = rows; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {object} params.data - Row data as JSON object. Include only column and value pairs to be updated. + * @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. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + updateRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Update all rows that match your queries, if no queries are submitted then all rows are updated. You can pass only specific fields to be updated. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {object} data - Row data as JSON object. Include only column and value pairs to be updated. + * @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. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; + updateRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (object)?, (string[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + data: rest[1] as object, + queries: rest[2] as string[], + transactionId: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const data = params.data; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @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. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + */ + deleteRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>; + /** + * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @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. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Models.RowList<Row>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>; + deleteRows<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string[])?, (string)?] + ): Promise<Models.RowList<Row>> { + let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + queries: rest[1] as string[], + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.rowId - Row ID. + * @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. + * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise<Row>} + */ + getRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }): Promise<Row>; + /** + * Get a row by its unique ID. This endpoint response returns a JSON object with the row data. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} rowId - Row ID. + * @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. + * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction. + * @throws {AppwriteException} + * @returns {Promise<Row>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string): Promise<Row>; + getRow<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + queries: rest[2] as string[], + transactionId: rest[3] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const queries = params.queries; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.rowId - Row ID. + * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} params.data - Row data as JSON object. Include all required columns of the row to be created or updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + */ + upsertRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }): Promise<Row>; + /** + * Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} rowId - Row ID. + * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} data - Row data as JSON object. Include all required columns of the row to be created or updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + upsertRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string): Promise<Row>; + upsertRow<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.rowId - Row ID. + * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} params.data - Row data as JSON object. Include only columns and value pairs to be updated. + * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + */ + updateRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }): Promise<Row>; + /** + * Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} rowId - Row ID. + * @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} data - Row data as JSON object. Include only columns and value pairs to be updated. + * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions). + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string): Promise<Row>; + updateRow<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string } | string, + ...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, + permissions: rest[3] as string[], + transactionId: rest[4] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const data = params.data; + const permissions = params.permissions; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + if (typeof data !== 'undefined') { + payload['data'] = data; + } + if (typeof permissions !== 'undefined') { + payload['permissions'] = permissions; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a row by its unique ID. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} params.rowId - Row ID. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteRow(params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }): Promise<{}>; + /** + * Delete a row by its unique ID. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). + * @param {string} rowId - Row ID. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteRow(databaseId: string, tableId: string, rowId: string, transactionId?: string): Promise<{}>; + deleteRow( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<{}> { + let params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + transactionId: rest[2] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId); + const payload: Payload = {}; + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Decrement a specific column of a row by a given value. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.rowId - Row ID. + * @param {string} params.column - Column key. + * @param {number} params.value - Value to increment the column by. The value must be a number. + * @param {number} params.min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + */ + decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }): Promise<Row>; + /** + * Decrement a specific column of a row by a given value. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} rowId - Row ID. + * @param {string} column - Column key. + * @param {number} value - Value to increment the column by. The value must be a number. + * @param {number} min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string): Promise<Row>; + decrementRowColumn<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + column: rest[2] as string, + value: rest[3] as number, + min: rest[4] as number, + transactionId: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const column = params.column; + const value = params.value; + const min = params.min; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof column === 'undefined') { + throw new AppwriteException('Missing required parameter: "column"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof min !== 'undefined') { + payload['min'] = min; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Increment a specific column of a row by a given value. + * + * @param {string} params.databaseId - Database ID. + * @param {string} params.tableId - Table ID. + * @param {string} params.rowId - Row ID. + * @param {string} params.column - Column key. + * @param {number} params.value - Value to increment the column by. The value must be a number. + * @param {number} params.max - Maximum value for the column. If the current value is greater than this value, an error will be thrown. + * @param {string} params.transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + */ + incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }): Promise<Row>; + /** + * Increment a specific column of a row by a given value. + * + * @param {string} databaseId - Database ID. + * @param {string} tableId - Table ID. + * @param {string} rowId - Row ID. + * @param {string} column - Column key. + * @param {number} value - Value to increment the column by. The value must be a number. + * @param {number} max - Maximum value for the column. If the current value is greater than this value, an error will be thrown. + * @param {string} transactionId - Transaction ID for staging the operation. + * @throws {AppwriteException} + * @returns {Promise<Row>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string): Promise<Row>; + incrementRowColumn<Row extends Models.Row = Models.DefaultRow>( + paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?] + ): Promise<Row> { + let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }; + } else { + params = { + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + rowId: rest[1] as string, + column: rest[2] as string, + value: rest[3] as number, + max: rest[4] as number, + transactionId: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const tableId = params.tableId; + const rowId = params.rowId; + const column = params.column; + const value = params.value; + const max = params.max; + const transactionId = params.transactionId; + + if (typeof databaseId === 'undefined') { + throw new AppwriteException('Missing required parameter: "databaseId"'); + } + if (typeof tableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tableId"'); + } + if (typeof rowId === 'undefined') { + throw new AppwriteException('Missing required parameter: "rowId"'); + } + if (typeof column === 'undefined') { + throw new AppwriteException('Missing required parameter: "column"'); + } + + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column); + const payload: Payload = {}; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof max !== 'undefined') { + payload['max'] = max; + } + if (typeof transactionId !== 'undefined') { + payload['transactionId'] = transactionId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/teams.ts b/src/services/teams.ts new file mode 100644 index 00000000..21e81152 --- /dev/null +++ b/src/services/teams.ts @@ -0,0 +1,893 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Teams { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + * + * @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: name, total, billingPlan + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TeamList<Preferences>>} + */ + list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.TeamList<Preferences>>; + /** + * Get a list of all the teams in which the current user is a member. You can use the parameters to filter your results. + * + * @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: name, total, billingPlan + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TeamList<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.TeamList<Preferences>>; + list<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.TeamList<Preferences>> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/teams'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + * + * @param {string} params.teamId - Team 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. + * @param {string} params.name - Team name. Max length: 128 chars. + * @param {string[]} params.roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Team<Preferences>>} + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, name: string, roles?: string[] }): Promise<Models.Team<Preferences>>; + /** + * Create a new team. The user who creates the team will automatically be assigned as the owner of the team. Only the users with the owner role can invite new members, add new owners and delete or update the team. + * + * @param {string} teamId - Team 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. + * @param {string} name - Team name. Max length: 128 chars. + * @param {string[]} roles - Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 32 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Team<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string, roles?: string[]): Promise<Models.Team<Preferences>>; + create<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { teamId: string, name: string, roles?: string[] } | string, + ...rest: [(string)?, (string[])?] + ): Promise<Models.Team<Preferences>> { + let params: { teamId: string, name: string, roles?: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, name: string, roles?: string[] }; + } else { + params = { + teamId: paramsOrFirst as string, + name: rest[0] as string, + roles: rest[1] as string[] + }; + } + + const teamId = params.teamId; + const name = params.name; + const roles = params.roles; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/teams'; + const payload: Payload = {}; + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a team by its ID. All team members have read access for this resource. + * + * @param {string} params.teamId - Team ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Team<Preferences>>} + */ + get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string }): Promise<Models.Team<Preferences>>; + /** + * Get a team by its ID. All team members have read access for this resource. + * + * @param {string} teamId - Team ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Team<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Models.Team<Preferences>>; + get<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { teamId: string } | string + ): Promise<Models.Team<Preferences>> { + let params: { teamId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string }; + } else { + params = { + teamId: paramsOrFirst as string + }; + } + + const teamId = params.teamId; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the team's name by its unique ID. + * + * @param {string} params.teamId - Team ID. + * @param {string} params.name - New team name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Team<Preferences>>} + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, name: string }): Promise<Models.Team<Preferences>>; + /** + * Update the team's name by its unique ID. + * + * @param {string} teamId - Team ID. + * @param {string} name - New team name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Team<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, name: string): Promise<Models.Team<Preferences>>; + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { teamId: string, name: string } | string, + ...rest: [(string)?] + ): Promise<Models.Team<Preferences>> { + let params: { teamId: string, name: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, name: string }; + } else { + params = { + teamId: paramsOrFirst as string, + name: rest[0] as string + }; + } + + const teamId = params.teamId; + const name = params.name; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a team using its ID. Only team members with the owner role can delete the team. + * + * @param {string} params.teamId - Team ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { teamId: string }): Promise<{}>; + /** + * Delete a team using its ID. Only team members with the owner role can delete the team. + * + * @param {string} teamId - Team ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(teamId: string): Promise<{}>; + delete( + paramsOrFirst: { teamId: string } | string + ): Promise<{}> { + let params: { teamId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string }; + } else { + params = { + teamId: paramsOrFirst as string + }; + } + + const teamId = params.teamId; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/teams/{teamId}'.replace('{teamId}', teamId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + * + * @param {string} params.teamId - Team ID. + * @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, teamId, invited, joined, confirm, roles + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MembershipList>} + */ + listMemberships(params: { teamId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.MembershipList>; + /** + * Use this endpoint to list a team's members using the team's ID. All team members have read access to this endpoint. Hide sensitive attributes from the response by toggling membership privacy in the Console. + * + * @param {string} teamId - Team ID. + * @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, teamId, invited, joined, confirm, roles + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MembershipList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMemberships(teamId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>; + listMemberships( + paramsOrFirst: { teamId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.MembershipList> { + let params: { teamId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + teamId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const teamId = params.teamId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. + * + * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. + * + * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + * + * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + * + * + * @param {string} params.teamId - Team ID. + * @param {string[]} params.roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @param {string} params.email - Email of the new team member. + * @param {string} params.userId - ID of the user to be added to a team. + * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. 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. + * @param {string} params.name - Name of the new team member. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + */ + createMembership(params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }): Promise<Models.Membership>; + /** + * Invite a new member to join your team. Provide an ID for existing users, or invite unregistered users using an email or phone number. If initiated from a Client SDK, Appwrite will send an email or sms with a link to join the team to the invited user, and an account will be created for them if one doesn't exist. If initiated from a Server SDK, the new member will be added automatically to the team. + * + * You only need to provide one of a user ID, email, or phone number. Appwrite will prioritize accepting the user ID > email > phone number if you provide more than one of these parameters. + * + * Use the `url` parameter to redirect the user from the invitation email to your app. After the user is redirected, use the [Update Team Membership Status](https://appwrite.io/docs/references/cloud/client-web/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + * + * Please note that to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) Appwrite will accept the only redirect URLs under the domains you have added as a platform on the Appwrite Console. + * + * + * @param {string} teamId - Team ID. + * @param {string[]} roles - Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @param {string} email - Email of the new team member. + * @param {string} userId - ID of the user to be added to a team. + * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} url - URL to redirect the user back to your app from the invitation email. This parameter is not required when an API key is supplied. 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. + * @param {string} name - Name of the new team member. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMembership(teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string): Promise<Models.Membership>; + createMembership( + paramsOrFirst: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string } | string, + ...rest: [(string[])?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Membership> { + let params: { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, roles: string[], email?: string, userId?: string, phone?: string, url?: string, name?: string }; + } else { + params = { + teamId: paramsOrFirst as string, + roles: rest[0] as string[], + email: rest[1] as string, + userId: rest[2] as string, + phone: rest[3] as string, + url: rest[4] as string, + name: rest[5] as string + }; + } + + const teamId = params.teamId; + const roles = params.roles; + const email = params.email; + const userId = params.userId; + const phone = params.phone; + const url = params.url; + const name = params.name; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof roles === 'undefined') { + throw new AppwriteException('Missing required parameter: "roles"'); + } + + const apiPath = '/teams/{teamId}/memberships'.replace('{teamId}', teamId); + const payload: Payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof phone !== 'undefined') { + payload['phone'] = phone; + } + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. + * + * @param {string} params.teamId - Team ID. + * @param {string} params.membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + */ + getMembership(params: { teamId: string, membershipId: string }): Promise<Models.Membership>; + /** + * Get a team member by the membership unique id. All team members have read access for this resource. Hide sensitive attributes from the response by toggling membership privacy in the Console. + * + * @param {string} teamId - Team ID. + * @param {string} membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMembership(teamId: string, membershipId: string): Promise<Models.Membership>; + getMembership( + paramsOrFirst: { teamId: string, membershipId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Membership> { + let params: { teamId: string, membershipId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, membershipId: string }; + } else { + params = { + teamId: paramsOrFirst as string, + membershipId: rest[0] as string + }; + } + + const teamId = params.teamId; + const membershipId = params.membershipId; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + * + * + * @param {string} params.teamId - Team ID. + * @param {string} params.membershipId - Membership ID. + * @param {string[]} params.roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + */ + updateMembership(params: { teamId: string, membershipId: string, roles: string[] }): Promise<Models.Membership>; + /** + * Modify the roles of a team member. Only team members with the owner role have access to this endpoint. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). + * + * + * @param {string} teamId - Team ID. + * @param {string} membershipId - Membership ID. + * @param {string[]} roles - An array of strings. Use this param to set the user's roles in the team. A role can be any string. Learn more about [roles and permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 81 characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMembership(teamId: string, membershipId: string, roles: string[]): Promise<Models.Membership>; + updateMembership( + paramsOrFirst: { teamId: string, membershipId: string, roles: string[] } | string, + ...rest: [(string)?, (string[])?] + ): Promise<Models.Membership> { + let params: { teamId: string, membershipId: string, roles: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, roles: string[] }; + } else { + params = { + teamId: paramsOrFirst as string, + membershipId: rest[0] as string, + roles: rest[1] as string[] + }; + } + + const teamId = params.teamId; + const membershipId = params.membershipId; + const roles = params.roles; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + if (typeof roles === 'undefined') { + throw new AppwriteException('Missing required parameter: "roles"'); + } + + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const payload: Payload = {}; + if (typeof roles !== 'undefined') { + payload['roles'] = roles; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. + * + * @param {string} params.teamId - Team ID. + * @param {string} params.membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMembership(params: { teamId: string, membershipId: string }): Promise<{}>; + /** + * This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. + * + * @param {string} teamId - Team ID. + * @param {string} membershipId - Membership ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMembership(teamId: string, membershipId: string): Promise<{}>; + deleteMembership( + paramsOrFirst: { teamId: string, membershipId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { teamId: string, membershipId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, membershipId: string }; + } else { + params = { + teamId: paramsOrFirst as string, + membershipId: rest[0] as string + }; + } + + const teamId = params.teamId; + const membershipId = params.membershipId; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + + const apiPath = '/teams/{teamId}/memberships/{membershipId}'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. + * + * If the request is successful, a session for the user is automatically created. + * + * + * @param {string} params.teamId - Team ID. + * @param {string} params.membershipId - Membership ID. + * @param {string} params.userId - User ID. + * @param {string} params.secret - Secret key. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + */ + updateMembershipStatus(params: { teamId: string, membershipId: string, userId: string, secret: string }): Promise<Models.Membership>; + /** + * Use this endpoint to allow a user to accept an invitation to join a team after being redirected back to your app from the invitation email received by the user. + * + * If the request is successful, a session for the user is automatically created. + * + * + * @param {string} teamId - Team ID. + * @param {string} membershipId - Membership ID. + * @param {string} userId - User ID. + * @param {string} secret - Secret key. + * @throws {AppwriteException} + * @returns {Promise<Models.Membership>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMembershipStatus(teamId: string, membershipId: string, userId: string, secret: string): Promise<Models.Membership>; + updateMembershipStatus( + paramsOrFirst: { teamId: string, membershipId: string, userId: string, secret: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.Membership> { + let params: { teamId: string, membershipId: string, userId: string, secret: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, membershipId: string, userId: string, secret: string }; + } else { + params = { + teamId: paramsOrFirst as string, + membershipId: rest[0] as string, + userId: rest[1] as string, + secret: rest[2] as string + }; + } + + const teamId = params.teamId; + const membershipId = params.membershipId; + const userId = params.userId; + const secret = params.secret; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof membershipId === 'undefined') { + throw new AppwriteException('Missing required parameter: "membershipId"'); + } + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof secret === 'undefined') { + throw new AppwriteException('Missing required parameter: "secret"'); + } + + const apiPath = '/teams/{teamId}/memberships/{membershipId}/status'.replace('{teamId}', teamId).replace('{membershipId}', membershipId); + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + * + * @param {string} params.teamId - Team ID. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + */ + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string }): Promise<Preferences>; + /** + * Get the team's shared preferences by its unique ID. If a preference doesn't need to be shared by all team members, prefer storing them in [user preferences](https://appwrite.io/docs/references/cloud/client-web/account#getPrefs). + * + * @param {string} teamId - Team ID. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string): Promise<Preferences>; + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { teamId: string } | string + ): Promise<Preferences> { + let params: { teamId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string }; + } else { + params = { + teamId: paramsOrFirst as string + }; + } + + const teamId = params.teamId; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + * + * @param {string} params.teamId - Team ID. + * @param {object} params.prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { teamId: string, prefs: object }): Promise<Preferences>; + /** + * Update the team's preferences by its unique ID. The object you pass is stored as is and replaces any previous value. The maximum allowed prefs size is 64kB and throws an error if exceeded. + * + * @param {string} teamId - Team ID. + * @param {object} prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(teamId: string, prefs: object): Promise<Preferences>; + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { teamId: string, prefs: object } | string, + ...rest: [(object)?] + ): Promise<Preferences> { + let params: { teamId: string, prefs: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { teamId: string, prefs: object }; + } else { + params = { + teamId: paramsOrFirst as string, + prefs: rest[0] as object + }; + } + + const teamId = params.teamId; + const prefs = params.prefs; + + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + if (typeof prefs === 'undefined') { + throw new AppwriteException('Missing required parameter: "prefs"'); + } + + const apiPath = '/teams/{teamId}/prefs'.replace('{teamId}', teamId); + const payload: Payload = {}; + if (typeof prefs !== 'undefined') { + payload['prefs'] = prefs; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/tokens.ts b/src/services/tokens.ts new file mode 100644 index 00000000..1e453a72 --- /dev/null +++ b/src/services/tokens.ts @@ -0,0 +1,315 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Tokens { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File unique ID. + * @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: expire + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceTokenList>} + */ + list(params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }): Promise<Models.ResourceTokenList>; + /** + * List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File unique ID. + * @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: expire + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceTokenList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(bucketId: string, fileId: string, queries?: string[], total?: boolean): Promise<Models.ResourceTokenList>; + list( + paramsOrFirst: { bucketId: string, fileId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string)?, (string[])?, (boolean)?] + ): Promise<Models.ResourceTokenList> { + let params: { bucketId: string, fileId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, queries?: string[], total?: boolean }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + queries: rest[1] as string[], + total: rest[2] as boolean + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const queries = params.queries; + const total = params.total; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. + * + * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} params.fileId - File unique ID. + * @param {string} params.expire - Token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + */ + createFileToken(params: { bucketId: string, fileId: string, expire?: string }): Promise<Models.ResourceToken>; + /** + * Create a new token. A token is linked to a file. Token can be passed as a request URL search parameter. + * + * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket). + * @param {string} fileId - File unique ID. + * @param {string} expire - Token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createFileToken(bucketId: string, fileId: string, expire?: string): Promise<Models.ResourceToken>; + createFileToken( + paramsOrFirst: { bucketId: string, fileId: string, expire?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.ResourceToken> { + let params: { bucketId: string, fileId: string, expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, expire?: string }; + } else { + params = { + bucketId: paramsOrFirst as string, + fileId: rest[0] as string, + expire: rest[1] as string + }; + } + + const bucketId = params.bucketId; + const fileId = params.fileId; + const expire = params.expire; + + if (typeof bucketId === 'undefined') { + throw new AppwriteException('Missing required parameter: "bucketId"'); + } + if (typeof fileId === 'undefined') { + throw new AppwriteException('Missing required parameter: "fileId"'); + } + + const apiPath = '/tokens/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId); + const payload: Payload = {}; + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a token by its unique ID. + * + * @param {string} params.tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + */ + get(params: { tokenId: string }): Promise<Models.ResourceToken>; + /** + * Get a token by its unique ID. + * + * @param {string} tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(tokenId: string): Promise<Models.ResourceToken>; + get( + paramsOrFirst: { tokenId: string } | string + ): Promise<Models.ResourceToken> { + let params: { tokenId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { tokenId: string }; + } else { + params = { + tokenId: paramsOrFirst as string + }; + } + + const tokenId = params.tokenId; + + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a token by its unique ID. Use this endpoint to update a token's expiry date. + * + * @param {string} params.tokenId - Token unique ID. + * @param {string} params.expire - File token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + */ + update(params: { tokenId: string, expire?: string }): Promise<Models.ResourceToken>; + /** + * Update a token by its unique ID. Use this endpoint to update a token's expiry date. + * + * @param {string} tokenId - Token unique ID. + * @param {string} expire - File token expiry date + * @throws {AppwriteException} + * @returns {Promise<Models.ResourceToken>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(tokenId: string, expire?: string): Promise<Models.ResourceToken>; + update( + paramsOrFirst: { tokenId: string, expire?: string } | string, + ...rest: [(string)?] + ): Promise<Models.ResourceToken> { + let params: { tokenId: string, expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { tokenId: string, expire?: string }; + } else { + params = { + tokenId: paramsOrFirst as string, + expire: rest[0] as string + }; + } + + const tokenId = params.tokenId; + const expire = params.expire; + + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const payload: Payload = {}; + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a token by its unique ID. + * + * @param {string} params.tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { tokenId: string }): Promise<{}>; + /** + * Delete a token by its unique ID. + * + * @param {string} tokenId - Token ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(tokenId: string): Promise<{}>; + delete( + paramsOrFirst: { tokenId: string } | string + ): Promise<{}> { + let params: { tokenId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { tokenId: string }; + } else { + params = { + tokenId: paramsOrFirst as string + }; + } + + const tokenId = params.tokenId; + + if (typeof tokenId === 'undefined') { + throw new AppwriteException('Missing required parameter: "tokenId"'); + } + + const apiPath = '/tokens/{tokenId}'.replace('{tokenId}', tokenId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/usage.ts b/src/services/usage.ts new file mode 100644 index 00000000..84c654ab --- /dev/null +++ b/src/services/usage.ts @@ -0,0 +1,130 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Usage { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UsageEventList>} + */ + listEvents(params?: { queries?: string[], total?: boolean }): Promise<Models.UsageEventList>; + /** + * Query usage event metrics from the usage database. Returns individual event rows with full metadata. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, path, method, status, resource, resourceId, country, userAgent, time (these match the underlying column names — note that the response surfaces `resource` as `resourceType` and `country` as `countryCode`). When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), equal("path", [...]), equal("method", [...]), equal("status", [...]), equal("resource", [...]), equal("resourceId", [...]), equal("country", [...]), equal("userAgent", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UsageEventList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listEvents(queries?: string[], total?: boolean): Promise<Models.UsageEventList>; + listEvents( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.UsageEventList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/usage/events'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UsageGaugeList>} + */ + listGauges(params?: { queries?: string[], total?: boolean }): Promise<Models.UsageGaugeList>; + /** + * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * + * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UsageGaugeList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listGauges(queries?: string[], total?: boolean): Promise<Models.UsageGaugeList>; + listGauges( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.UsageGaugeList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/usage/gauges'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/users.ts b/src/services/users.ts new file mode 100644 index 00000000..19faa4d1 --- /dev/null +++ b/src/services/users.ts @@ -0,0 +1,3270 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { PasswordHash } from '../enums/password-hash'; +import { AuthenticatorType } from '../enums/authenticator-type'; +import { MessagingProviderType } from '../enums/messaging-provider-type'; + +export class Users { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all the project's users. You can use the query params to filter your results. + * + * @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: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UserList<Preferences>>} + */ + list<Preferences extends Models.Preferences = Models.DefaultPreferences>(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.UserList<Preferences>>; + /** + * Get a list of all the project's users. You can use the query params to filter your results. + * + * @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: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification, labels, impersonator + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.UserList<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list<Preferences extends Models.Preferences = Models.DefaultPreferences>(queries?: string[], search?: string, total?: boolean): Promise<Models.UserList<Preferences>>; + list<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.UserList<Preferences>> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/users'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} params.password - Plain text user password. Must be at least 8 chars. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email?: string, phone?: string, password?: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. + * + * @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. + * @param {string} email - User email. + * @param {string} phone - Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212. + * @param {string} password - Plain text user password. Must be at least 8 chars. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email?: string, phone?: string, password?: string, name?: string): Promise<Models.User<Preferences>>; + create<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email?: string, phone?: string, password?: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email?: string, phone?: string, password?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email?: string, phone?: string, password?: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + phone: rest[1] as string, + password: rest[2] as string, + name: rest[3] as string + }; + } + + const userId = params.userId; + const email = params.email; + const phone = params.phone; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof phone !== 'undefined') { + payload['phone'] = phone; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.password - User password hashed using Argon2. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} email - User email. + * @param {string} password - User password hashed using Argon2. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createArgon2User<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/argon2'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.password - User password hashed using Bcrypt. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} email - User email. + * @param {string} password - User password hashed using Bcrypt. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createBcryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/bcrypt'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get identities for all users. + * + * @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 + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IdentityList>} + */ + listIdentities(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.IdentityList>; + /** + * Get identities for all users. + * + * @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 + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.IdentityList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listIdentities(queries?: string[], search?: string, total?: boolean): Promise<Models.IdentityList>; + listIdentities( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.IdentityList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/users/identities'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an identity by its unique ID. + * + * @param {string} params.identityId - Identity ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteIdentity(params: { identityId: string }): Promise<{}>; + /** + * Delete an identity by its unique ID. + * + * @param {string} identityId - Identity ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteIdentity(identityId: string): Promise<{}>; + deleteIdentity( + paramsOrFirst: { identityId: string } | string + ): Promise<{}> { + let params: { identityId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { identityId: string }; + } else { + params = { + identityId: paramsOrFirst as string + }; + } + + const identityId = params.identityId; + + if (typeof identityId === 'undefined') { + throw new AppwriteException('Missing required parameter: "identityId"'); + } + + const apiPath = '/users/identities/{identityId}'.replace('{identityId}', identityId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.password - User password hashed using MD5. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} email - User email. + * @param {string} password - User password hashed using MD5. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createMD5User<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/md5'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} params.userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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. + * @param {string} params.email - User email. + * @param {string} params.password - User password hashed using PHPass. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @param {string} userId - User ID. Choose a custom ID or pass the string `ID.unique()`to auto generate it. 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. + * @param {string} email - User email. + * @param {string} password - User password hashed using PHPass. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, name?: string): Promise<Models.User<Preferences>>; + createPHPassUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + name: rest[2] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/phpass'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.password - User password hashed using Scrypt. + * @param {string} params.passwordSalt - Optional salt used to hash password. + * @param {number} params.passwordCpu - Optional CPU cost used to hash password. + * @param {number} params.passwordMemory - Optional memory cost used to hash password. + * @param {number} params.passwordParallel - Optional parallelization cost used to hash password. + * @param {number} params.passwordLength - Optional hash length used to hash password. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} email - User email. + * @param {string} password - User password hashed using Scrypt. + * @param {string} passwordSalt - Optional salt used to hash password. + * @param {number} passwordCpu - Optional CPU cost used to hash password. + * @param {number} passwordMemory - Optional memory cost used to hash password. + * @param {number} passwordParallel - Optional parallelization cost used to hash password. + * @param {number} passwordLength - Optional hash length used to hash password. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string): Promise<Models.User<Preferences>>; + createScryptUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (number)?, (number)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordCpu: number, passwordMemory: number, passwordParallel: number, passwordLength: number, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + passwordSalt: rest[2] as string, + passwordCpu: rest[3] as number, + passwordMemory: rest[4] as number, + passwordParallel: rest[5] as number, + passwordLength: rest[6] as number, + name: rest[7] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const passwordSalt = params.passwordSalt; + const passwordCpu = params.passwordCpu; + const passwordMemory = params.passwordMemory; + const passwordParallel = params.passwordParallel; + const passwordLength = params.passwordLength; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + if (typeof passwordSalt === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSalt"'); + } + if (typeof passwordCpu === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordCpu"'); + } + if (typeof passwordMemory === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordMemory"'); + } + if (typeof passwordParallel === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordParallel"'); + } + if (typeof passwordLength === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordLength"'); + } + + const apiPath = '/users/scrypt'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof passwordSalt !== 'undefined') { + payload['passwordSalt'] = passwordSalt; + } + if (typeof passwordCpu !== 'undefined') { + payload['passwordCpu'] = passwordCpu; + } + if (typeof passwordMemory !== 'undefined') { + payload['passwordMemory'] = passwordMemory; + } + if (typeof passwordParallel !== 'undefined') { + payload['passwordParallel'] = passwordParallel; + } + if (typeof passwordLength !== 'undefined') { + payload['passwordLength'] = passwordLength; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.password - User password hashed using Scrypt Modified. + * @param {string} params.passwordSalt - Salt used to hash password. + * @param {string} params.passwordSaltSeparator - Salt separator used to hash password. + * @param {string} params.passwordSignerKey - Signer key used to hash password. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} email - User email. + * @param {string} password - User password hashed using Scrypt Modified. + * @param {string} passwordSalt - Salt used to hash password. + * @param {string} passwordSaltSeparator - Salt separator used to hash password. + * @param {string} passwordSignerKey - Signer key used to hash password. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string): Promise<Models.User<Preferences>>; + createScryptModifiedUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordSalt: string, passwordSaltSeparator: string, passwordSignerKey: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + passwordSalt: rest[2] as string, + passwordSaltSeparator: rest[3] as string, + passwordSignerKey: rest[4] as string, + name: rest[5] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const passwordSalt = params.passwordSalt; + const passwordSaltSeparator = params.passwordSaltSeparator; + const passwordSignerKey = params.passwordSignerKey; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + if (typeof passwordSalt === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSalt"'); + } + if (typeof passwordSaltSeparator === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSaltSeparator"'); + } + if (typeof passwordSignerKey === 'undefined') { + throw new AppwriteException('Missing required parameter: "passwordSignerKey"'); + } + + const apiPath = '/users/scrypt-modified'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof passwordSalt !== 'undefined') { + payload['passwordSalt'] = passwordSalt; + } + if (typeof passwordSaltSeparator !== 'undefined') { + payload['passwordSaltSeparator'] = passwordSaltSeparator; + } + if (typeof passwordSignerKey !== 'undefined') { + payload['passwordSignerKey'] = passwordSignerKey; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} params.email - User email. + * @param {string} params.password - User password hashed using SHA. + * @param {PasswordHash} params.passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }): Promise<Models.User<Preferences>>; + /** + * Create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password. + * + * @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. + * @param {string} email - User email. + * @param {string} password - User password hashed using SHA. + * @param {PasswordHash} passwordVersion - Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512' + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string): Promise<Models.User<Preferences>>; + createSHAUser<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string } | string, + ...rest: [(string)?, (string)?, (PasswordHash)?, (string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string, password: string, passwordVersion?: PasswordHash, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string, + password: rest[1] as string, + passwordVersion: rest[2] as PasswordHash, + name: rest[3] as string + }; + } + + const userId = params.userId; + const email = params.email; + const password = params.password; + const passwordVersion = params.passwordVersion; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/sha'; + const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } + if (typeof email !== 'undefined') { + payload['email'] = email; + } + if (typeof password !== 'undefined') { + payload['password'] = password; + } + if (typeof passwordVersion !== 'undefined') { + payload['passwordVersion'] = passwordVersion; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a user by its unique ID. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + get<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Models.User<Preferences>>; + /** + * Get a user by its unique ID. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Models.User<Preferences>>; + get<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string } | string + ): Promise<Models.User<Preferences>> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { userId: string }): Promise<{}>; + /** + * Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the [updateStatus](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(userId: string): Promise<{}>; + delete( + paramsOrFirst: { userId: string } | string + ): Promise<{}> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user email by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.email - User email. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, email: string }): Promise<Models.User<Preferences>>; + /** + * Update the user email by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} email - User email. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, email: string): Promise<Models.User<Preferences>>; + updateEmail<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, email: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, email: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, email: string }; + } else { + params = { + userId: paramsOrFirst as string, + email: rest[0] as string + }; + } + + const userId = params.userId; + const email = params.email; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof email === 'undefined') { + throw new AppwriteException('Missing required parameter: "email"'); + } + + const apiPath = '/users/{userId}/email'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof email !== 'undefined') { + payload['email'] = email; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. + * + * + * @param {string} params.userId - User ID. + * @param {boolean} params.impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, impersonator: boolean }): Promise<Models.User<Preferences>>; + /** + * Enable or disable whether a user can impersonate other users. When impersonation headers are used, the request runs as the target user for API behavior, while internal audit logs still attribute the action to the original impersonator and store the impersonated target details only in internal audit payload data. + * + * + * @param {string} userId - User ID. + * @param {boolean} impersonator - Whether the user can impersonate other users. When true, the user can browse project users to choose a target and can pass impersonation headers to act as that user. Internal audit logs still attribute impersonated actions to the original impersonator and store the target user details only in internal audit payload data. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, impersonator: boolean): Promise<Models.User<Preferences>>; + updateImpersonator<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, impersonator: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, impersonator: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, impersonator: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + impersonator: rest[0] as boolean + }; + } + + const userId = params.userId; + const impersonator = params.impersonator; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof impersonator === 'undefined') { + throw new AppwriteException('Missing required parameter: "impersonator"'); + } + + const apiPath = '/users/{userId}/impersonator'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof impersonator !== 'undefined') { + payload['impersonator'] = impersonator; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + * + * @param {string} params.userId - User ID. + * @param {string} params.sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. + * @param {number} params.duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Jwt>} + */ + createJWT(params: { userId: string, sessionId?: string, duration?: number }): Promise<Models.Jwt>; + /** + * Use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted. + * + * @param {string} userId - User ID. + * @param {string} sessionId - Session ID. Use the string 'recent' to use the most recent session. Defaults to the most recent session. + * @param {number} duration - Time in seconds before JWT expires. Default duration is 900 seconds, and maximum is 3600 seconds. + * @throws {AppwriteException} + * @returns {Promise<Models.Jwt>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createJWT(userId: string, sessionId?: string, duration?: number): Promise<Models.Jwt>; + createJWT( + paramsOrFirst: { userId: string, sessionId?: string, duration?: number } | string, + ...rest: [(string)?, (number)?] + ): Promise<Models.Jwt> { + let params: { userId: string, sessionId?: string, duration?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, sessionId?: string, duration?: number }; + } else { + params = { + userId: paramsOrFirst as string, + sessionId: rest[0] as string, + duration: rest[1] as number + }; + } + + const userId = params.userId; + const sessionId = params.sessionId; + const duration = params.duration; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/jwts'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof sessionId !== 'undefined') { + payload['sessionId'] = sessionId; + } + if (typeof duration !== 'undefined') { + payload['duration'] = duration; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * + * @param {string} params.userId - User ID. + * @param {string[]} params.labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, labels: string[] }): Promise<Models.User<Preferences>>; + /** + * Update the user labels by its unique ID. + * + * Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info. + * + * @param {string} userId - User ID. + * @param {string[]} labels - Array of user labels. Replaces the previous labels. Maximum of 1000 labels are allowed, each up to 36 alphanumeric characters long. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, labels: string[]): Promise<Models.User<Preferences>>; + updateLabels<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, labels: string[] } | string, + ...rest: [(string[])?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, labels: string[] }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, labels: string[] }; + } else { + params = { + userId: paramsOrFirst as string, + labels: rest[0] as string[] + }; + } + + const userId = params.userId; + const labels = params.labels; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof labels === 'undefined') { + throw new AppwriteException('Missing required parameter: "labels"'); + } + + const apiPath = '/users/{userId}/labels'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof labels !== 'undefined') { + payload['labels'] = labels; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the user activity logs list by its unique ID. + * + * @param {string} params.userId - User ID. + * @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 + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + */ + listLogs(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.LogList>; + /** + * Get the user activity logs list by its unique ID. + * + * @param {string} userId - User ID. + * @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 + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.LogList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listLogs(userId: string, queries?: string[], total?: boolean): Promise<Models.LogList>; + listLogs( + paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.LogList> { + let params: { userId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const userId = params.userId; + const queries = params.queries; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/logs'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the user membership list by its unique ID. + * + * @param {string} params.userId - User ID. + * @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, teamId, invited, joined, confirm, roles + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MembershipList>} + */ + listMemberships(params: { userId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.MembershipList>; + /** + * Get the user membership list by its unique ID. + * + * @param {string} userId - User ID. + * @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, teamId, invited, joined, confirm, roles + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.MembershipList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMemberships(userId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.MembershipList>; + listMemberships( + paramsOrFirst: { userId: string, queries?: string[], search?: string, total?: boolean } | string, + ...rest: [(string[])?, (string)?, (boolean)?] + ): Promise<Models.MembershipList> { + let params: { userId: string, queries?: string[], search?: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], search?: string, total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean + }; + } + + const userId = params.userId; + const queries = params.queries; + const search = params.search; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/memberships'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Enable or disable MFA on a user account. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead. + */ + updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; + /** + * Enable or disable MFA on a user account. + * + * @param {string} userId - User ID. + * @param {boolean} mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; + updateMfa<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, mfa: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, mfa: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + mfa: rest[0] as boolean + }; + } + + const userId = params.userId; + const mfa = params.mfa; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof mfa === 'undefined') { + throw new AppwriteException('Missing required parameter: "mfa"'); + } + + const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof mfa !== 'undefined') { + payload['mfa'] = mfa; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Enable or disable MFA on a user account. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, mfa: boolean }): Promise<Models.User<Preferences>>; + /** + * Enable or disable MFA on a user account. + * + * @param {string} userId - User ID. + * @param {boolean} mfa - Enable or disable MFA. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, mfa: boolean): Promise<Models.User<Preferences>>; + updateMFA<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, mfa: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, mfa: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, mfa: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + mfa: rest[0] as boolean + }; + } + + const userId = params.userId; + const mfa = params.mfa; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof mfa === 'undefined') { + throw new AppwriteException('Missing required parameter: "mfa"'); + } + + const apiPath = '/users/{userId}/mfa'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof mfa !== 'undefined') { + payload['mfa'] = mfa; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an authenticator app. + * + * @param {string} params.userId - User ID. + * @param {AuthenticatorType} params.type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead. + */ + deleteMfaAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + /** + * Delete an authenticator app. + * + * @param {string} userId - User ID. + * @param {AuthenticatorType} type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMfaAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; + deleteMfaAuthenticator( + paramsOrFirst: { userId: string, type: AuthenticatorType } | string, + ...rest: [(AuthenticatorType)?] + ): Promise<{}> { + let params: { userId: string, type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; + } else { + params = { + userId: paramsOrFirst as string, + type: rest[0] as AuthenticatorType + }; + } + + const userId = params.userId; + const type = params.type; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete an authenticator app. + * + * @param {string} params.userId - User ID. + * @param {AuthenticatorType} params.type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteMFAAuthenticator(params: { userId: string, type: AuthenticatorType }): Promise<{}>; + /** + * Delete an authenticator app. + * + * @param {string} userId - User ID. + * @param {AuthenticatorType} type - Type of authenticator. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteMFAAuthenticator(userId: string, type: AuthenticatorType): Promise<{}>; + deleteMFAAuthenticator( + paramsOrFirst: { userId: string, type: AuthenticatorType } | string, + ...rest: [(AuthenticatorType)?] + ): Promise<{}> { + let params: { userId: string, type: AuthenticatorType }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, type: AuthenticatorType }; + } else { + params = { + userId: paramsOrFirst as string, + type: rest[0] as AuthenticatorType + }; + } + + const userId = params.userId; + const type = params.type; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof type === 'undefined') { + throw new AppwriteException('Missing required parameter: "type"'); + } + + const apiPath = '/users/{userId}/mfa/authenticators/{type}'.replace('{userId}', userId).replace('{type}', type); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead. + */ + listMfaFactors(params: { userId: string }): Promise<Models.MfaFactors>; + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMfaFactors(userId: string): Promise<Models.MfaFactors>; + listMfaFactors( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaFactors> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + */ + listMFAFactors(params: { userId: string }): Promise<Models.MfaFactors>; + /** + * List the factors available on the account to be used as a MFA challange. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaFactors>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listMFAFactors(userId: string): Promise<Models.MfaFactors>; + listMFAFactors( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaFactors> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/factors'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead. + */ + getMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + getMfaRecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + getMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + getMFARecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead. + */ + updateMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + updateMfaRecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + updateMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + updateMFARecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead. + */ + createMfaRecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMfaRecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + createMfaRecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + */ + createMFARecoveryCodes(params: { userId: string }): Promise<Models.MfaRecoveryCodes>; + /** + * Generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Models.MfaRecoveryCodes>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createMFARecoveryCodes(userId: string): Promise<Models.MfaRecoveryCodes>; + createMFARecoveryCodes( + paramsOrFirst: { userId: string } | string + ): Promise<Models.MfaRecoveryCodes> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/mfa/recovery-codes'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user name by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, name: string }): Promise<Models.User<Preferences>>; + /** + * Update the user name by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} name - User name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, name: string): Promise<Models.User<Preferences>>; + updateName<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, name: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, name: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, name: string }; + } else { + params = { + userId: paramsOrFirst as string, + name: rest[0] as string + }; + } + + const userId = params.userId; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/users/{userId}/name'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user password by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.password - New user password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, password: string }): Promise<Models.User<Preferences>>; + /** + * Update the user password by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} password - New user password. Must be at least 8 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, password: string): Promise<Models.User<Preferences>>; + updatePassword<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, password: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, password: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, password: string }; + } else { + params = { + userId: paramsOrFirst as string, + password: rest[0] as string + }; + } + + const userId = params.userId; + const password = params.password; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof password === 'undefined') { + throw new AppwriteException('Missing required parameter: "password"'); + } + + const apiPath = '/users/{userId}/password'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof password !== 'undefined') { + payload['password'] = password; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user phone by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.number - User phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, number: string }): Promise<Models.User<Preferences>>; + /** + * Update the user phone by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} number - User phone number. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, number: string): Promise<Models.User<Preferences>>; + updatePhone<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, number: string } | string, + ...rest: [(string)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, number: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, number: string }; + } else { + params = { + userId: paramsOrFirst as string, + number: rest[0] as string + }; + } + + const userId = params.userId; + const number = params.number; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof number === 'undefined') { + throw new AppwriteException('Missing required parameter: "number"'); + } + + const apiPath = '/users/{userId}/phone'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof number !== 'undefined') { + payload['number'] = number; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the user preferences by its unique ID. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + */ + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string }): Promise<Preferences>; + /** + * Get the user preferences by its unique ID. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string): Promise<Preferences>; + getPrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string } | string + ): Promise<Preferences> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + * + * @param {string} params.userId - User ID. + * @param {object} params.prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, prefs: object }): Promise<Preferences>; + /** + * Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded. + * + * @param {string} userId - User ID. + * @param {object} prefs - Prefs key-value JSON object. + * @throws {AppwriteException} + * @returns {Promise<Preferences>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, prefs: object): Promise<Preferences>; + updatePrefs<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, prefs: object } | string, + ...rest: [(object)?] + ): Promise<Preferences> { + let params: { userId: string, prefs: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, prefs: object }; + } else { + params = { + userId: paramsOrFirst as string, + prefs: rest[0] as object + }; + } + + const userId = params.userId; + const prefs = params.prefs; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof prefs === 'undefined') { + throw new AppwriteException('Missing required parameter: "prefs"'); + } + + const apiPath = '/users/{userId}/prefs'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof prefs !== 'undefined') { + payload['prefs'] = prefs; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get the user sessions list by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SessionList>} + */ + listSessions(params: { userId: string, total?: boolean }): Promise<Models.SessionList>; + /** + * Get the user sessions list by its unique ID. + * + * @param {string} userId - User ID. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.SessionList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSessions(userId: string, total?: boolean): Promise<Models.SessionList>; + listSessions( + paramsOrFirst: { userId: string, total?: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.SessionList> { + let params: { userId: string, total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + total: rest[0] as boolean + }; + } + + const userId = params.userId; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Creates a session for a user. Returns an immediately usable session object. + * + * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + */ + createSession(params: { userId: string }): Promise<Models.Session>; + /** + * Creates a session for a user. Returns an immediately usable session object. + * + * If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint. + * + * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Session>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSession(userId: string): Promise<Models.Session>; + createSession( + paramsOrFirst: { userId: string } | string + ): Promise<Models.Session> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete all user's sessions by using the user's unique ID. + * + * @param {string} params.userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSessions(params: { userId: string }): Promise<{}>; + /** + * Delete all user's sessions by using the user's unique ID. + * + * @param {string} userId - User ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSessions(userId: string): Promise<{}>; + deleteSessions( + paramsOrFirst: { userId: string } | string + ): Promise<{}> { + let params: { userId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string }; + } else { + params = { + userId: paramsOrFirst as string + }; + } + + const userId = params.userId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/sessions'.replace('{userId}', userId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a user sessions by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.sessionId - Session ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSession(params: { userId: string, sessionId: string }): Promise<{}>; + /** + * Delete a user sessions by its unique ID. + * + * @param {string} userId - User ID. + * @param {string} sessionId - Session ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSession(userId: string, sessionId: string): Promise<{}>; + deleteSession( + paramsOrFirst: { userId: string, sessionId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { userId: string, sessionId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, sessionId: string }; + } else { + params = { + userId: paramsOrFirst as string, + sessionId: rest[0] as string + }; + } + + const userId = params.userId; + const sessionId = params.sessionId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof sessionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "sessionId"'); + } + + const apiPath = '/users/{userId}/sessions/{sessionId}'.replace('{userId}', userId).replace('{sessionId}', sessionId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.status - User Status. To activate the user pass `true` and to block the user pass `false`. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, status: boolean }): Promise<Models.User<Preferences>>; + /** + * Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved. + * + * @param {string} userId - User ID. + * @param {boolean} status - User Status. To activate the user pass `true` and to block the user pass `false`. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, status: boolean): Promise<Models.User<Preferences>>; + updateStatus<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, status: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, status: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, status: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + status: rest[0] as boolean + }; + } + + const userId = params.userId; + const status = params.status; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/users/{userId}/status'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof status !== 'undefined') { + payload['status'] = status; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * List the messaging targets that are associated with a user. + * + * @param {string} params.userId - User ID. + * @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, providerId, identifier, providerType + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + */ + listTargets(params: { userId: string, queries?: string[], total?: boolean }): Promise<Models.TargetList>; + /** + * List the messaging targets that are associated with a user. + * + * @param {string} userId - User ID. + * @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, providerId, identifier, providerType + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.TargetList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listTargets(userId: string, queries?: string[], total?: boolean): Promise<Models.TargetList>; + listTargets( + paramsOrFirst: { userId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.TargetList> { + let params: { userId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, queries?: string[], total?: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const userId = params.userId; + const queries = params.queries; + const total = params.total; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a messaging target. + * + * @param {string} params.userId - User ID. + * @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. + * @param {MessagingProviderType} params.providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. + * @param {string} params.identifier - The target identifier (token, email, phone etc.) + * @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. + * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + createTarget(params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }): Promise<Models.Target>; + /** + * Create a messaging target. + * + * @param {string} userId - User ID. + * @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. + * @param {MessagingProviderType} providerType - The target provider type. Can be one of the following: `email`, `sms` or `push`. + * @param {string} identifier - The target identifier (token, email, phone etc.) + * @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. + * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createTarget(userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string): Promise<Models.Target>; + createTarget( + paramsOrFirst: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string } | string, + ...rest: [(string)?, (MessagingProviderType)?, (string)?, (string)?, (string)?] + ): Promise<Models.Target> { + let params: { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string, providerType: MessagingProviderType, identifier: string, providerId?: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string, + providerType: rest[1] as MessagingProviderType, + identifier: rest[2] as string, + providerId: rest[3] as string, + name: rest[4] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + const providerType = params.providerType; + const identifier = params.identifier; + const providerId = params.providerId; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + if (typeof providerType === 'undefined') { + throw new AppwriteException('Missing required parameter: "providerType"'); + } + if (typeof identifier === 'undefined') { + throw new AppwriteException('Missing required parameter: "identifier"'); + } + + const apiPath = '/users/{userId}/targets'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof targetId !== 'undefined') { + payload['targetId'] = targetId; + } + if (typeof providerType !== 'undefined') { + payload['providerType'] = providerType; + } + if (typeof identifier !== 'undefined') { + payload['identifier'] = identifier; + } + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a user's push notification target by ID. + * + * @param {string} params.userId - User ID. + * @param {string} params.targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + getTarget(params: { userId: string, targetId: string }): Promise<Models.Target>; + /** + * Get a user's push notification target by ID. + * + * @param {string} userId - User ID. + * @param {string} targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getTarget(userId: string, targetId: string): Promise<Models.Target>; + getTarget( + paramsOrFirst: { userId: string, targetId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Target> { + let params: { userId: string, targetId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a messaging target. + * + * @param {string} params.userId - User ID. + * @param {string} params.targetId - Target ID. + * @param {string} params.identifier - The target identifier (token, email, phone etc.) + * @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. + * @param {string} params.name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + */ + updateTarget(params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }): Promise<Models.Target>; + /** + * Update a messaging target. + * + * @param {string} userId - User ID. + * @param {string} targetId - Target ID. + * @param {string} identifier - The target identifier (token, email, phone etc.) + * @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. + * @param {string} name - Target name. Max length: 128 chars. For example: My Awesome App Galaxy S23. + * @throws {AppwriteException} + * @returns {Promise<Models.Target>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTarget(userId: string, targetId: string, identifier?: string, providerId?: string, name?: string): Promise<Models.Target>; + updateTarget( + paramsOrFirst: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?] + ): Promise<Models.Target> { + let params: { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string, identifier?: string, providerId?: string, name?: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string, + identifier: rest[1] as string, + providerId: rest[2] as string, + name: rest[3] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + const identifier = params.identifier; + const providerId = params.providerId; + const name = params.name; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const payload: Payload = {}; + if (typeof identifier !== 'undefined') { + payload['identifier'] = identifier; + } + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a messaging target. + * + * @param {string} params.userId - User ID. + * @param {string} params.targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTarget(params: { userId: string, targetId: string }): Promise<{}>; + /** + * Delete a messaging target. + * + * @param {string} userId - User ID. + * @param {string} targetId - Target ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTarget(userId: string, targetId: string): Promise<{}>; + deleteTarget( + paramsOrFirst: { userId: string, targetId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { userId: string, targetId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, targetId: string }; + } else { + params = { + userId: paramsOrFirst as string, + targetId: rest[0] as string + }; + } + + const userId = params.userId; + const targetId = params.targetId; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof targetId === 'undefined') { + throw new AppwriteException('Missing required parameter: "targetId"'); + } + + const apiPath = '/users/{userId}/targets/{targetId}'.replace('{userId}', userId).replace('{targetId}', targetId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + * + * + * @param {string} params.userId - User ID. + * @param {number} params.length - Token length in characters. The default length is 6 characters + * @param {number} params.expire - Token expiration period in seconds. The default expiration is 15 minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + */ + createToken(params: { userId: string, length?: number, expire?: number }): Promise<Models.Token>; + /** + * Returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. + * + * + * @param {string} userId - User ID. + * @param {number} length - Token length in characters. The default length is 6 characters + * @param {number} expire - Token expiration period in seconds. The default expiration is 15 minutes. + * @throws {AppwriteException} + * @returns {Promise<Models.Token>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createToken(userId: string, length?: number, expire?: number): Promise<Models.Token>; + createToken( + paramsOrFirst: { userId: string, length?: number, expire?: number } | string, + ...rest: [(number)?, (number)?] + ): Promise<Models.Token> { + let params: { userId: string, length?: number, expire?: number }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, length?: number, expire?: number }; + } else { + params = { + userId: paramsOrFirst as string, + length: rest[0] as number, + expire: rest[1] as number + }; + } + + const userId = params.userId; + const length = params.length; + const expire = params.expire; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + + const apiPath = '/users/{userId}/tokens'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof length !== 'undefined') { + payload['length'] = length; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user email verification status by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.emailVerification - User email verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, emailVerification: boolean }): Promise<Models.User<Preferences>>; + /** + * Update the user email verification status by its unique ID. + * + * @param {string} userId - User ID. + * @param {boolean} emailVerification - User email verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>; + updateEmailVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, emailVerification: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, emailVerification: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, emailVerification: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + emailVerification: rest[0] as boolean + }; + } + + const userId = params.userId; + const emailVerification = params.emailVerification; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof emailVerification === 'undefined') { + throw new AppwriteException('Missing required parameter: "emailVerification"'); + } + + const apiPath = '/users/{userId}/verification'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof emailVerification !== 'undefined') { + payload['emailVerification'] = emailVerification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the user phone verification status by its unique ID. + * + * @param {string} params.userId - User ID. + * @param {boolean} params.phoneVerification - User phone verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + */ + updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(params: { userId: string, phoneVerification: boolean }): Promise<Models.User<Preferences>>; + /** + * Update the user phone verification status by its unique ID. + * + * @param {string} userId - User ID. + * @param {boolean} phoneVerification - User phone verification status. + * @throws {AppwriteException} + * @returns {Promise<Models.User<Preferences>>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>>; + updatePhoneVerification<Preferences extends Models.Preferences = Models.DefaultPreferences>( + paramsOrFirst: { userId: string, phoneVerification: boolean } | string, + ...rest: [(boolean)?] + ): Promise<Models.User<Preferences>> { + let params: { userId: string, phoneVerification: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { userId: string, phoneVerification: boolean }; + } else { + params = { + userId: paramsOrFirst as string, + phoneVerification: rest[0] as boolean + }; + } + + const userId = params.userId; + const phoneVerification = params.phoneVerification; + + if (typeof userId === 'undefined') { + throw new AppwriteException('Missing required parameter: "userId"'); + } + if (typeof phoneVerification === 'undefined') { + throw new AppwriteException('Missing required parameter: "phoneVerification"'); + } + + const apiPath = '/users/{userId}/verification/phone'.replace('{userId}', userId); + const payload: Payload = {}; + if (typeof phoneVerification !== 'undefined') { + payload['phoneVerification'] = phoneVerification; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts new file mode 100644 index 00000000..796cc425 --- /dev/null +++ b/src/services/webhooks.ts @@ -0,0 +1,466 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + + +export class Webhooks { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. + * + * @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: name, url, authUsername, tls, events, enabled, logs, attempts + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.WebhookList>} + */ + list(params?: { queries?: string[], total?: boolean }): Promise<Models.WebhookList>; + /** + * Get a list of all webhooks belonging to the project. You can use the query params to filter your results. + * + * @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: name, url, authUsername, tls, events, enabled, logs, attempts + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.WebhookList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise<Models.WebhookList>; + list( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.WebhookList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/webhooks'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. + * + * @param {string} params.webhookId - Webhook 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. + * @param {string} params.url - Webhook URL. + * @param {string} params.name - Webhook name. Max length: 128 chars. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {boolean} params.enabled - Enable or disable a webhook. + * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. + * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. + * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + create(params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }): Promise<Models.Webhook>; + /** + * Create a new webhook. Use this endpoint to configure a URL that will receive events from Appwrite when specific events occur. + * + * @param {string} webhookId - Webhook 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. + * @param {string} url - Webhook URL. + * @param {string} name - Webhook name. Max length: 128 chars. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {boolean} enabled - Enable or disable a webhook. + * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. + * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. + * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string): Promise<Models.Webhook>; + create( + paramsOrFirst: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?, (string)?] + ): Promise<Models.Webhook> { + let params: { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, url: string, name: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string, secret?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + url: rest[0] as string, + name: rest[1] as string, + events: rest[2] as string[], + enabled: rest[3] as boolean, + tls: rest[4] as boolean, + authUsername: rest[5] as string, + authPassword: rest[6] as string, + secret: rest[7] as string + }; + } + + const webhookId = params.webhookId; + const url = params.url; + const name = params.name; + const events = params.events; + const enabled = params.enabled; + const tls = params.tls; + const authUsername = params.authUsername; + const authPassword = params.authPassword; + const secret = params.secret; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof events === 'undefined') { + throw new AppwriteException('Missing required parameter: "events"'); + } + + const apiPath = '/webhooks'; + const payload: Payload = {}; + if (typeof webhookId !== 'undefined') { + payload['webhookId'] = webhookId; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof tls !== 'undefined') { + payload['tls'] = tls; + } + if (typeof authUsername !== 'undefined') { + payload['authUsername'] = authUsername; + } + if (typeof authPassword !== 'undefined') { + payload['authPassword'] = authPassword; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * + * @param {string} params.webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + get(params: { webhookId: string }): Promise<Models.Webhook>; + /** + * Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project. + * + * @param {string} webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(webhookId: string): Promise<Models.Webhook>; + get( + paramsOrFirst: { webhookId: string } | string + ): Promise<Models.Webhook> { + let params: { webhookId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string }; + } else { + params = { + webhookId: paramsOrFirst as string + }; + } + + const webhookId = params.webhookId; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. + * + * @param {string} params.webhookId - Webhook ID. + * @param {string} params.name - Webhook name. Max length: 128 chars. + * @param {string} params.url - Webhook URL. + * @param {string[]} params.events - Events list. Maximum of 100 events are allowed. + * @param {boolean} params.enabled - Enable or disable a webhook. + * @param {boolean} params.tls - Certificate verification, false for disabled or true for enabled. + * @param {string} params.authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} params.authPassword - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + update(params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }): Promise<Models.Webhook>; + /** + * Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook. + * + * @param {string} webhookId - Webhook ID. + * @param {string} name - Webhook name. Max length: 128 chars. + * @param {string} url - Webhook URL. + * @param {string[]} events - Events list. Maximum of 100 events are allowed. + * @param {boolean} enabled - Enable or disable a webhook. + * @param {boolean} tls - Certificate verification, false for disabled or true for enabled. + * @param {string} authUsername - Webhook HTTP user. Max length: 256 chars. + * @param {string} authPassword - Webhook HTTP password. Max length: 256 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string): Promise<Models.Webhook>; + update( + paramsOrFirst: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string } | string, + ...rest: [(string)?, (string)?, (string[])?, (boolean)?, (boolean)?, (string)?, (string)?] + ): Promise<Models.Webhook> { + let params: { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, name: string, url: string, events: string[], enabled?: boolean, tls?: boolean, authUsername?: string, authPassword?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + name: rest[0] as string, + url: rest[1] as string, + events: rest[2] as string[], + enabled: rest[3] as boolean, + tls: rest[4] as boolean, + authUsername: rest[5] as string, + authPassword: rest[6] as string + }; + } + + const webhookId = params.webhookId; + const name = params.name; + const url = params.url; + const events = params.events; + const enabled = params.enabled; + const tls = params.tls; + const authUsername = params.authUsername; + const authPassword = params.authPassword; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof url === 'undefined') { + throw new AppwriteException('Missing required parameter: "url"'); + } + if (typeof events === 'undefined') { + throw new AppwriteException('Missing required parameter: "events"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof url !== 'undefined') { + payload['url'] = url; + } + if (typeof events !== 'undefined') { + payload['events'] = events; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof tls !== 'undefined') { + payload['tls'] = tls; + } + if (typeof authUsername !== 'undefined') { + payload['authUsername'] = authUsername; + } + if (typeof authPassword !== 'undefined') { + payload['authPassword'] = authPassword; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * + * @param {string} params.webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { webhookId: string }): Promise<{}>; + /** + * Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events. + * + * @param {string} webhookId - Webhook ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(webhookId: string): Promise<{}>; + delete( + paramsOrFirst: { webhookId: string } | string + ): Promise<{}> { + let params: { webhookId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string }; + } else { + params = { + webhookId: paramsOrFirst as string + }; + } + + const webhookId = params.webhookId; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. + * + * @param {string} params.webhookId - Webhook ID. + * @param {string} params.secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + */ + updateSecret(params: { webhookId: string, secret?: string }): Promise<Models.Webhook>; + /** + * Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook. + * + * @param {string} webhookId - Webhook ID. + * @param {string} secret - Webhook secret key. If not provided, a new key will be generated automatically. Key must be at least 8 characters long, and at max 256 characters. + * @throws {AppwriteException} + * @returns {Promise<Models.Webhook>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateSecret(webhookId: string, secret?: string): Promise<Models.Webhook>; + updateSecret( + paramsOrFirst: { webhookId: string, secret?: string } | string, + ...rest: [(string)?] + ): Promise<Models.Webhook> { + let params: { webhookId: string, secret?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { webhookId: string, secret?: string }; + } else { + params = { + webhookId: paramsOrFirst as string, + secret: rest[0] as string + }; + } + + const webhookId = params.webhookId; + const secret = params.secret; + + if (typeof webhookId === 'undefined') { + throw new AppwriteException('Missing required parameter: "webhookId"'); + } + + const apiPath = '/webhooks/{webhookId}/secret'.replace('{webhookId}', webhookId); + const payload: Payload = {}; + if (typeof secret !== 'undefined') { + payload['secret'] = secret; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/test/id.test.js b/test/id.test.js new file mode 100644 index 00000000..0a648bc1 --- /dev/null +++ b/test/id.test.js @@ -0,0 +1,6 @@ +const { ID } = require("../dist/id"); + +describe("ID", () => { + test('unique', () => expect(ID.unique()).toHaveLength(20)); + test('custom', () => expect(ID.custom('custom')).toEqual('custom')); +}); diff --git a/test/operator.test.js b/test/operator.test.js new file mode 100644 index 00000000..a14910cd --- /dev/null +++ b/test/operator.test.js @@ -0,0 +1,99 @@ +const { Condition, Operator } = require("../dist/operator"); + +describe('Operator', () => { + test('returns increment', () => { + expect(Operator.increment(1)).toEqual(`{"method":"increment","values":[1]}`); + }); + + test('returns increment with max', () => { + expect(Operator.increment(5, 100)).toEqual(`{"method":"increment","values":[5,100]}`); + }); + + test('returns decrement', () => { + expect(Operator.decrement(1)).toEqual(`{"method":"decrement","values":[1]}`); + }); + + test('returns decrement with min', () => { + expect(Operator.decrement(3, 0)).toEqual(`{"method":"decrement","values":[3,0]}`); + }); + + test('returns multiply', () => { + expect(Operator.multiply(2)).toEqual(`{"method":"multiply","values":[2]}`); + }); + + test('returns multiply with max', () => { + expect(Operator.multiply(3, 1000)).toEqual(`{"method":"multiply","values":[3,1000]}`); + }); + + test('returns divide', () => { + expect(Operator.divide(2)).toEqual(`{"method":"divide","values":[2]}`); + }); + + test('returns divide with min', () => { + expect(Operator.divide(4, 1)).toEqual(`{"method":"divide","values":[4,1]}`); + }); + + test('returns modulo', () => { + expect(Operator.modulo(5)).toEqual(`{"method":"modulo","values":[5]}`); + }); + + test('returns power', () => { + expect(Operator.power(2)).toEqual(`{"method":"power","values":[2]}`); + }); + + test('returns arrayAppend', () => { + expect(Operator.arrayAppend(['item1', 'item2'])).toEqual('{"method":"arrayAppend","values":["item1","item2"]}'); + }); + + test('returns arrayPrepend', () => { + expect(Operator.arrayPrepend(['first', 'second'])).toEqual('{"method":"arrayPrepend","values":["first","second"]}'); + }); + + test('returns arrayInsert', () => { + expect(Operator.arrayInsert(0, 'newItem')).toEqual('{"method":"arrayInsert","values":[0,"newItem"]}'); + }); + + test('returns arrayRemove', () => { + expect(Operator.arrayRemove('oldItem')).toEqual('{"method":"arrayRemove","values":["oldItem"]}'); + }); + + test('returns arrayUnique', () => { + expect(Operator.arrayUnique()).toEqual('{"method":"arrayUnique","values":[]}'); + }); + + test('returns arrayIntersect', () => { + expect(Operator.arrayIntersect(['a', 'b', 'c'])).toEqual('{"method":"arrayIntersect","values":["a","b","c"]}'); + }); + + test('returns arrayDiff', () => { + expect(Operator.arrayDiff(['x', 'y'])).toEqual('{"method":"arrayDiff","values":["x","y"]}'); + }); + + test('returns arrayFilter', () => { + expect(Operator.arrayFilter(Condition.Equal, 'test')).toEqual('{"method":"arrayFilter","values":["equal","test"]}'); + }); + + test('returns stringConcat', () => { + expect(Operator.stringConcat('suffix')).toEqual('{"method":"stringConcat","values":["suffix"]}'); + }); + + test('returns stringReplace', () => { + expect(Operator.stringReplace('old', 'new')).toEqual('{"method":"stringReplace","values":["old","new"]}'); + }); + + test('returns toggle', () => { + expect(Operator.toggle()).toEqual('{"method":"toggle","values":[]}'); + }); + + test('returns dateAddDays', () => { + expect(Operator.dateAddDays(7)).toEqual('{"method":"dateAddDays","values":[7]}'); + }); + + test('returns dateSubDays', () => { + expect(Operator.dateSubDays(7)).toEqual('{"method":"dateSubDays","values":[7]}'); + }); + + test('returns dateSetNow', () => { + expect(Operator.dateSetNow()).toEqual('{"method":"dateSetNow","values":[]}'); + }); +}); diff --git a/test/permission.test.js b/test/permission.test.js new file mode 100644 index 00000000..7f972d3b --- /dev/null +++ b/test/permission.test.js @@ -0,0 +1,10 @@ +const { Permission } = require("../dist/permission"); +const { Role } = require("../dist/role"); + +describe('Permission', () => { + test('read', () => expect(Permission.read(Role.any())).toEqual('read("any")')); + test('write', () => expect(Permission.write(Role.any())).toEqual('write("any")')); + test('create', () => expect(Permission.create(Role.any())).toEqual('create("any")')); + test('update', () => expect(Permission.update(Role.any())).toEqual('update("any")')); + test('delete', () => expect(Permission.delete(Role.any())).toEqual('delete("any")')); +}) diff --git a/test/query.test.js b/test/query.test.js new file mode 100644 index 00000000..e539a1f6 --- /dev/null +++ b/test/query.test.js @@ -0,0 +1,155 @@ +const { Query } = require("../dist/query"); + +const tests = [ + { + description: 'with a string', + value: 's', + expectedValues: '["s"]' + }, + { + description: 'with a integer', + value: 1, + expectedValues: '[1]' + }, + { + description: 'with a double', + value: 1.2, + expectedValues: '[1.2]' + }, + { + description: 'with a whole number double', + value: 1.0, + expectedValues: '[1]' + }, + { + description: 'with a bool', + value: false, + expectedValues: '[false]' + }, + { + description: 'with a list', + value: ['a', 'b', 'c'], + expectedValues: '["a","b","c"]' + } +]; + +describe('Query', () => { + describe('basic filter equal', () => { + for (const t of tests) { + test(t.description, () => + expect(Query.equal("attr", t.value)) + .toEqual(`{"method":"equal","attribute":"attr","values":${t.expectedValues}}`) + ) + } + }) + + describe('basic filter notEqual', () => { + for (const t of tests) { + test(t.description, () => + expect(Query.notEqual("attr", t.value)) + .toEqual(`{"method":"notEqual","attribute":"attr","values":${t.expectedValues}}`) + ) + } + }); + + describe('basic filter lessThan', () => { + for (const t of tests) { + test(t.description, () => + expect(Query.lessThan("attr", t.value)) + .toEqual(`{"method":"lessThan","attribute":"attr","values":${t.expectedValues}}`) + ) + } + }); + + describe('basic filter lessThanEqual', () => { + for (const t of tests) { + test(t.description, () => + expect(Query.lessThanEqual("attr", t.value)) + .toEqual(`{"method":"lessThanEqual","attribute":"attr","values":${t.expectedValues}}`) + ) + } + }); + + describe('basic filter greaterThan', () => { + for (const t of tests) { + test(t.description, () => + expect(Query.greaterThan("attr", t.value)) + .toEqual(`{"method":"greaterThan","attribute":"attr","values":${t.expectedValues}}`) + ) + } + }); + + describe('basic filter greaterThanEqual', () => { + for (const t of tests) { + test(t.description, () => + expect(Query.greaterThanEqual("attr", t.value)) + .toEqual(`{"method":"greaterThanEqual","attribute":"attr","values":${t.expectedValues}}`) + ) + } + }); + + test('search', () => + expect(Query.search('attr', 'keyword1 keyword2')) + .toEqual(`{"method":"search","attribute":"attr","values":["keyword1 keyword2"]}`) + ); + + test('isNull', () => + expect(Query.isNull('attr')) + .toEqual(`{"method":"isNull","attribute":"attr"}`) + ); + + test('isNotNull', () => + expect(Query.isNotNull('attr')) + .toEqual(`{"method":"isNotNull","attribute":"attr"}`) + ); + + describe('between', () => { + test('with integers', () => + expect(Query.between('attr', 1, 2)) + .toEqual(`{"method":"between","attribute":"attr","values":[1,2]}`) + ); + test('with doubles', () => + expect(Query.between('attr', 1.2, 2.2)) + .toEqual(`{"method":"between","attribute":"attr","values":[1.2,2.2]}`) + ); + test('with strings', () => + expect(Query.between('attr',"a","z")) + .toEqual(`{"method":"between","attribute":"attr","values":["a","z"]}`) + ); + }); + + test('select', () => + expect(Query.select(['attr1', 'attr2'])) + .toEqual(`{"method":"select","values":["attr1","attr2"]}`) + ); + + test('orderAsc', () => + expect(Query.orderAsc('attr')) + .toEqual(`{"method":"orderAsc","attribute":"attr"}`) + ); + + test('orderDesc', () => + expect(Query.orderDesc('attr')) + .toEqual(`{"method":"orderDesc","attribute":"attr"}`) + ); + + test('cursorBefore', () => + expect(Query.cursorBefore('attr')) + .toEqual('{"method":"cursorBefore","values":["attr"]}') + ); + + test('cursorAfter', () => + expect(Query.cursorAfter('attr')) + .toEqual('{"method":"cursorAfter","values":["attr"]}') + ); + + test('limit', () => + expect(Query.limit(1)) + .toEqual('{"method":"limit","values":[1]}') + ); + + test('offset', () => + expect(Query.offset(1)) + .toEqual('{"method":"offset","values":[1]}') + ); +}) diff --git a/test/role.test.js b/test/role.test.js new file mode 100644 index 00000000..8f7420bd --- /dev/null +++ b/test/role.test.js @@ -0,0 +1,14 @@ +const { Role } = require("../dist/role"); + +describe('Role', () => { + test('any', () => expect(Role.any()).toEqual('any')); + test('user without status', () => expect(Role.user('custom')).toEqual('user:custom')); + test('user with status', () => expect(Role.user('custom', 'verified')).toEqual('user:custom/verified')); + test('users without status', () => expect(Role.users()).toEqual('users')); + test('users with status', () => expect(Role.users('verified')).toEqual('users/verified')); + test('guests', () => expect(Role.guests()).toEqual('guests')); + test('team without role', () => expect(Role.team('custom')).toEqual('team:custom')) + test('team with role', () => expect(Role.team('custom', 'owner')).toEqual('team:custom/owner')) + test('member', () => expect(Role.member('custom')).toEqual('member:custom')) + test('label', () => expect(Role.label('admin')).toEqual('label:admin')) +}) diff --git a/test/services/account.test.js b/test/services/account.test.js new file mode 100644 index 00000000..a9bbd59a --- /dev/null +++ b/test/services/account.test.js @@ -0,0 +1,1307 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Account } = require("../../dist/services/account"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Account', () => { + const client = new Client(); + const account = new Account(client); + + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.get( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.create( + '<USER_ID>', + 'email@example.com', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmail()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateEmail( + 'email@example.com', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listIdentities()', async () => { + const data = { + 'total': 5, + 'identities': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.listIdentities( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteIdentity()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.deleteIdentity( + '<IDENTITY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createJWT()', async () => { + const data = { + 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createJWT( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listLogs()', async () => { + const data = { + 'total': 5, + 'logs': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.listLogs( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMFA()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMFA( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMfaAuthenticator()', async () => { + const data = { + 'secret': '[SHARED_SECRET]', + 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createMfaAuthenticator( + 'totp', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMFAAuthenticator()', async () => { + const data = { + 'secret': '[SHARED_SECRET]', + 'uri': 'otpauth://totp/appwrite:user@example.com?secret=[SHARED_SECRET]&issuer=appwrite',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createMFAAuthenticator( + 'totp', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMfaAuthenticator()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMfaAuthenticator( + 'totp', + '<OTP>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMFAAuthenticator()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMFAAuthenticator( + 'totp', + '<OTP>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMfaAuthenticator()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.deleteMfaAuthenticator( + 'totp', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMFAAuthenticator()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.deleteMFAAuthenticator( + 'totp', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMfaChallenge()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'expire': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createMfaChallenge( + 'email', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMFAChallenge()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'expire': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createMFAChallenge( + 'email', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMfaChallenge()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMfaChallenge( + '<CHALLENGE_ID>', + '<OTP>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMFAChallenge()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMFAChallenge( + '<CHALLENGE_ID>', + '<OTP>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMfaFactors()', async () => { + const data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.listMfaFactors( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMFAFactors()', async () => { + const data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.listMFAFactors( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMfaRecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.getMfaRecoveryCodes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMFARecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.getMFARecoveryCodes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMfaRecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createMfaRecoveryCodes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMFARecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createMFARecoveryCodes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMfaRecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMfaRecoveryCodes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMFARecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMFARecoveryCodes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateName()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateName( + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePassword()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updatePassword( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePhone()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updatePhone( + '+12065550100', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getPrefs()', async () => { + const data = {}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.getPrefs( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePrefs()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updatePrefs( + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createRecovery()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createRecovery( + 'email@example.com', + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateRecovery()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateRecovery( + '<USER_ID>', + '<SECRET>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listSessions()', async () => { + const data = { + 'total': 5, + 'sessions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.listSessions( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteSessions()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.deleteSessions( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createAnonymousSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createAnonymousSession( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEmailPasswordSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createEmailPasswordSession( + 'email@example.com', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMagicURLSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateMagicURLSession( + '<USER_ID>', + '<SECRET>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePhoneSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updatePhoneSession( + '<USER_ID>', + '<SECRET>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createSession( + '<USER_ID>', + '<SECRET>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.getSession( + '<SESSION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateSession( + '<SESSION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteSession()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.deleteSession( + '<SESSION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateStatus()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateStatus( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEmailToken()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createEmailToken( + '<USER_ID>', + 'email@example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMagicURLToken()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createMagicURLToken( + '<USER_ID>', + 'email@example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createOAuth2Token()', async () => { + const data = 'https://example.com/'; + mockedFetch.mockImplementation(() => Response.redirect(data)); + + const response = await account.createOAuth2Token( + 'amazon', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPhoneToken()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createPhoneToken( + '<USER_ID>', + '+12065550100', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEmailVerification()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createEmailVerification( + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVerification()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createVerification( + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmailVerification()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateEmailVerification( + '<USER_ID>', + '<SECRET>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateVerification()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updateVerification( + '<USER_ID>', + '<SECRET>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPhoneVerification()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.createPhoneVerification( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePhoneVerification()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await account.updatePhoneVerification( + '<USER_ID>', + '<SECRET>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/activities.test.js b/test/services/activities.test.js new file mode 100644 index 00000000..667ecc56 --- /dev/null +++ b/test/services/activities.test.js @@ -0,0 +1,73 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Activities } = require("../../dist/services/activities"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Activities', () => { + const client = new Client(); + const activities = new Activities(client); + + + test('test method listEvents()', async () => { + const data = { + 'total': 5, + 'events': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await activities.listEvents( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getEvent()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'userType': 'user', + 'userId': '610fc2f985ee0', + 'userEmail': 'john@appwrite.io', + 'userName': 'John Doe', + 'resourceParent': 'database/ID', + 'resourceType': 'collection', + 'resourceId': '610fc2f985ee0', + 'resource': 'collections/610fc2f985ee0', + 'event': 'account.sessions.create', + 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36', + 'ip': '127.0.0.1', + 'mode': 'admin', + 'country': 'US', + 'time': '2020-10-15T06:38:00.000+00:00', + 'projectId': '610fc2f985ee0', + 'teamId': '610fc2f985ee0', + 'hostname': 'appwrite.io', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await activities.getEvent( + '<EVENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/advisor.test.js b/test/services/advisor.test.js new file mode 100644 index 00000000..5160f13e --- /dev/null +++ b/test/services/advisor.test.js @@ -0,0 +1,111 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Advisor } = require("../../dist/services/advisor"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Advisor', () => { + const client = new Client(); + const advisor = new Advisor(client); + + + test('test method listReports()', async () => { + const data = { + 'total': 5, + 'reports': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.listReports( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getReport()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'appId': '5e5ea5c16897e', + 'type': 'lighthouse', + 'title': 'Lighthouse audit for https://appwrite.io/', + 'summary': 'Performance score 78. 4 opportunities found.', + 'targetType': 'urls', + 'target': 'https://appwrite.io/', + 'categories': [], + 'insights': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.getReport( + '<REPORT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteReport()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.deleteReport( + '<REPORT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listInsights()', async () => { + const data = { + 'total': 5, + 'insights': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.listInsights( + '<REPORT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getInsight()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'reportId': '5e5ea5c16897e', + 'type': 'tablesDBIndex', + 'severity': 'warning', + 'status': 'active', + 'resourceType': 'databases', + 'resourceId': 'main', + 'parentResourceType': 'tables', + 'parentResourceId': 'orders', + 'title': 'Missing index on collection orders', + 'summary': 'Queries against `orders.status` are scanning the full collection.', + 'ctas': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await advisor.getInsight( + '<REPORT_ID>', + '<INSIGHT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/avatars.test.js b/test/services/avatars.test.js new file mode 100644 index 00000000..ea4f3798 --- /dev/null +++ b/test/services/avatars.test.js @@ -0,0 +1,123 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Avatars } = require("../../dist/services/avatars"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Avatars', () => { + const client = new Client(); + const avatars = new Avatars(client); + + + test('test method getBrowser()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getBrowser( + 'aa', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getCreditCard()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getCreditCard( + 'amex', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getFavicon()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getFavicon( + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getFlag()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getFlag( + 'af', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getImage()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getImage( + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getInitials()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getInitials( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQR()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getQR( + '<TEXT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getScreenshot()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await avatars.getScreenshot( + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/backups.test.js b/test/services/backups.test.js new file mode 100644 index 00000000..c888402e --- /dev/null +++ b/test/services/backups.test.js @@ -0,0 +1,256 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Backups } = require("../../dist/services/backups"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Backups', () => { + const client = new Client(); + const backups = new Backups(client); + + + test('test method listArchives()', async () => { + const data = { + 'total': 5, + 'archives': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.listArchives( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createArchive()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'policyId': 'did8jx6ws45jana098ab7', + 'size': 100000, + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.createArchive( + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getArchive()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'policyId': 'did8jx6ws45jana098ab7', + 'size': 100000, + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.getArchive( + '<ARCHIVE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteArchive()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.deleteArchive( + '<ARCHIVE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listPolicies()', async () => { + const data = { + 'total': 5, + 'policies': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.listPolicies( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.createPolicy( + '<POLICY_ID>', + [], + 1, + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.getPolicy( + '<POLICY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'Hourly backups', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'services': [], + 'resources': [], + 'retention': 7, + 'schedule': '0 * * * *', + 'enabled': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.updatePolicy( + '<POLICY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deletePolicy()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.deletePolicy( + '<POLICY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createRestoration()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'archiveId': 'did8jx6ws45jana098ab7', + 'policyId': 'did8jx6ws45jana098ab7', + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + 'options': '{databases.database[{oldId, newId, newName}]}',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.createRestoration( + '<ARCHIVE_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listRestorations()', async () => { + const data = { + 'total': 5, + 'restorations': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.listRestorations( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getRestoration()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'archiveId': 'did8jx6ws45jana098ab7', + 'policyId': 'did8jx6ws45jana098ab7', + 'status': 'completed', + 'startedAt': '2020-10-15T06:38:00.000+00:00', + 'migrationId': 'did8jx6ws45jana098ab7', + 'services': [], + 'resources': [], + 'options': '{databases.database[{oldId, newId, newName}]}',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await backups.getRestoration( + '<RESTORATION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/databases.test.js b/test/services/databases.test.js new file mode 100644 index 00000000..241f44f8 --- /dev/null +++ b/test/services/databases.test.js @@ -0,0 +1,1624 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Databases } = require("../../dist/services/databases"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Databases', () => { + const client = new Client(); + const databases = new Databases(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'databases': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.create( + '<DATABASE_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listTransactions()', async () => { + const data = { + 'total': 5, + 'transactions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.listTransactions( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTransaction()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createTransaction( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getTransaction()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.getTransaction( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTransaction()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateTransaction( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteTransaction()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.deleteTransaction( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createOperations()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createOperations( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.get( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.update( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.delete( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listCollections()', async () => { + const data = { + 'total': 5, + 'collections': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.listCollections( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createCollection()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createCollection( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getCollection()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.getCollection( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateCollection()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Collection', + 'enabled': true, + 'documentSecurity': true, + 'attributes': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateCollection( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteCollection()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.deleteCollection( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listAttributes()', async () => { + const data = { + 'total': 5, + 'attributes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.listAttributes( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createBigIntAttribute()', async () => { + const data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createBigIntAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateBigIntAttribute()', async () => { + const data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateBigIntAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createBooleanAttribute()', async () => { + const data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createBooleanAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateBooleanAttribute()', async () => { + const data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateBooleanAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDatetimeAttribute()', async () => { + const data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createDatetimeAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDatetimeAttribute()', async () => { + const data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateDatetimeAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + '2020-10-15T06:38:00.000+00:00', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEmailAttribute()', async () => { + const data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createEmailAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmailAttribute()', async () => { + const data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateEmailAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + 'email@example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEnumAttribute()', async () => { + const data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createEnumAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + [], + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEnumAttribute()', async () => { + const data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateEnumAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + [], + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createFloatAttribute()', async () => { + const data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createFloatAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateFloatAttribute()', async () => { + const data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateFloatAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + 1.0, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createIntegerAttribute()', async () => { + const data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createIntegerAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateIntegerAttribute()', async () => { + const data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateIntegerAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createIpAttribute()', async () => { + const data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createIpAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateIpAttribute()', async () => { + const data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateIpAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createLineAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createLineAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLineAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateLineAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createLongtextAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createLongtextAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLongtextAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateLongtextAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMediumtextAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createMediumtextAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMediumtextAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateMediumtextAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPointAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createPointAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePointAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updatePointAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPolygonAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createPolygonAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePolygonAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updatePolygonAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createRelationshipAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedCollection': 'collection', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createRelationshipAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<RELATED_COLLECTION_ID>', + 'oneToOne', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateRelationshipAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedCollection': 'collection', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateRelationshipAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createStringAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createStringAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + 1, + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateStringAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateStringAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTextAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createTextAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTextAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateTextAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createUrlAttribute()', async () => { + const data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createUrlAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateUrlAttribute()', async () => { + const data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateUrlAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVarcharAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createVarcharAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + 1, + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateVarcharAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateVarcharAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getAttribute()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.getAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteAttribute()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.deleteAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listDocuments()', async () => { + const data = { + 'total': 5, + 'documents': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.listDocuments( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDocument()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createDocument( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<DOCUMENT_ID>', + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDocuments()', async () => { + const data = { + 'total': 5, + 'documents': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createDocuments( + '<DATABASE_ID>', + '<COLLECTION_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method upsertDocuments()', async () => { + const data = { + 'total': 5, + 'documents': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.upsertDocuments( + '<DATABASE_ID>', + '<COLLECTION_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDocuments()', async () => { + const data = { + 'total': 5, + 'documents': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateDocuments( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteDocuments()', async () => { + const data = { + 'total': 5, + 'documents': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.deleteDocuments( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getDocument()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.getDocument( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<DOCUMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method upsertDocument()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.upsertDocument( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<DOCUMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDocument()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.updateDocument( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<DOCUMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteDocument()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.deleteDocument( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<DOCUMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method decrementDocumentAttribute()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.decrementDocumentAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<DOCUMENT_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method incrementDocumentAttribute()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$collectionId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.incrementDocumentAttribute( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '<DOCUMENT_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listIndexes()', async () => { + const data = { + 'total': 5, + 'indexes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.listIndexes( + '<DATABASE_ID>', + '<COLLECTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createIndex()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'attributes': [], + 'lengths': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.createIndex( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + 'key', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getIndex()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'attributes': [], + 'lengths': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.getIndex( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteIndex()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await databases.deleteIndex( + '<DATABASE_ID>', + '<COLLECTION_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/functions.test.js b/test/services/functions.test.js new file mode 100644 index 00000000..f5e19c8d --- /dev/null +++ b/test/services/functions.test.js @@ -0,0 +1,751 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Functions } = require("../../dist/services/functions"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Functions', () => { + const client = new Client(); + const functions = new Functions(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'functions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.create( + '<FUNCTION_ID>', + '<NAME>', + 'node-14.5', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listRuntimes()', async () => { + const data = { + 'total': 5, + 'runtimes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.listRuntimes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listSpecifications()', async () => { + const data = { + 'total': 5, + 'specifications': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.listSpecifications( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.get( + '<FUNCTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.update( + '<FUNCTION_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.delete( + '<FUNCTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateFunctionDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'execute': [], + 'name': 'My Function', + 'enabled': true, + 'live': true, + 'logging': true, + 'runtime': 'python-3.8', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'scopes': [], + 'vars': [], + 'events': [], + 'schedule': '5 4 * * *', + 'timeout': 300, + 'entrypoint': 'index.js', + 'commands': 'npm install', + 'version': 'v2', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'functions/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.updateFunctionDeployment( + '<FUNCTION_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listDeployments()', async () => { + const data = { + 'total': 5, + 'deployments': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.listDeployments( + '<FUNCTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.createDeployment( + '<FUNCTION_ID>', + InputFile.fromBuffer(new Uint8Array(0), 'image.png'), + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDuplicateDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.createDuplicateDeployment( + '<FUNCTION_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTemplateDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.createTemplateDeployment( + '<FUNCTION_ID>', + '<REPOSITORY>', + '<OWNER>', + '<ROOT_DIRECTORY>', + 'commit', + '<REFERENCE>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVcsDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.createVcsDeployment( + '<FUNCTION_ID>', + 'branch', + '<REFERENCE>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.getDeployment( + '<FUNCTION_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteDeployment()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.deleteDeployment( + '<FUNCTION_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getDeploymentDownload()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await functions.getDeploymentDownload( + '<FUNCTION_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDeploymentStatus()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.updateDeploymentStatus( + '<FUNCTION_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listExecutions()', async () => { + const data = { + 'total': 5, + 'executions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.listExecutions( + '<FUNCTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createExecution()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.createExecution( + '<FUNCTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getExecution()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.getExecution( + '<FUNCTION_ID>', + '<EXECUTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteExecution()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.deleteExecution( + '<FUNCTION_ID>', + '<EXECUTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listVariables()', async () => { + const data = { + 'total': 5, + 'variables': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.listVariables( + '<FUNCTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.createVariable( + '<FUNCTION_ID>', + '<VARIABLE_ID>', + '<KEY>', + '<VALUE>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.getVariable( + '<FUNCTION_ID>', + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.updateVariable( + '<FUNCTION_ID>', + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteVariable()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await functions.deleteVariable( + '<FUNCTION_ID>', + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/graphql.test.js b/test/services/graphql.test.js new file mode 100644 index 00000000..da7e49bf --- /dev/null +++ b/test/services/graphql.test.js @@ -0,0 +1,40 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Graphql } = require("../../dist/services/graphql"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Graphql', () => { + const client = new Client(); + const graphql = new Graphql(client); + + + test('test method query()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await graphql.query( + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method mutation()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await graphql.mutation( + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/health.test.js b/test/services/health.test.js new file mode 100644 index 00000000..17f087e2 --- /dev/null +++ b/test/services/health.test.js @@ -0,0 +1,368 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Health } = require("../../dist/services/health"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Health', () => { + const client = new Client(); + const health = new Health(client); + + + test('test method get()', async () => { + const data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.get( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getAntivirus()', async () => { + const data = { + 'version': '1.0.0', + 'status': 'online',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getAntivirus( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getCache()', async () => { + const data = { + 'total': 5, + 'statuses': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getCache( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getCertificate()', async () => { + const data = { + 'name': '/CN=www.google.com', + 'subjectSN': '', + 'issuerOrganisation': '', + 'validFrom': '1704200998', + 'validTo': '1711458597', + 'signatureTypeSN': 'RSA-SHA256',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getCertificate( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getConsolePausing()', async () => { + const data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getConsolePausing( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getDB()', async () => { + const data = { + 'total': 5, + 'statuses': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getDB( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getPubSub()', async () => { + const data = { + 'total': 5, + 'statuses': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getPubSub( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueAudits()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueAudits( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueBuilds()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueBuilds( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueCertificates()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueCertificates( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueDatabases()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueDatabases( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueDeletes()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueDeletes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getFailedJobs()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getFailedJobs( + 'v1-database', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueFunctions()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueFunctions( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueLogs()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueLogs( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueMails()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueMails( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueMessaging()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueMessaging( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueMigrations()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueMigrations( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueStatsResources()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueStatsResources( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueUsage()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueUsage( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getQueueWebhooks()', async () => { + const data = { + 'size': 8,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getQueueWebhooks( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getStorage()', async () => { + const data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getStorage( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getStorageLocal()', async () => { + const data = { + 'name': 'database', + 'ping': 128, + 'status': 'pass',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getStorageLocal( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getTime()', async () => { + const data = { + 'remoteTime': 1639490751, + 'localTime': 1639490844, + 'diff': 93,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await health.getTime( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/locale.test.js b/test/services/locale.test.js new file mode 100644 index 00000000..51ef111e --- /dev/null +++ b/test/services/locale.test.js @@ -0,0 +1,137 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Locale } = require("../../dist/services/locale"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Locale', () => { + const client = new Client(); + const locale = new Locale(client); + + + test('test method get()', async () => { + const data = { + 'ip': '127.0.0.1', + 'countryCode': 'US', + 'country': 'United States', + 'continentCode': 'NA', + 'continent': 'North America', + 'eu': true, + 'currency': 'USD',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.get( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listCodes()', async () => { + const data = { + 'total': 5, + 'localeCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.listCodes( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listContinents()', async () => { + const data = { + 'total': 5, + 'continents': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.listContinents( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listCountries()', async () => { + const data = { + 'total': 5, + 'countries': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.listCountries( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listCountriesEU()', async () => { + const data = { + 'total': 5, + 'countries': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.listCountriesEU( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listCountriesPhones()', async () => { + const data = { + 'total': 5, + 'phones': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.listCountriesPhones( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listCurrencies()', async () => { + const data = { + 'total': 5, + 'currencies': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.listCurrencies( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listLanguages()', async () => { + const data = { + 'total': 5, + 'languages': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await locale.listLanguages( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/messaging.test.js b/test/services/messaging.test.js new file mode 100644 index 00000000..f327a32d --- /dev/null +++ b/test/services/messaging.test.js @@ -0,0 +1,1200 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Messaging } = require("../../dist/services/messaging"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Messaging', () => { + const client = new Client(); + const messaging = new Messaging(client); + + + test('test method listMessages()', async () => { + const data = { + 'total': 5, + 'messages': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listMessages( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEmail()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createEmail( + '<MESSAGE_ID>', + '<SUBJECT>', + '<CONTENT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmail()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateEmail( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPush()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createPush( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePush()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updatePush( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSms()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createSms( + '<MESSAGE_ID>', + '<CONTENT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSMS()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createSMS( + '<MESSAGE_ID>', + '<CONTENT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSms()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateSms( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSMS()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateSMS( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMessage()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'providerType': 'email', + 'topics': [], + 'users': [], + 'targets': [], + 'deliveredTotal': 1, + 'data': {}, + 'status': 'processing',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.getMessage( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.delete( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMessageLogs()', async () => { + const data = { + 'total': 5, + 'logs': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listMessageLogs( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listTargets()', async () => { + const data = { + 'total': 5, + 'targets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listTargets( + '<MESSAGE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listProviders()', async () => { + const data = { + 'total': 5, + 'providers': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listProviders( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createApnsProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createApnsProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createAPNSProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createAPNSProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateApnsProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateApnsProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateAPNSProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateAPNSProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createFcmProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createFcmProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createFCMProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createFCMProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateFcmProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateFcmProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateFCMProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateFCMProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMailgunProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createMailgunProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMailgunProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateMailgunProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMsg91Provider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createMsg91Provider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMsg91Provider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateMsg91Provider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createResendProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createResendProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateResendProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateResendProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSendgridProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createSendgridProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSendgridProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateSendgridProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSmtpProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createSmtpProvider( + '<PROVIDER_ID>', + '<NAME>', + '<HOST>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSMTPProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createSMTPProvider( + '<PROVIDER_ID>', + '<NAME>', + '<HOST>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSmtpProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateSmtpProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSMTPProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateSMTPProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTelesignProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createTelesignProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTelesignProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateTelesignProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTextmagicProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createTextmagicProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTextmagicProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateTextmagicProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTwilioProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createTwilioProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTwilioProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateTwilioProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVonageProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createVonageProvider( + '<PROVIDER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateVonageProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateVonageProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getProvider()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Mailgun', + 'provider': 'mailgun', + 'enabled': true, + 'type': 'sms', + 'credentials': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.getProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteProvider()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.deleteProvider( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listProviderLogs()', async () => { + const data = { + 'total': 5, + 'logs': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listProviderLogs( + '<PROVIDER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listSubscriberLogs()', async () => { + const data = { + 'total': 5, + 'logs': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listSubscriberLogs( + '<SUBSCRIBER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listTopics()', async () => { + const data = { + 'total': 5, + 'topics': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listTopics( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTopic()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createTopic( + '<TOPIC_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getTopic()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.getTopic( + '<TOPIC_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTopic()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'events', + 'emailTotal': 100, + 'smsTotal': 100, + 'pushTotal': 100, + 'subscribe': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.updateTopic( + '<TOPIC_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteTopic()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.deleteTopic( + '<TOPIC_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listTopicLogs()', async () => { + const data = { + 'total': 5, + 'logs': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listTopicLogs( + '<TOPIC_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listSubscribers()', async () => { + const data = { + 'total': 5, + 'subscribers': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.listSubscribers( + '<TOPIC_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSubscriber()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': {}, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.createSubscriber( + '<TOPIC_ID>', + '<SUBSCRIBER_ID>', + '<TARGET_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getSubscriber()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'targetId': '259125845563242502', + 'target': {}, + 'userId': '5e5ea5c16897e', + 'userName': 'Aegon Targaryen', + 'topicId': '259125845563242502', + 'providerType': 'email',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.getSubscriber( + '<TOPIC_ID>', + '<SUBSCRIBER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteSubscriber()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await messaging.deleteSubscriber( + '<TOPIC_ID>', + '<SUBSCRIBER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/presences.test.js b/test/services/presences.test.js new file mode 100644 index 00000000..2b43154c --- /dev/null +++ b/test/services/presences.test.js @@ -0,0 +1,104 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Presences } = require("../../dist/services/presences"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Presences', () => { + const client = new Client(); + const presences = new Presences(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'presences': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.get( + '<PRESENCE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method upsert()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.upsert( + '<PRESENCE_ID>', + '<USER_ID>', + '<STATUS>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePresence()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'userId': '674af8f3e12a5f9ac0be', + 'source': 'HTTP',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.updatePresence( + '<PRESENCE_ID>', + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await presences.delete( + '<PRESENCE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/project.test.js b/test/services/project.test.js new file mode 100644 index 00000000..7a18b7e7 --- /dev/null +++ b/test/services/project.test.js @@ -0,0 +1,2194 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Project } = require("../../dist/services/project"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Project', () => { + const client = new Client(); + const project = new Project(client); + + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.get( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.delete( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateAuthMethod()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateAuthMethod( + 'email-password', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listKeys()', async () => { + const data = { + 'total': 5, + 'keys': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.listKeys( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createKey( + '<KEY_ID>', + '<NAME>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEphemeralKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createEphemeralKey( + [], + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.getKey( + '<KEY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateKey( + '<KEY_ID>', + '<NAME>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteKey()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.deleteKey( + '<KEY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLabels()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateLabels( + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMockPhones()', async () => { + const data = { + 'total': 5, + 'mockNumbers': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.listMockPhones( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMockPhone()', async () => { + const data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createMockPhone( + '+12065550100', + '<OTP>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMockPhone()', async () => { + const data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.getMockPhone( + '+12065550100', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMockPhone()', async () => { + const data = { + 'number': '+1612842323', + 'otp': '123456', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateMockPhone( + '+12065550100', + '<OTP>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMockPhone()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.deleteMockPhone( + '+12065550100', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listOAuth2Providers()', async () => { + const data = { + 'total': 5, + 'providers': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.listOAuth2Providers( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Amazon()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', + 'clientSecret': '79ffe4000000000000000000000000000000000000000000000000000002de55',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Amazon( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Apple()', async () => { + const data = { + '\$id': 'apple', + 'enabled': true, + 'serviceId': 'ip.appwrite.app.web', + 'keyId': 'P4000000N8', + 'teamId': 'D4000000R6', + 'p8File': '-----BEGIN PRIVATE KEY-----MIGTAg...jy2Xbna-----END PRIVATE KEY-----',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Apple( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Auth0()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'OaOkIA000000000000000000005KLSYq', + 'clientSecret': 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + 'endpoint': 'example.us.auth0.com',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Auth0( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Authentik()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', + 'clientSecret': 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + 'endpoint': 'example.authentik.com',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Authentik( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Autodesk()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '5zw90v00000000000000000000kVYXN7', + 'clientSecret': '7I000000000000MW',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Autodesk( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Bitbucket()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'key': 'Knt70000000000ByRc', + 'secret': 'NMfLZJ00000000000000000000TLQdDx',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Bitbucket( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Bitly()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'd95151000000000000000000000000000067af9b', + 'clientSecret': 'a13e250000000000000000000000000000d73095',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Bitly( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Box()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'deglcs00000000000000000000x2og6y', + 'clientSecret': 'OKM1f100000000000000000000eshEif',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Box( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Dailymotion()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'apiKey': '07a9000000000000067f', + 'apiSecret': 'a399a90000000000000000000000000000d90639',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Dailymotion( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Discord()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '950722000000343754', + 'clientSecret': 'YmPXnM000000000000000000002zFg5D',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Discord( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Disqus()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'publicKey': 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', + 'secretKey': 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Disqus( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Dropbox()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'appKey': 'jl000000000009t', + 'appSecret': 'g200000000000vw',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Dropbox( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Etsy()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'keyString': 'nsgzxh0000000000008j85a2', + 'sharedSecret': 'tp000000ru',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Etsy( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Facebook()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'appId': '260600000007694', + 'appSecret': '2d0b2800000000000000000000d38af4',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Facebook( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Figma()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'byay5H0000000000VtiI40', + 'clientSecret': 'yEpOYn0000000000000000004iIsU5',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Figma( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2FusionAuth()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'b2222c00-0000-0000-0000-000000862097', + 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', + 'endpoint': 'example.fusionauth.io',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2FusionAuth( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2GitHub()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'e4d87900000000540733', + 'clientSecret': '5e07c00000000000000000000000000000198bcc',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2GitHub( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Gitlab()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', + 'secret': 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + 'endpoint': 'https://gitlab.com',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Gitlab( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Google()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', + 'clientSecret': 'example-google-client-secret', + 'prompt': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Google( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Keycloak()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-o0000000st-app', + 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', + 'endpoint': 'keycloak.example.com', + 'realmName': 'appwrite-realm',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Keycloak( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Kick()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '01KQ7C00000000000001MFHS32', + 'clientSecret': '34ac5600000000000000000000000000000000000000000000000000e830c8b',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Kick( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Linkedin()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '770000000000dv', + 'primaryClientSecret': 'example-linkedin-client-secret',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Linkedin( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Microsoft()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Microsoft( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Notion()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', + 'oauthClientSecret': 'secret_dLUr4b000000000000000000000000000000lFHAa9',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Notion( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Oidc()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', + 'clientSecret': 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', + 'authorizationURL': 'https://myoauth.com/oauth2/authorize', + 'tokenURL': 'https://myoauth.com/oauth2/token', + 'userInfoURL': 'https://myoauth.com/oauth2/userinfo',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Oidc( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Okta()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '0oa00000000000000698', + 'clientSecret': 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + 'domain': 'trial-6400025.okta.com', + 'authorizationServerId': 'aus000000000000000h7z',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Okta( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Paypal()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Paypal( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2PaypalSandbox()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', + 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2PaypalSandbox( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Podio()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'appwrite-oauth-test-app', + 'clientSecret': 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Podio( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Salesforce()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', + 'customerSecret': '3w000000000000e2',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Salesforce( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Slack()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '23000000089.15000000000023', + 'clientSecret': '81656000000000000000000000f3d2fd',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Slack( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Spotify()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6ec271000000000000000000009beace', + 'clientSecret': 'db068a000000000000000000008b5b9f',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Spotify( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Stripe()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'ca_UKibXX0000000000000000000006byvR', + 'apiSecretKey': 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Stripe( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Tradeshift()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Tradeshift( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2TradeshiftSandbox()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', + 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2TradeshiftSandbox( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Twitch()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'vvi0in000000000000000000ikmt9p', + 'clientSecret': 'pmapue000000000000000000zylw3v',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Twitch( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2WordPress()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '130005', + 'clientSecret': 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2WordPress( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2X()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'customerKey': 'slzZV0000000000000NFLaWT', + 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2X( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Yahoo()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', + 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Yahoo( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Yandex()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '6a8a6a0000000000000000000091483c', + 'clientSecret': 'bbf98500000000000000000000c75a63',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Yandex( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Zoho()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': '1000.83C178000000000000000000RPNX0B', + 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Zoho( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateOAuth2Zoom()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'clientId': 'QMAC00000000000000w0AQ', + 'clientSecret': 'GAWsG4000000000000000000007U01ON',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateOAuth2Zoom( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getOAuth2Provider()', async () => { + const data = { + '\$id': 'github', + 'enabled': true, + 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', + 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'tenant': 'common',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.getOAuth2Provider( + 'amazon', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listPlatforms()', async () => { + const data = { + 'total': 5, + 'platforms': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.listPlatforms( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createAndroidPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createAndroidPlatform( + '<PLATFORM_ID>', + '<NAME>', + '<APPLICATION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateAndroidPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'applicationId': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateAndroidPlatform( + '<PLATFORM_ID>', + '<NAME>', + '<APPLICATION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createApplePlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createApplePlatform( + '<PLATFORM_ID>', + '<NAME>', + '<BUNDLE_IDENTIFIER>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateApplePlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'bundleIdentifier': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateApplePlatform( + '<PLATFORM_ID>', + '<NAME>', + '<BUNDLE_IDENTIFIER>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createLinuxPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createLinuxPlatform( + '<PLATFORM_ID>', + '<NAME>', + '<PACKAGE_NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLinuxPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateLinuxPlatform( + '<PLATFORM_ID>', + '<NAME>', + '<PACKAGE_NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createWebPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createWebPlatform( + '<PLATFORM_ID>', + '<NAME>', + 'app.example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateWebPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'hostname': 'app.example.com',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateWebPlatform( + '<PLATFORM_ID>', + '<NAME>', + 'app.example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createWindowsPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createWindowsPlatform( + '<PLATFORM_ID>', + '<NAME>', + '<PACKAGE_IDENTIFIER_NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateWindowsPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageIdentifierName': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateWindowsPlatform( + '<PLATFORM_ID>', + '<NAME>', + '<PACKAGE_IDENTIFIER_NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getPlatform()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Web App', + 'type': 'web', + 'packageName': 'com.company.appname',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.getPlatform( + '<PLATFORM_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deletePlatform()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.deletePlatform( + '<PLATFORM_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listPolicies()', async () => { + const data = { + 'total': 9, + 'policies': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.listPolicies( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDenyAliasedEmailPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateDenyAliasedEmailPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDenyDisposableEmailPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateDenyDisposableEmailPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDenyFreeEmailPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateDenyFreeEmailPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMembershipPrivacyPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateMembershipPrivacyPolicy( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePasswordDictionaryPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updatePasswordDictionaryPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePasswordHistoryPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updatePasswordHistoryPolicy( + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePasswordPersonalDataPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updatePasswordPersonalDataPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSessionAlertPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateSessionAlertPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSessionDurationPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateSessionDurationPolicy( + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSessionInvalidationPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateSessionInvalidationPolicy( + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSessionLimitPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateSessionLimitPolicy( + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateUserLimitPolicy()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateUserLimitPolicy( + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getPolicy()', async () => { + const data = { + '\$id': 'password-dictionary', + 'userId': true, + 'userEmail': true, + 'userPhone': true, + 'userName': true, + 'userMFA': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.getPolicy( + 'password-dictionary', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateProtocol()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateProtocol( + 'rest', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateService()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateService( + 'account', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSMTP()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateSMTP( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSMTPTest()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createSMTPTest( + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listEmailTemplates()', async () => { + const data = { + 'total': 5, + 'templates': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.listEmailTemplates( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmailTemplate()', async () => { + const data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateEmailTemplate( + 'verification', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getEmailTemplate()', async () => { + const data = { + 'templateId': 'verification', + 'locale': 'en_us', + 'message': 'Click on the link to verify your account.', + 'senderName': 'My User', + 'senderEmail': 'mail@appwrite.io', + 'replyToEmail': 'emails@appwrite.io', + 'replyToName': 'Support Team', + 'subject': 'Please verify your email address',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.getEmailTemplate( + 'verification', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listVariables()', async () => { + const data = { + 'total': 5, + 'variables': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.listVariables( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.createVariable( + '<VARIABLE_ID>', + '<KEY>', + '<VALUE>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.getVariable( + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.updateVariable( + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteVariable()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await project.deleteVariable( + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/proxy.test.js b/test/services/proxy.test.js new file mode 100644 index 00000000..05a556ff --- /dev/null +++ b/test/services/proxy.test.js @@ -0,0 +1,215 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Proxy } = require("../../dist/services/proxy"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Proxy', () => { + const client = new Client(); + const proxy = new Proxy(client); + + + test('test method listRules()', async () => { + const data = { + 'total': 5, + 'rules': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.listRules( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createAPIRule()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.createAPIRule( + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createFunctionRule()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.createFunctionRule( + '', + '<FUNCTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createRedirectRule()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.createRedirectRule( + '', + 'https://example.com', + '301', + '<RESOURCE_ID>', + 'site', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSiteRule()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.createSiteRule( + '', + '<SITE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getRule()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.getRule( + '<RULE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteRule()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.deleteRule( + '<RULE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateRuleStatus()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'domain': 'appwrite.company.com', + 'type': 'deployment', + 'trigger': 'manual', + 'redirectUrl': 'https://appwrite.io/docs', + 'redirectStatusCode': 301, + 'deploymentId': 'n3u9feiwmf', + 'deploymentResourceId': 'n3u9feiwmf', + 'deploymentVcsProviderBranch': 'main', + 'status': 'verified', + 'logs': 'Verification of DNS records failed with DNS resolver 8.8.8.8. Domain stage.myapp.com does not have DNS record.', + 'renewAt': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await proxy.updateRuleStatus( + '<RULE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/sites.test.js b/test/services/sites.test.js new file mode 100644 index 00000000..11e9f6da --- /dev/null +++ b/test/services/sites.test.js @@ -0,0 +1,729 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Sites } = require("../../dist/services/sites"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Sites', () => { + const client = new Client(); + const sites = new Sites(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'sites': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.create( + '<SITE_ID>', + '<NAME>', + 'analog', + 'node-14.5', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listFrameworks()', async () => { + const data = { + 'total': 5, + 'frameworks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.listFrameworks( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listSpecifications()', async () => { + const data = { + 'total': 5, + 'specifications': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.listSpecifications( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.get( + '<SITE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.update( + '<SITE_ID>', + '<NAME>', + 'analog', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.delete( + '<SITE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSiteDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Site', + 'enabled': true, + 'live': true, + 'logging': true, + 'framework': 'react', + 'deploymentRetention': 7, + 'deploymentId': '5e5ea5c16897e', + 'deploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'deploymentScreenshotLight': '5e5ea5c16897e', + 'deploymentScreenshotDark': '5e5ea5c16897e', + 'latestDeploymentId': '5e5ea5c16897e', + 'latestDeploymentCreatedAt': '2020-10-15T06:38:00.000+00:00', + 'latestDeploymentStatus': 'ready', + 'vars': [], + 'timeout': 300, + 'installCommand': 'npm install', + 'buildCommand': 'npm run build', + 'startCommand': 'node custom-server.mjs', + 'outputDirectory': 'build', + 'installationId': '6m40at4ejk5h2u9s1hboo', + 'providerRepositoryId': 'appwrite', + 'providerBranch': 'main', + 'providerRootDirectory': 'sites/helloWorld', + 'providerSilentMode': true, + 'buildSpecification': 's-1vcpu-512mb', + 'runtimeSpecification': 's-1vcpu-512mb', + 'buildRuntime': 'node-22', + 'adapter': 'static', + 'fallbackFile': 'index.html',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.updateSiteDeployment( + '<SITE_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listDeployments()', async () => { + const data = { + 'total': 5, + 'deployments': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.listDeployments( + '<SITE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.createDeployment( + '<SITE_ID>', + InputFile.fromBuffer(new Uint8Array(0), 'image.png'), + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDuplicateDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.createDuplicateDeployment( + '<SITE_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTemplateDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.createTemplateDeployment( + '<SITE_ID>', + '<REPOSITORY>', + '<OWNER>', + '<ROOT_DIRECTORY>', + 'branch', + '<REFERENCE>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVcsDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.createVcsDeployment( + '<SITE_ID>', + 'branch', + '<REFERENCE>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getDeployment()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.getDeployment( + '<SITE_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteDeployment()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.deleteDeployment( + '<SITE_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getDeploymentDownload()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await sites.getDeploymentDownload( + '<SITE_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDeploymentStatus()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'type': 'vcs', + 'resourceId': '5e5ea6g16897e', + 'resourceType': 'functions', + 'entrypoint': 'index.js', + 'sourceSize': 128, + 'buildSize': 128, + 'totalSize': 128, + 'buildId': '5e5ea5c16897e', + 'activate': true, + 'screenshotLight': '5e5ea5c16897e', + 'screenshotDark': '5e5ea5c16897e', + 'status': 'ready', + 'buildLogs': 'Compiling source files...', + 'buildDuration': 128, + 'providerRepositoryName': 'database', + 'providerRepositoryOwner': 'utopia', + 'providerRepositoryUrl': 'https://github.com/vermakhushboo/g4-node-function', + 'providerCommitHash': '7c3f25d', + 'providerCommitAuthorUrl': 'https://github.com/vermakhushboo', + 'providerCommitAuthor': 'Khushboo Verma', + 'providerCommitMessage': 'Update index.js', + 'providerCommitUrl': 'https://github.com/vermakhushboo/g4-node-function/commit/60c0416257a9cbcdd96b2d370c38d8f8d150ccfb', + 'providerBranch': '0.7.x', + 'providerBranchUrl': 'https://github.com/vermakhushboo/appwrite/tree/0.7.x',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.updateDeploymentStatus( + '<SITE_ID>', + '<DEPLOYMENT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listLogs()', async () => { + const data = { + 'total': 5, + 'executions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.listLogs( + '<SITE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getLog()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'functionId': '5e5ea6g16897e', + 'deploymentId': '5e5ea5c16897e', + 'trigger': 'http', + 'status': 'processing', + 'requestMethod': 'GET', + 'requestPath': '/articles?id=5', + 'requestHeaders': [], + 'responseStatusCode': 200, + 'responseBody': '', + 'responseHeaders': [], + 'logs': '', + 'errors': '', + 'duration': 0.4,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.getLog( + '<SITE_ID>', + '<LOG_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteLog()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.deleteLog( + '<SITE_ID>', + '<LOG_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listVariables()', async () => { + const data = { + 'total': 5, + 'variables': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.listVariables( + '<SITE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.createVariable( + '<SITE_ID>', + '<VARIABLE_ID>', + '<KEY>', + '<VALUE>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.getVariable( + '<SITE_ID>', + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateVariable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'API_KEY', + 'value': 'myPa\$\$word1', + 'secret': true, + 'resourceType': 'function', + 'resourceId': 'myAwesomeFunction',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.updateVariable( + '<SITE_ID>', + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteVariable()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await sites.deleteVariable( + '<SITE_ID>', + '<VARIABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/storage.test.js b/test/services/storage.test.js new file mode 100644 index 00000000..5b28529a --- /dev/null +++ b/test/services/storage.test.js @@ -0,0 +1,291 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Storage } = require("../../dist/services/storage"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Storage', () => { + const client = new Client(); + const storage = new Storage(client); + + + test('test method listBuckets()', async () => { + const data = { + 'total': 5, + 'buckets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.listBuckets( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createBucket()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.createBucket( + '<BUCKET_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getBucket()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.getBucket( + '<BUCKET_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateBucket()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'fileSecurity': true, + 'name': 'Documents', + 'enabled': true, + 'maximumFileSize': 100, + 'allowedFileExtensions': [], + 'compression': 'gzip', + 'encryption': true, + 'antivirus': true, + 'transformations': true, + 'totalSize': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.updateBucket( + '<BUCKET_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteBucket()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.deleteBucket( + '<BUCKET_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listFiles()', async () => { + const data = { + 'total': 5, + 'files': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.listFiles( + '<BUCKET_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createFile()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'sizeActual': 12345, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.createFile( + '<BUCKET_ID>', + '<FILE_ID>', + InputFile.fromBuffer(new Uint8Array(0), 'image.png'), + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getFile()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'sizeActual': 12345, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.getFile( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateFile()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'bucketId': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'name': 'Pink.png', + 'signature': '5d529fd02b544198ae075bd57c1762bb', + 'mimeType': 'image/png', + 'sizeOriginal': 17890, + 'sizeActual': 12345, + 'chunksTotal': 17890, + 'chunksUploaded': 17890, + 'encryption': true, + 'compression': 'gzip',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.updateFile( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteFile()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await storage.deleteFile( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getFileDownload()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await storage.getFileDownload( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getFilePreview()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await storage.getFilePreview( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getFileView()', async () => { + const data = new ArrayBuffer(0); + mockedFetch.mockImplementation(() => new Response(data)); + + const response = await storage.getFileView( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/tables-d-b.test.js b/test/services/tables-d-b.test.js new file mode 100644 index 00000000..5c89adc6 --- /dev/null +++ b/test/services/tables-d-b.test.js @@ -0,0 +1,1624 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { TablesDB } = require("../../dist/services/tables-db"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('TablesDB', () => { + const client = new Client(); + const tablesDB = new TablesDB(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'databases': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.create( + '<DATABASE_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listTransactions()', async () => { + const data = { + 'total': 5, + 'transactions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listTransactions( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTransaction()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createTransaction( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getTransaction()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getTransaction( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTransaction()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateTransaction( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteTransaction()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.deleteTransaction( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createOperations()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'status': 'pending', + 'operations': 5, + 'expiresAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createOperations( + '<TRANSACTION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.get( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + 'name': 'My Database', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'enabled': true, + 'type': 'legacy', + 'policies': [], + 'archives': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.update( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.delete( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listTables()', async () => { + const data = { + 'total': 5, + 'tables': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listTables( + '<DATABASE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createTable( + '<DATABASE_ID>', + '<TABLE_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getTable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getTable( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTable()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [], + 'databaseId': '5e5ea5c16897e', + 'name': 'My Table', + 'enabled': true, + 'rowSecurity': true, + 'columns': [], + 'indexes': [], + 'bytesMax': 65535, + 'bytesUsed': 1500,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateTable( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteTable()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.deleteTable( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listColumns()', async () => { + const data = { + 'total': 5, + 'columns': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listColumns( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createBigIntColumn()', async () => { + const data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createBigIntColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateBigIntColumn()', async () => { + const data = { + 'key': 'count', + 'type': 'bigint', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateBigIntColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createBooleanColumn()', async () => { + const data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createBooleanColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateBooleanColumn()', async () => { + const data = { + 'key': 'isEnabled', + 'type': 'boolean', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateBooleanColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createDatetimeColumn()', async () => { + const data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createDatetimeColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateDatetimeColumn()', async () => { + const data = { + 'key': 'birthDay', + 'type': 'datetime', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'datetime',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateDatetimeColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + '2020-10-15T06:38:00.000+00:00', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEmailColumn()', async () => { + const data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createEmailColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmailColumn()', async () => { + const data = { + 'key': 'userEmail', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'email',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateEmailColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + 'email@example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createEnumColumn()', async () => { + const data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createEnumColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + [], + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEnumColumn()', async () => { + const data = { + 'key': 'status', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'elements': [], + 'format': 'enum',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateEnumColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + [], + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createFloatColumn()', async () => { + const data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createFloatColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateFloatColumn()', async () => { + const data = { + 'key': 'percentageCompleted', + 'type': 'double', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateFloatColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + 1.0, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createIntegerColumn()', async () => { + const data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createIntegerColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateIntegerColumn()', async () => { + const data = { + 'key': 'count', + 'type': 'integer', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateIntegerColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createIpColumn()', async () => { + const data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createIpColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateIpColumn()', async () => { + const data = { + 'key': 'ipAddress', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'ip',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateIpColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createLineColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createLineColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLineColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateLineColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createLongtextColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createLongtextColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLongtextColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateLongtextColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMediumtextColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createMediumtextColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMediumtextColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateMediumtextColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPointColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createPointColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePointColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updatePointColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPolygonColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createPolygonColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePolygonColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updatePolygonColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createRelationshipColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedTable': 'table', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createRelationshipColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '<RELATED_TABLE_ID>', + 'oneToOne', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createStringColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createStringColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + 1, + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateStringColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateStringColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTextColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createTextColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTextColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateTextColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createUrlColumn()', async () => { + const data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createUrlColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateUrlColumn()', async () => { + const data = { + 'key': 'githubUrl', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'format': 'url',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateUrlColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + 'https://example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createVarcharColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createVarcharColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + 1, + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateVarcharColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateVarcharColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + true, + '<DEFAULT>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'size': 128,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteColumn()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.deleteColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateRelationshipColumn()', async () => { + const data = { + 'key': 'fullName', + 'type': 'string', + 'status': 'available', + 'error': 'string', + 'required': true, + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'relatedTable': 'table', + 'relationType': 'oneToOne|oneToMany|manyToOne|manyToMany', + 'twoWay': true, + 'twoWayKey': 'string', + 'onDelete': 'restrict|cascade|setNull', + 'side': 'parent|child',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateRelationshipColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listIndexes()', async () => { + const data = { + 'total': 5, + 'indexes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listIndexes( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createIndex()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'columns': [], + 'lengths': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createIndex( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + 'key', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getIndex()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'key': 'index1', + 'type': 'primary', + 'status': 'available', + 'error': 'string', + 'columns': [], + 'lengths': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getIndex( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteIndex()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.deleteIndex( + '<DATABASE_ID>', + '<TABLE_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listRows()', async () => { + const data = { + 'total': 5, + 'rows': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.listRows( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createRow()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createRow( + '<DATABASE_ID>', + '<TABLE_ID>', + '<ROW_ID>', + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createRows()', async () => { + const data = { + 'total': 5, + 'rows': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.createRows( + '<DATABASE_ID>', + '<TABLE_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method upsertRows()', async () => { + const data = { + 'total': 5, + 'rows': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.upsertRows( + '<DATABASE_ID>', + '<TABLE_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateRows()', async () => { + const data = { + 'total': 5, + 'rows': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateRows( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteRows()', async () => { + const data = { + 'total': 5, + 'rows': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.deleteRows( + '<DATABASE_ID>', + '<TABLE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getRow()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.getRow( + '<DATABASE_ID>', + '<TABLE_ID>', + '<ROW_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method upsertRow()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.upsertRow( + '<DATABASE_ID>', + '<TABLE_ID>', + '<ROW_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateRow()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.updateRow( + '<DATABASE_ID>', + '<TABLE_ID>', + '<ROW_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteRow()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.deleteRow( + '<DATABASE_ID>', + '<TABLE_ID>', + '<ROW_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method decrementRowColumn()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.decrementRowColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '<ROW_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method incrementRowColumn()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$sequence': '1', + '\$tableId': '5e5ea5c15117e', + '\$databaseId': '5e5ea5c15117e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + '\$permissions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tablesDB.incrementRowColumn( + '<DATABASE_ID>', + '<TABLE_ID>', + '<ROW_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/teams.test.js b/test/services/teams.test.js new file mode 100644 index 00000000..dcb4055b --- /dev/null +++ b/test/services/teams.test.js @@ -0,0 +1,282 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Teams } = require("../../dist/services/teams"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Teams', () => { + const client = new Client(); + const teams = new Teams(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'teams': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.create( + '<TEAM_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.get( + '<TEAM_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateName()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'VIP', + 'total': 7, + 'prefs': {},}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.updateName( + '<TEAM_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.delete( + '<TEAM_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMemberships()', async () => { + const data = { + 'total': 5, + 'memberships': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.listMemberships( + '<TEAM_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMembership()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.createMembership( + '<TEAM_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMembership()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.getMembership( + '<TEAM_ID>', + '<MEMBERSHIP_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMembership()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.updateMembership( + '<TEAM_ID>', + '<MEMBERSHIP_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMembership()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.deleteMembership( + '<TEAM_ID>', + '<MEMBERSHIP_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMembershipStatus()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c16897e', + 'userName': 'John Doe', + 'userEmail': 'john@appwrite.io', + 'userPhone': '+1 555 555 5555', + 'teamId': '5e5ea5c16897e', + 'teamName': 'VIP', + 'invited': '2020-10-15T06:38:00.000+00:00', + 'joined': '2020-10-15T06:38:00.000+00:00', + 'confirm': true, + 'mfa': true, + 'roles': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.updateMembershipStatus( + '<TEAM_ID>', + '<MEMBERSHIP_ID>', + '<USER_ID>', + '<SECRET>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getPrefs()', async () => { + const data = {}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.getPrefs( + '<TEAM_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePrefs()', async () => { + const data = {}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await teams.updatePrefs( + '<TEAM_ID>', + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/tokens.test.js b/test/services/tokens.test.js new file mode 100644 index 00000000..000f188e --- /dev/null +++ b/test/services/tokens.test.js @@ -0,0 +1,107 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Tokens } = require("../../dist/services/tokens"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Tokens', () => { + const client = new Client(); + const tokens = new Tokens(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'tokens': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tokens.list( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createFileToken()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tokens.createFileToken( + '<BUCKET_ID>', + '<FILE_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tokens.get( + '<TOKEN_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'resourceId': '5e5ea5c168bb8:5e5ea5c168bb8', + 'resourceType': 'files', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'secret': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tokens.update( + '<TOKEN_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await tokens.delete( + '<TOKEN_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/usage.test.js b/test/services/usage.test.js new file mode 100644 index 00000000..0d0428fc --- /dev/null +++ b/test/services/usage.test.js @@ -0,0 +1,42 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Usage } = require("../../dist/services/usage"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Usage', () => { + const client = new Client(); + const usage = new Usage(client); + + + test('test method listEvents()', async () => { + const data = { + 'total': 5, + 'events': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await usage.listEvents( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listGauges()', async () => { + const data = { + 'total': 5, + 'gauges': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await usage.listGauges( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/users.test.js b/test/services/users.test.js new file mode 100644 index 00000000..cb5441a2 --- /dev/null +++ b/test/services/users.test.js @@ -0,0 +1,1145 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Users } = require("../../dist/services/users"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Users', () => { + const client = new Client(); + const users = new Users(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'users': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.create( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createArgon2User()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createArgon2User( + '<USER_ID>', + 'email@example.com', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createBcryptUser()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createBcryptUser( + '<USER_ID>', + 'email@example.com', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listIdentities()', async () => { + const data = { + 'total': 5, + 'identities': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.listIdentities( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteIdentity()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.deleteIdentity( + '<IDENTITY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMD5User()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createMD5User( + '<USER_ID>', + 'email@example.com', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createPHPassUser()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createPHPassUser( + '<USER_ID>', + 'email@example.com', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createScryptUser()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createScryptUser( + '<USER_ID>', + 'email@example.com', + 'password', + '<PASSWORD_SALT>', + 1, + 1, + 1, + 1, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createScryptModifiedUser()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createScryptModifiedUser( + '<USER_ID>', + 'email@example.com', + 'password', + '<PASSWORD_SALT>', + '<PASSWORD_SALT_SEPARATOR>', + '<PASSWORD_SIGNER_KEY>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSHAUser()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createSHAUser( + '<USER_ID>', + 'email@example.com', + 'password', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.get( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.delete( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmail()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateEmail( + '<USER_ID>', + 'email@example.com', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateImpersonator()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateImpersonator( + '<USER_ID>', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createJWT()', async () => { + const data = { + 'jwt': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createJWT( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateLabels()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateLabels( + '<USER_ID>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listLogs()', async () => { + const data = { + 'total': 5, + 'logs': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.listLogs( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMemberships()', async () => { + const data = { + 'total': 5, + 'memberships': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.listMemberships( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMfa()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateMfa( + '<USER_ID>', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMFA()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateMFA( + '<USER_ID>', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMfaAuthenticator()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.deleteMfaAuthenticator( + '<USER_ID>', + 'totp', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteMFAAuthenticator()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.deleteMFAAuthenticator( + '<USER_ID>', + 'totp', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMfaFactors()', async () => { + const data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.listMfaFactors( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listMFAFactors()', async () => { + const data = { + 'totp': true, + 'phone': true, + 'email': true, + 'recoveryCode': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.listMFAFactors( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMfaRecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.getMfaRecoveryCodes( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getMFARecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.getMFARecoveryCodes( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMfaRecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateMfaRecoveryCodes( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateMFARecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateMFARecoveryCodes( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMfaRecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createMfaRecoveryCodes( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createMFARecoveryCodes()', async () => { + const data = { + 'recoveryCodes': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createMFARecoveryCodes( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateName()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateName( + '<USER_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePassword()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updatePassword( + '<USER_ID>', + '', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePhone()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updatePhone( + '<USER_ID>', + '+12065550100', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getPrefs()', async () => { + const data = {}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.getPrefs( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePrefs()', async () => { + const data = {}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updatePrefs( + '<USER_ID>', + {}, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listSessions()', async () => { + const data = { + 'total': 5, + 'sessions': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.listSessions( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createSession()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5bb8c16897e', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'provider': 'email', + 'providerUid': 'user@example.com', + 'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00', + 'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3', + 'ip': '127.0.0.1', + 'osCode': 'Mac', + 'osName': 'Mac', + 'osVersion': 'Mac', + 'clientType': 'browser', + 'clientCode': 'CM', + 'clientName': 'Chrome Mobile iOS', + 'clientVersion': '84.0', + 'clientEngine': 'WebKit', + 'clientEngineVersion': '605.1.15', + 'deviceName': 'smartphone', + 'deviceBrand': 'Google', + 'deviceModel': 'Nexus 5', + 'countryCode': 'US', + 'countryName': 'United States', + 'current': true, + 'factors': [], + 'secret': '5e5bb8c16897e', + 'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createSession( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteSessions()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.deleteSessions( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteSession()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.deleteSession( + '<USER_ID>', + '<SESSION_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateStatus()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateStatus( + '<USER_ID>', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listTargets()', async () => { + const data = { + 'total': 5, + 'targets': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.listTargets( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createTarget()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createTarget( + '<USER_ID>', + '<TARGET_ID>', + 'email', + '<IDENTIFIER>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getTarget()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.getTarget( + '<USER_ID>', + '<TARGET_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateTarget()', async () => { + const data = { + '\$id': '259125845563242502', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'Apple iPhone 12', + 'userId': '259125845563242502', + 'providerType': 'email', + 'identifier': 'token', + 'expired': true,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateTarget( + '<USER_ID>', + '<TARGET_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteTarget()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.deleteTarget( + '<USER_ID>', + '<TARGET_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createToken()', async () => { + const data = { + '\$id': 'bb8ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + 'userId': '5e5ea5c168bb8', + 'secret': '', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'phrase': 'Golden Fox',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.createToken( + '<USER_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateEmailVerification()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updateEmailVerification( + '<USER_ID>', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updatePhoneVerification()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'John Doe', + 'registration': '2020-10-15T06:38:00.000+00:00', + 'status': true, + 'labels': [], + 'passwordUpdate': '2020-10-15T06:38:00.000+00:00', + 'email': 'john@appwrite.io', + 'phone': '+4930901820', + 'emailVerification': true, + 'phoneVerification': true, + 'mfa': true, + 'prefs': {}, + 'targets': [], + 'accessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await users.updatePhoneVerification( + '<USER_ID>', + true, + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/webhooks.test.js b/test/services/webhooks.test.js new file mode 100644 index 00000000..01e7abd3 --- /dev/null +++ b/test/services/webhooks.test.js @@ -0,0 +1,155 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Webhooks } = require("../../dist/services/webhooks"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Webhooks', () => { + const client = new Client(); + const webhooks = new Webhooks(client); + + + test('test method list()', async () => { + const data = { + 'total': 5, + 'webhooks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await webhooks.list( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method create()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await webhooks.create( + '<WEBHOOK_ID>', + '', + '<NAME>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method get()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await webhooks.get( + '<WEBHOOK_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method update()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await webhooks.update( + '<WEBHOOK_ID>', + '<NAME>', + '', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method delete()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await webhooks.delete( + '<WEBHOOK_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateSecret()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My Webhook', + 'url': 'https://example.com/webhook', + 'events': [], + 'tls': true, + 'authUsername': 'username', + 'authPassword': 'password', + 'secret': 'ad3d581ca230e2b7059c545e5a', + 'enabled': true, + 'logs': 'Failed to connect to remote server.', + 'attempts': 10,}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await webhooks.updateSecret( + '<WEBHOOK_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..45afe7d2 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "esModuleInterop": true, + "skipLibCheck": true, + "target": "es2017", + "allowJs": true, + "resolveJsonModule": true, + "moduleDetection": "force", + "isolatedModules": true, + "strict": true, + "module": "es2022", + "moduleResolution": "Bundler", + "lib": ["es2022"] + }, + "compileOnSave": false, + "exclude": ["node_modules", "dist"], + "include": ["src"] +} \ No newline at end of file diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 00000000..d39e2c54 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,27 @@ +import { defineConfig, type Options } from "tsup"; +import { esbuildPluginFilePathExtensions } from "esbuild-plugin-file-path-extensions"; + +const commonConfig: Options = { + sourcemap: true, + clean: true, + dts: true, + treeshake: true, + target: "node16", + entry: ["src/**/*.ts"], + outDir: "dist", +}; + +export default defineConfig([ + { + ...commonConfig, + format: "esm", + esbuildPlugins: [esbuildPluginFilePathExtensions({ filter: /^\./ })], + bundle: true, + // Yes, bundle: true => https://github.com/favware/esbuild-plugin-file-path-extensions?tab=readme-ov-file#usage + }, + { + ...commonConfig, + format: "cjs", + bundle: false, + }, +]); From 856629fc18f90d69bb23ebdf9eee3acab02192a6 Mon Sep 17 00:00:00 2001 From: Appwrite Bot <team@appwrite.io> Date: Mon, 1 Jun 2026 08:21:17 +0000 Subject: [PATCH 3/3] test: masked secret push check --- CHANGELOG.md | 20 +- docs/examples/avatars/get-screenshot.md | 4 +- docs/examples/functions/create.md | 4 +- docs/examples/functions/update.md | 4 +- docs/examples/health/get-failed-jobs.md | 2 +- docs/examples/organization/create-key.md | 17 + docs/examples/organization/create-project.md | 16 + docs/examples/organization/delete-key.md | 14 + docs/examples/organization/delete-project.md | 14 + docs/examples/organization/get-key.md | 14 + docs/examples/organization/get-project.md | 14 + docs/examples/organization/list-keys.md | 15 + docs/examples/organization/list-projects.md | 16 + docs/examples/organization/update-key.md | 17 + docs/examples/organization/update-project.md | 15 + .../{update-presence.md => update.md} | 2 +- docs/examples/proxy/create-redirect-rule.md | 2 +- docs/examples/sites/create.md | 2 + docs/examples/sites/update.md | 2 + package-lock.json | 4 +- package.json | 2 +- src/client.ts | 251 +++++-- src/enums/backup-services.ts | 1 + src/enums/{theme.ts => browser-theme.ts} | 2 +- src/enums/build-runtime.ts | 5 +- src/enums/{name.ts => health-queue-name.ts} | 2 +- src/enums/organization-key-scopes.ts | 12 + src/enums/project-o-auth-provider-id.ts | 2 - src/enums/project-policy-id.ts | 3 + src/enums/region.ts | 8 + src/enums/runtime.ts | 5 +- src/enums/scopes.ts | 96 --- src/enums/status-code.ts | 8 +- src/index.ts | 10 +- src/models.ts | 159 +++-- src/services/avatars.ts | 20 +- src/services/functions.ts | 78 ++- src/services/health.ts | 18 +- src/services/organization.ts | 644 ++++++++++++++++++ src/services/presences.ts | 48 +- src/services/project.ts | 210 +++--- src/services/sites.ts | 64 +- src/services/usage.ts | 4 +- test/services/activities.test.js | 8 +- test/services/functions.test.js | 8 + test/services/organization.test.js | 265 +++++++ test/services/presences.test.js | 4 +- test/services/project.test.js | 90 ++- test/services/sites.test.js | 8 + 49 files changed, 1769 insertions(+), 464 deletions(-) create mode 100644 docs/examples/organization/create-key.md create mode 100644 docs/examples/organization/create-project.md create mode 100644 docs/examples/organization/delete-key.md create mode 100644 docs/examples/organization/delete-project.md create mode 100644 docs/examples/organization/get-key.md create mode 100644 docs/examples/organization/get-project.md create mode 100644 docs/examples/organization/list-keys.md create mode 100644 docs/examples/organization/list-projects.md create mode 100644 docs/examples/organization/update-key.md create mode 100644 docs/examples/organization/update-project.md rename docs/examples/presences/{update-presence.md => update.md} (92%) rename src/enums/{theme.ts => browser-theme.ts} (60%) rename src/enums/{name.ts => health-queue-name.ts} (93%) create mode 100644 src/enums/organization-key-scopes.ts create mode 100644 src/enums/region.ts delete mode 100644 src/enums/scopes.ts create mode 100644 src/services/organization.ts create mode 100644 test/services/organization.test.js diff --git a/CHANGELOG.md b/CHANGELOG.md index a47aa7fc..ad6fd074 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,19 @@ # Change Log -## 25.1.0 - -* Added `sizeActual` property to file model for actual stored size after compression -* Added `Deno121`, `Deno124`, and `Deno135` runtime options to `BuildRuntime` and `Runtime` enums -* Updated advisor authentication examples to use API key instead of session -* Updated billing limits properties to be optional in project models +## 26.0.0 + +* Breaking: Removed generic type parameters from `presences` service methods +* Breaking: Removed `githubImagine` and `googleImagine` from `ProjectOAuthProviderId` +* Breaking: Removed `deno-1.21`, `deno-1.24`, and `deno-1.35` from `Runtime` and `BuildRuntime` +* Breaking: Dropped numeric suffixes from `StatusCode` redirect members +* Added: `Organization` service for managing projects and API keys +* Added: `PolicyDenyAliasedEmail`, `PolicyDenyDisposableEmail`, and `PolicyDenyFreeEmail` policy models +* Added: `deny-aliased-email`, `deny-disposable-email`, and `deny-free-email` to `ProjectPolicyId` +* Added: `BrowserTheme`, `HealthQueueName`, `OrganizationKeyScopes`, and `Region` enums +* Added: `dart-3.12` and `flutter-3.44` runtimes +* Added: `ProjectList` model and new attributes on `Function`, `Site`, and `UsageGauge` +* Updated: `functions`, `sites`, `usage`, `health`, and `avatars` services +* Updated: Renamed `updatePresence` to `update` in the `presences` service ## 25.0.0 diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 1aab6cd3..d83f24ab 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -17,11 +17,11 @@ const result = await avatars.getScreenshot({ viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: sdk.Theme.Dark, // optional + theme: sdk.BrowserTheme.Dark, // optional userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional fullpage: true, // optional locale: 'en-US', // optional - timezone: sdk.Timezone.AmericaNewYork, // optional + timezone: sdk.Timezone.AfricaAbidjan, // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 4e3d5e95..cb9c3e8c 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -20,12 +20,14 @@ const result = await functions.create({ logging: false, // optional entrypoint: '<ENTRYPOINT>', // optional commands: '<COMMANDS>', // optional - scopes: [sdk.Scopes.ProjectRead], // optional + scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional installationId: '<INSTALLATION_ID>', // optional providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional providerBranch: '<PROVIDER_BRANCH>', // optional providerSilentMode: false, // optional providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + providerBranches: [], // optional + providerPaths: [], // optional buildSpecification: '', // optional runtimeSpecification: '', // optional deploymentRetention: 0 // optional diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index fe60cad3..7d64aa26 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -20,12 +20,14 @@ const result = await functions.update({ logging: false, // optional entrypoint: '<ENTRYPOINT>', // optional commands: '<COMMANDS>', // optional - scopes: [sdk.Scopes.ProjectRead], // optional + scopes: [sdk.ProjectKeyScopes.ProjectRead], // optional installationId: '<INSTALLATION_ID>', // optional providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional providerBranch: '<PROVIDER_BRANCH>', // optional providerSilentMode: false, // optional providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + providerBranches: [], // optional + providerPaths: [], // optional buildSpecification: '', // optional runtimeSpecification: '', // optional deploymentRetention: 0 // optional diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index e495453c..3f41e638 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -9,7 +9,7 @@ const client = new sdk.Client() const health = new sdk.Health(client); const result = await health.getFailedJobs({ - name: sdk.Name.V1Database, + name: sdk.HealthQueueName.V1Database, threshold: null // optional }); ``` diff --git a/docs/examples/organization/create-key.md b/docs/examples/organization/create-key.md new file mode 100644 index 00000000..b4e06acf --- /dev/null +++ b/docs/examples/organization/create-key.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.createKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [sdk.OrganizationKeyScopes.ProjectsRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/organization/create-project.md b/docs/examples/organization/create-project.md new file mode 100644 index 00000000..0c4547c5 --- /dev/null +++ b/docs/examples/organization/create-project.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.createProject({ + projectId: '', + name: '<NAME>', + region: sdk.Region.Fra // optional +}); +``` diff --git a/docs/examples/organization/delete-key.md b/docs/examples/organization/delete-key.md new file mode 100644 index 00000000..c3bce992 --- /dev/null +++ b/docs/examples/organization/delete-key.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.deleteKey({ + keyId: '<KEY_ID>' +}); +``` diff --git a/docs/examples/organization/delete-project.md b/docs/examples/organization/delete-project.md new file mode 100644 index 00000000..01b3b845 --- /dev/null +++ b/docs/examples/organization/delete-project.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.deleteProject({ + projectId: '<PROJECT_ID>' +}); +``` diff --git a/docs/examples/organization/get-key.md b/docs/examples/organization/get-key.md new file mode 100644 index 00000000..13317b6a --- /dev/null +++ b/docs/examples/organization/get-key.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.getKey({ + keyId: '<KEY_ID>' +}); +``` diff --git a/docs/examples/organization/get-project.md b/docs/examples/organization/get-project.md new file mode 100644 index 00000000..85576d62 --- /dev/null +++ b/docs/examples/organization/get-project.md @@ -0,0 +1,14 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.getProject({ + projectId: '<PROJECT_ID>' +}); +``` diff --git a/docs/examples/organization/list-keys.md b/docs/examples/organization/list-keys.md new file mode 100644 index 00000000..61348e5a --- /dev/null +++ b/docs/examples/organization/list-keys.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.listKeys({ + queries: [], // optional + total: false // optional +}); +``` diff --git a/docs/examples/organization/list-projects.md b/docs/examples/organization/list-projects.md new file mode 100644 index 00000000..fa7f9c00 --- /dev/null +++ b/docs/examples/organization/list-projects.md @@ -0,0 +1,16 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.listProjects({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); +``` diff --git a/docs/examples/organization/update-key.md b/docs/examples/organization/update-key.md new file mode 100644 index 00000000..ade0116e --- /dev/null +++ b/docs/examples/organization/update-key.md @@ -0,0 +1,17 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.updateKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [sdk.OrganizationKeyScopes.ProjectsRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); +``` diff --git a/docs/examples/organization/update-project.md b/docs/examples/organization/update-project.md new file mode 100644 index 00000000..f457ec2e --- /dev/null +++ b/docs/examples/organization/update-project.md @@ -0,0 +1,15 @@ +```javascript +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const organization = new sdk.Organization(client); + +const result = await organization.updateProject({ + projectId: '<PROJECT_ID>', + name: '<NAME>' +}); +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update.md similarity index 92% rename from docs/examples/presences/update-presence.md rename to docs/examples/presences/update.md index ffb1272f..0056a50c 100644 --- a/docs/examples/presences/update-presence.md +++ b/docs/examples/presences/update.md @@ -8,7 +8,7 @@ const client = new sdk.Client() const presences = new sdk.Presences(client); -const result = await presences.updatePresence({ +const result = await presences.update({ presenceId: '<PRESENCE_ID>', userId: '<USER_ID>', status: '<STATUS>', // optional diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md index 0f33abd6..bb028c15 100644 --- a/docs/examples/proxy/create-redirect-rule.md +++ b/docs/examples/proxy/create-redirect-rule.md @@ -11,7 +11,7 @@ const proxy = new sdk.Proxy(client); const result = await proxy.createRedirectRule({ domain: '', url: 'https://example.com', - statusCode: sdk.StatusCode.MovedPermanently301, + statusCode: sdk.StatusCode.MovedPermanently, resourceId: '<RESOURCE_ID>', resourceType: sdk.ProxyResourceType.Site }); diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 65e5c64c..dc4e3ef7 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -27,6 +27,8 @@ const result = await sites.create({ providerBranch: '<PROVIDER_BRANCH>', // optional providerSilentMode: false, // optional providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + providerBranches: [], // optional + providerPaths: [], // optional buildSpecification: '', // optional runtimeSpecification: '', // optional deploymentRetention: 0 // optional diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 0411752f..30928f1d 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -27,6 +27,8 @@ const result = await sites.update({ providerBranch: '<PROVIDER_BRANCH>', // optional providerSilentMode: false, // optional providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + providerBranches: [], // optional + providerPaths: [], // optional buildSpecification: '', // optional runtimeSpecification: '', // optional deploymentRetention: 0 // optional diff --git a/package-lock.json b/package-lock.json index fa96a4ec..d7778205 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "node-appwrite", - "version": "25.1.0", + "version": "26.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "node-appwrite", - "version": "25.1.0", + "version": "26.0.0", "dependencies": { "json-bigint": "1.0.0", "node-fetch-native-with-agent": "1.7.2" diff --git a/package.json b/package.json index 6b06e984..3f5d760e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "node-appwrite", "homepage": "https://appwrite.io/support", "description": "Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API", - "version": "25.1.0", + "version": "26.0.0", "license": "BSD-3-Clause", "main": "dist/index.js", "type": "commonjs", diff --git a/src/client.ts b/src/client.ts index 37bb016a..f9de6718 100644 --- a/src/client.ts +++ b/src/client.ts @@ -74,7 +74,7 @@ class AppwriteException extends Error { } function getUserAgent() { - let ua = 'AppwriteNodeJSSDK/25.1.0'; + let ua = 'AppwriteNodeJSSDK/26.0.0'; // `process` is a global in Node.js, but not fully available in all runtimes. const platform: string[] = []; @@ -128,7 +128,7 @@ class Client { 'x-sdk-name': 'Node.js', 'x-sdk-platform': 'server', 'x-sdk-language': 'nodejs', - 'x-sdk-version': '25.1.0', + 'x-sdk-version': '26.0.0', 'user-agent' : getUserAgent(), 'X-Appwrite-Response-Format': '1.9.5', }; @@ -415,85 +415,235 @@ class Client { return await this.call(method, url, headers, payload); } - let start = 0; - let response = null; + const totalChunks = Math.ceil(size / Client.CHUNK_SIZE); - while (start < size) { - let end = start + Client.CHUNK_SIZE; - if (end >= size) { - end = size; - } + // Upload first chunk alone to get the upload ID + const firstChunkEnd = Math.min(Client.CHUNK_SIZE, size); + const firstChunkHeaders = { ...headers, 'content-range': `bytes 0-${firstChunkEnd - 1}/${size}` }; + const firstChunk = await file.slice(0, firstChunkEnd); + const firstPayload = { ...originalPayload }; + firstPayload[fileParam] = new File([firstChunk], file.filename); - headers['content-range'] = `bytes ${start}-${end - 1}/${size}`; - const chunk = await file.slice(start, end); + let response = await this.call(method, url, firstChunkHeaders, firstPayload); + const uploadId = response?.$id; - const payload = { ...originalPayload }; - payload[fileParam] = new File([chunk], file.filename); + if (onProgress && typeof onProgress === 'function') { + onProgress({ + $id: uploadId, + progress: Math.round((firstChunkEnd / size) * 100), + sizeUploaded: firstChunkEnd, + chunksTotal: totalChunks, + chunksUploaded: 1 + }); + } + + if (totalChunks === 1) { + return response; + } + + // Prepare remaining chunks + const chunks: { start: number; end: number }[] = []; + for (let i = 1; i < totalChunks; i++) { + const start = i * Client.CHUNK_SIZE; + const end = Math.min(start + Client.CHUNK_SIZE, size); + chunks.push({ start, end }); + } - response = await this.call(method, url, headers, payload); + // Upload remaining chunks with max concurrency of 8 + const CONCURRENCY = 8; + let completedCount = 1; + let uploadedBytes = firstChunkEnd; + let lastResponse = response; + let finalResponse = null; + let failed = false; + + const isUploadComplete = (chunkResponse: any) => { + const chunksUploaded = chunkResponse?.chunksUploaded; + const chunksTotal = chunkResponse?.chunksTotal ?? totalChunks; + return typeof chunksUploaded === 'number' && typeof chunksTotal === 'number' && chunksUploaded >= chunksTotal; + }; + + const uploadChunk = async (chunk: typeof chunks[0]) => { + const chunkHeaders = { ...headers }; + if (uploadId) { + chunkHeaders['x-appwrite-id'] = uploadId; + } + chunkHeaders['content-range'] = `bytes ${chunk.start}-${chunk.end - 1}/${size}`; + + const chunkBlob = await file.slice(chunk.start, chunk.end); + const chunkPayload = { ...originalPayload }; + chunkPayload[fileParam] = new File([chunkBlob], file.filename); + + const chunkResponse = await this.call(method, url, chunkHeaders, chunkPayload); + + if (failed) { + return chunkResponse; + } + + completedCount++; + uploadedBytes += (chunk.end - chunk.start); + + lastResponse = chunkResponse; + if (isUploadComplete(chunkResponse)) { + finalResponse = chunkResponse; + } if (onProgress && typeof onProgress === 'function') { onProgress({ - $id: response.$id, - progress: Math.round((end / size) * 100), - sizeUploaded: end, - chunksTotal: Math.ceil(size / Client.CHUNK_SIZE), - chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) + $id: uploadId, + progress: Math.round((uploadedBytes / size) * 100), + sizeUploaded: uploadedBytes, + chunksTotal: totalChunks, + chunksUploaded: completedCount }); } - if (response && response.$id) { - headers['x-appwrite-id'] = response.$id; - } + return chunkResponse; + }; - start = end; + // Process with limited concurrency using a worker pool + const queue = [...chunks]; + const workers: Promise<void>[] = []; + const workerCount = Math.min(CONCURRENCY, queue.length); + + for (let i = 0; i < workerCount; i++) { + workers.push( + (async () => { + while (!failed && queue.length > 0) { + const chunk = queue.shift()!; + try { + await uploadChunk(chunk); + } catch (error) { + failed = true; + throw error; + } + } + })() + ); } - return response; + await Promise.all(workers); + + return finalResponse ?? lastResponse; } if (file.size <= Client.CHUNK_SIZE) { return await this.call(method, url, headers, originalPayload); } - let start = 0; - let response = null; + const totalChunks = Math.ceil(file.size / Client.CHUNK_SIZE); + + // Upload first chunk alone to get the upload ID + const firstChunkEnd = Math.min(Client.CHUNK_SIZE, file.size); + const firstChunkHeaders = { ...headers, 'content-range': `bytes 0-${firstChunkEnd - 1}/${file.size}` }; + const firstChunk = file.slice(0, firstChunkEnd); + const firstPayload = { ...originalPayload }; + firstPayload[fileParam] = new File([firstChunk], file.name); + + let response = await this.call(method, url, firstChunkHeaders, firstPayload); + const uploadId = response?.$id; + + if (onProgress && typeof onProgress === 'function') { + onProgress({ + $id: uploadId, + progress: Math.round((firstChunkEnd / file.size) * 100), + sizeUploaded: firstChunkEnd, + chunksTotal: totalChunks, + chunksUploaded: 1 + }); + } - while (start < file.size) { - let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk - if (end >= file.size) { - end = file.size; // Adjust for the last chunk to include the last byte - } + if (totalChunks === 1) { + return response; + } - headers['content-range'] = `bytes ${start}-${end-1}/${file.size}`; - const chunk = file.slice(start, end); + // Prepare remaining chunks + const chunks: { start: number; end: number }[] = []; + for (let i = 1; i < totalChunks; i++) { + const start = i * Client.CHUNK_SIZE; + const end = Math.min(start + Client.CHUNK_SIZE, file.size); + chunks.push({ start, end }); + } - let payload = { ...originalPayload }; - payload[fileParam] = new File([chunk], file.name); + // Upload remaining chunks with max concurrency of 8 + const CONCURRENCY = 8; + let completedCount = 1; + let uploadedBytes = firstChunkEnd; + let lastResponse = response; + let finalResponse = null; + let failed = false; + + const isUploadComplete = (chunkResponse: any) => { + const chunksUploaded = chunkResponse?.chunksUploaded; + const chunksTotal = chunkResponse?.chunksTotal ?? totalChunks; + return typeof chunksUploaded === 'number' && typeof chunksTotal === 'number' && chunksUploaded >= chunksTotal; + }; - response = await this.call(method, url, headers, payload); + const uploadChunk = async (chunk: typeof chunks[0]) => { + const chunkHeaders = { ...headers }; + if (uploadId) { + chunkHeaders['x-appwrite-id'] = uploadId; + } + chunkHeaders['content-range'] = `bytes ${chunk.start}-${chunk.end - 1}/${file.size}`; + + const chunkBlob = file.slice(chunk.start, chunk.end); + const chunkPayload = { ...originalPayload }; + chunkPayload[fileParam] = new File([chunkBlob], file.name); + + const chunkResponse = await this.call(method, url, chunkHeaders, chunkPayload); + + if (failed) { + return chunkResponse; + } + + completedCount++; + uploadedBytes += (chunk.end - chunk.start); + + lastResponse = chunkResponse; + if (isUploadComplete(chunkResponse)) { + finalResponse = chunkResponse; + } if (onProgress && typeof onProgress === 'function') { onProgress({ - $id: response.$id, - progress: Math.round((end / file.size) * 100), - sizeUploaded: end, - chunksTotal: Math.ceil(file.size / Client.CHUNK_SIZE), - chunksUploaded: Math.ceil(end / Client.CHUNK_SIZE) + $id: uploadId, + progress: Math.round((uploadedBytes / file.size) * 100), + sizeUploaded: uploadedBytes, + chunksTotal: totalChunks, + chunksUploaded: completedCount }); } - if (response && response.$id) { - headers['x-appwrite-id'] = response.$id; - } + return chunkResponse; + }; - start = end; + // Process with limited concurrency using a worker pool + const queue = [...chunks]; + const workers: Promise<void>[] = []; + const workerCount = Math.min(CONCURRENCY, queue.length); + + for (let i = 0; i < workerCount; i++) { + workers.push( + (async () => { + while (!failed && queue.length > 0) { + const chunk = queue.shift()!; + try { + await uploadChunk(chunk); + } catch (error) { + failed = true; + throw error; + } + } + })() + ); } - return response; + await Promise.all(workers); + + return finalResponse ?? lastResponse; } - async ping(): Promise<string> { + async ping(): Promise<unknown> { return this.call('GET', new URL(this.config.endpoint + '/ping')); } @@ -545,7 +695,12 @@ class Client { } if (data && typeof data === 'object') { - data.toString = () => JSONbig.stringify(data); + Object.defineProperty(data, 'toString', { + value: () => JSONbig.stringify(data), + writable: true, + enumerable: false, + configurable: true, + }); } return data; diff --git a/src/enums/backup-services.ts b/src/enums/backup-services.ts index bd0582ce..adef40d2 100644 --- a/src/enums/backup-services.ts +++ b/src/enums/backup-services.ts @@ -3,6 +3,7 @@ export enum BackupServices { Tablesdb = 'tablesdb', Documentsdb = 'documentsdb', Vectorsdb = 'vectorsdb', + DedicatedDatabases = 'dedicatedDatabases', Functions = 'functions', Storage = 'storage', } \ No newline at end of file diff --git a/src/enums/theme.ts b/src/enums/browser-theme.ts similarity index 60% rename from src/enums/theme.ts rename to src/enums/browser-theme.ts index 5e823a9b..9f8c382a 100644 --- a/src/enums/theme.ts +++ b/src/enums/browser-theme.ts @@ -1,4 +1,4 @@ -export enum Theme { +export enum BrowserTheme { Light = 'light', Dark = 'dark', } \ No newline at end of file diff --git a/src/enums/build-runtime.ts b/src/enums/build-runtime.ts index dddeeb2b..6c0f0008 100644 --- a/src/enums/build-runtime.ts +++ b/src/enums/build-runtime.ts @@ -30,9 +30,6 @@ export enum BuildRuntime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', @@ -51,6 +48,7 @@ export enum BuildRuntime { Dart39 = 'dart-3.9', Dart310 = 'dart-3.10', Dart311 = 'dart-3.11', + Dart312 = 'dart-3.12', Dotnet60 = 'dotnet-6.0', Dotnet70 = 'dotnet-7.0', Dotnet80 = 'dotnet-8.0', @@ -91,4 +89,5 @@ export enum BuildRuntime { Flutter335 = 'flutter-3.35', Flutter338 = 'flutter-3.38', Flutter341 = 'flutter-3.41', + Flutter344 = 'flutter-3.44', } \ No newline at end of file diff --git a/src/enums/name.ts b/src/enums/health-queue-name.ts similarity index 93% rename from src/enums/name.ts rename to src/enums/health-queue-name.ts index 8cd297bc..81320f8d 100644 --- a/src/enums/name.ts +++ b/src/enums/health-queue-name.ts @@ -1,4 +1,4 @@ -export enum Name { +export enum HealthQueueName { V1database = 'v1-database', V1deletes = 'v1-deletes', V1audits = 'v1-audits', diff --git a/src/enums/organization-key-scopes.ts b/src/enums/organization-key-scopes.ts new file mode 100644 index 00000000..05c96d22 --- /dev/null +++ b/src/enums/organization-key-scopes.ts @@ -0,0 +1,12 @@ +export enum OrganizationKeyScopes { + ProjectsRead = 'projects.read', + ProjectsWrite = 'projects.write', + DevKeysRead = 'devKeys.read', + DevKeysWrite = 'devKeys.write', + OrganizationKeysRead = 'organization.keys.read', + OrganizationKeysWrite = 'organization.keys.write', + DomainsRead = 'domains.read', + DomainsWrite = 'domains.write', + KeysRead = 'keys.read', + KeysWrite = 'keys.write', +} \ No newline at end of file diff --git a/src/enums/project-o-auth-provider-id.ts b/src/enums/project-o-auth-provider-id.ts index e35d6ef0..e1ed1b85 100644 --- a/src/enums/project-o-auth-provider-id.ts +++ b/src/enums/project-o-auth-provider-id.ts @@ -42,6 +42,4 @@ export enum ProjectOAuthProviderId { Yandex = 'yandex', Zoho = 'zoho', Zoom = 'zoom', - GithubImagine = 'githubImagine', - GoogleImagine = 'googleImagine', } \ No newline at end of file diff --git a/src/enums/project-policy-id.ts b/src/enums/project-policy-id.ts index 2031ce9b..3e2eceec 100644 --- a/src/enums/project-policy-id.ts +++ b/src/enums/project-policy-id.ts @@ -8,4 +8,7 @@ export enum ProjectPolicyId { Sessionlimit = 'session-limit', Userlimit = 'user-limit', Membershipprivacy = 'membership-privacy', + Denyaliasedemail = 'deny-aliased-email', + Denydisposableemail = 'deny-disposable-email', + Denyfreeemail = 'deny-free-email', } \ No newline at end of file diff --git a/src/enums/region.ts b/src/enums/region.ts new file mode 100644 index 00000000..948dd0b8 --- /dev/null +++ b/src/enums/region.ts @@ -0,0 +1,8 @@ +export enum Region { + Fra = 'fra', + Nyc = 'nyc', + Syd = 'syd', + Sfo = 'sfo', + Sgp = 'sgp', + Tor = 'tor', +} \ No newline at end of file diff --git a/src/enums/runtime.ts b/src/enums/runtime.ts index a2b22ef0..40616625 100644 --- a/src/enums/runtime.ts +++ b/src/enums/runtime.ts @@ -30,9 +30,6 @@ export enum Runtime { Pythonml311 = 'python-ml-3.11', Pythonml312 = 'python-ml-3.12', Pythonml313 = 'python-ml-3.13', - Deno121 = 'deno-1.21', - Deno124 = 'deno-1.24', - Deno135 = 'deno-1.35', Deno140 = 'deno-1.40', Deno146 = 'deno-1.46', Deno20 = 'deno-2.0', @@ -51,6 +48,7 @@ export enum Runtime { Dart39 = 'dart-3.9', Dart310 = 'dart-3.10', Dart311 = 'dart-3.11', + Dart312 = 'dart-3.12', Dotnet60 = 'dotnet-6.0', Dotnet70 = 'dotnet-7.0', Dotnet80 = 'dotnet-8.0', @@ -91,4 +89,5 @@ export enum Runtime { Flutter335 = 'flutter-3.35', Flutter338 = 'flutter-3.38', Flutter341 = 'flutter-3.41', + Flutter344 = 'flutter-3.44', } \ No newline at end of file diff --git a/src/enums/scopes.ts b/src/enums/scopes.ts deleted file mode 100644 index 54e9cb31..00000000 --- a/src/enums/scopes.ts +++ /dev/null @@ -1,96 +0,0 @@ -export enum Scopes { - ProjectRead = 'project.read', - ProjectWrite = 'project.write', - KeysRead = 'keys.read', - KeysWrite = 'keys.write', - PlatformsRead = 'platforms.read', - PlatformsWrite = 'platforms.write', - MocksRead = 'mocks.read', - MocksWrite = 'mocks.write', - PoliciesRead = 'policies.read', - PoliciesWrite = 'policies.write', - ProjectPoliciesRead = 'project.policies.read', - ProjectPoliciesWrite = 'project.policies.write', - TemplatesRead = 'templates.read', - TemplatesWrite = 'templates.write', - Oauth2Read = 'oauth2.read', - Oauth2Write = 'oauth2.write', - UsersRead = 'users.read', - UsersWrite = 'users.write', - SessionsRead = 'sessions.read', - SessionsWrite = 'sessions.write', - TeamsRead = 'teams.read', - TeamsWrite = 'teams.write', - DatabasesRead = 'databases.read', - DatabasesWrite = 'databases.write', - TablesRead = 'tables.read', - TablesWrite = 'tables.write', - ColumnsRead = 'columns.read', - ColumnsWrite = 'columns.write', - IndexesRead = 'indexes.read', - IndexesWrite = 'indexes.write', - RowsRead = 'rows.read', - RowsWrite = 'rows.write', - CollectionsRead = 'collections.read', - CollectionsWrite = 'collections.write', - AttributesRead = 'attributes.read', - AttributesWrite = 'attributes.write', - DocumentsRead = 'documents.read', - DocumentsWrite = 'documents.write', - BucketsRead = 'buckets.read', - BucketsWrite = 'buckets.write', - FilesRead = 'files.read', - FilesWrite = 'files.write', - TokensRead = 'tokens.read', - TokensWrite = 'tokens.write', - FunctionsRead = 'functions.read', - FunctionsWrite = 'functions.write', - ExecutionsRead = 'executions.read', - ExecutionsWrite = 'executions.write', - ExecutionRead = 'execution.read', - ExecutionWrite = 'execution.write', - SitesRead = 'sites.read', - SitesWrite = 'sites.write', - LogRead = 'log.read', - LogWrite = 'log.write', - ProvidersRead = 'providers.read', - ProvidersWrite = 'providers.write', - TopicsRead = 'topics.read', - TopicsWrite = 'topics.write', - SubscribersRead = 'subscribers.read', - SubscribersWrite = 'subscribers.write', - TargetsRead = 'targets.read', - TargetsWrite = 'targets.write', - MessagesRead = 'messages.read', - MessagesWrite = 'messages.write', - RulesRead = 'rules.read', - RulesWrite = 'rules.write', - WebhooksRead = 'webhooks.read', - WebhooksWrite = 'webhooks.write', - LocaleRead = 'locale.read', - AvatarsRead = 'avatars.read', - HealthRead = 'health.read', - AssistantRead = 'assistant.read', - MigrationsRead = 'migrations.read', - MigrationsWrite = 'migrations.write', - SchedulesRead = 'schedules.read', - SchedulesWrite = 'schedules.write', - VcsRead = 'vcs.read', - VcsWrite = 'vcs.write', - InsightsRead = 'insights.read', - InsightsWrite = 'insights.write', - ReportsRead = 'reports.read', - ReportsWrite = 'reports.write', - PresencesRead = 'presences.read', - PresencesWrite = 'presences.write', - BackupsPoliciesRead = 'backups.policies.read', - BackupsPoliciesWrite = 'backups.policies.write', - ArchivesRead = 'archives.read', - ArchivesWrite = 'archives.write', - RestorationsRead = 'restorations.read', - RestorationsWrite = 'restorations.write', - DomainsRead = 'domains.read', - DomainsWrite = 'domains.write', - EventsRead = 'events.read', - UsageRead = 'usage.read', -} \ No newline at end of file diff --git a/src/enums/status-code.ts b/src/enums/status-code.ts index 1f3adf8b..425d65c3 100644 --- a/src/enums/status-code.ts +++ b/src/enums/status-code.ts @@ -1,6 +1,6 @@ export enum StatusCode { - MovedPermanently301 = '301', - Found302 = '302', - TemporaryRedirect307 = '307', - PermanentRedirect308 = '308', + MovedPermanently = '301', + Found = '302', + TemporaryRedirect = '307', + PermanentRedirect = '308', } \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 1932e75b..6e11f54e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,6 +9,7 @@ export { Graphql } from './services/graphql'; export { Health } from './services/health'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; +export { Organization } from './services/organization'; export { Presences } from './services/presences'; export { Project } from './services/project'; export { Proxy } from './services/proxy'; @@ -33,7 +34,7 @@ export { OAuthProvider } from './enums/o-auth-provider'; export { Browser } from './enums/browser'; export { CreditCard } from './enums/credit-card'; export { Flag } from './enums/flag'; -export { Theme } from './enums/theme'; +export { BrowserTheme } from './enums/browser-theme'; export { Timezone } from './enums/timezone'; export { BrowserPermission } from './enums/browser-permission'; export { ImageFormat } from './enums/image-format'; @@ -43,16 +44,17 @@ export { RelationMutate } from './enums/relation-mutate'; export { DatabasesIndexType } from './enums/databases-index-type'; export { OrderBy } from './enums/order-by'; export { Runtime } from './enums/runtime'; -export { Scopes } from './enums/scopes'; +export { ProjectKeyScopes } from './enums/project-key-scopes'; export { TemplateReferenceType } from './enums/template-reference-type'; export { VCSReferenceType } from './enums/vcs-reference-type'; export { DeploymentDownloadType } from './enums/deployment-download-type'; export { ExecutionMethod } from './enums/execution-method'; -export { Name } from './enums/name'; +export { HealthQueueName } from './enums/health-queue-name'; export { MessagePriority } from './enums/message-priority'; export { SmtpEncryption } from './enums/smtp-encryption'; +export { OrganizationKeyScopes } from './enums/organization-key-scopes'; +export { Region } from './enums/region'; export { ProjectAuthMethodId } from './enums/project-auth-method-id'; -export { ProjectKeyScopes } from './enums/project-key-scopes'; export { ProjectOAuth2GooglePrompt } from './enums/project-o-auth-2-google-prompt'; export { ProjectOAuthProviderId } from './enums/project-o-auth-provider-id'; export { ProjectPolicyId } from './enums/project-policy-id'; diff --git a/src/models.ts b/src/models.ts index de934950..95e661a6 100644 --- a/src/models.ts +++ b/src/models.ts @@ -54,7 +54,7 @@ export namespace Models { /** * Presences List */ - export type PresenceList<Presence extends Models.Presence = Models.DefaultPresence> = { + export type PresenceList = { /** * Total number of presences that matched your query. */ @@ -345,6 +345,20 @@ export namespace Models { executions: Execution[]; } + /** + * Projects List + */ + export type ProjectList = { + /** + * Total number of projects that matched your query. + */ + total: number; + /** + * List of projects. + */ + projects: Project[]; + } + /** * Webhooks List */ @@ -482,7 +496,7 @@ export namespace Models { /** * List of policies. */ - policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy)[]; + policies: (Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail)[]; } /** @@ -2751,13 +2765,12 @@ export namespace Models { * Presence expiry date in ISO 8601 format. */ expiresAt?: string; + /** + * Presence metadata. + */ + metadata?: object; } - export type DefaultPresence = Presence & { - [key: string]: any; - [__default]: true; - }; - /** * Log */ @@ -3681,6 +3694,14 @@ export namespace Models { * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests */ providerSilentMode: boolean; + /** + * List of branch name patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all branches. + */ + providerBranches: string[]; + /** + * List of file path patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all file changes. + */ + providerPaths: string[]; /** * Machine specification for deployment builds. */ @@ -3819,6 +3840,14 @@ export namespace Models { * Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests */ providerSilentMode: boolean; + /** + * List of branch name patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all branches. + */ + providerBranches: string[]; + /** + * List of file path patterns that trigger automatic deployments. Supports glob wildcards. Empty list deploys on all file changes. + */ + providerPaths: string[]; /** * Machine specification for deployment builds. */ @@ -6578,21 +6607,21 @@ export namespace Models { */ $id: string; /** - * User type. + * Actor type. */ - userType: string; + actorType: string; /** - * User ID. + * Actor ID. */ - userId: string; + actorId: string; /** - * User Email. + * Actor Email. */ - userEmail: string; + actorEmail: string; /** - * User Name. + * Actor Name. */ - userName: string; + actorName: string; /** * Resource parent. */ @@ -6758,7 +6787,7 @@ export namespace Models { } /** - * BillingLimits + * Limits */ export type BillingLimits = { /** @@ -6891,6 +6920,48 @@ export namespace Models { enabled: boolean; } + /** + * Policy Deny Aliased Email + */ + export type PolicyDenyAliasedEmail = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether the deny aliased email policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Deny Disposable Email + */ + export type PolicyDenyDisposableEmail = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether the deny disposable email policy is enabled. + */ + enabled: boolean; + } + + /** + * Policy Deny Free Email + */ + export type PolicyDenyFreeEmail = { + /** + * Policy ID. + */ + $id: string; + /** + * Whether the deny free email policy is enabled. + */ + enabled: boolean; + } + /** * Restoration */ @@ -6987,20 +7058,6 @@ export namespace Models { userAgent: string; } - /** - * Usage events list - */ - export type UsageEventList = { - /** - * Total number of events that matched your query. - */ - total: number; - /** - * List of events. - */ - events: UsageEvent[]; - } - /** * usageGauge */ @@ -7017,20 +7074,14 @@ export namespace Models { * The snapshot timestamp. */ time: string; - } - - /** - * Usage gauges list - */ - export type UsageGaugeList = { /** - * Total number of gauges that matched your query. + * The resource type. */ - total: number; + resourceType: string; /** - * List of gauges. + * The resource ID. */ - gauges: UsageGauge[]; + resourceId: string; } /** @@ -7088,4 +7139,32 @@ export namespace Models { */ restorations: BackupRestoration[]; } + + /** + * Usage events list + */ + export type UsageEventList = { + /** + * Total number of events that matched your query. + */ + total: number; + /** + * List of events. + */ + events: UsageEvent[]; + } + + /** + * Usage gauges list + */ + export type UsageGaugeList = { + /** + * Total number of gauges that matched your query. + */ + total: number; + /** + * List of gauges. + */ + gauges: UsageGauge[]; + } } diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 37ed3bd3..1a27ab04 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -5,7 +5,7 @@ import type { Models } from '../models'; import { Browser } from '../enums/browser'; import { CreditCard } from '../enums/credit-card'; import { Flag } from '../enums/flag'; -import { Theme } from '../enums/theme'; +import { BrowserTheme } from '../enums/browser-theme'; import { Timezone } from '../enums/timezone'; import { BrowserPermission } from '../enums/browser-permission'; import { ImageFormat } from '../enums/image-format'; @@ -567,7 +567,7 @@ export class Avatars { * @param {number} params.viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. * @param {number} params.viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. * @param {number} params.scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - * @param {Theme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light". + * @param {BrowserTheme} params.theme - Browser theme. Pass "light" or "dark". Defaults to "light". * @param {string} params.userAgent - Custom user agent string. Defaults to browser default. * @param {boolean} params.fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. * @param {string} params.locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. @@ -585,7 +585,7 @@ export class Avatars { * @throws {AppwriteException} * @returns {Promise<ArrayBuffer>} */ - getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): Promise<ArrayBuffer>; + getScreenshot(params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }): Promise<ArrayBuffer>; /** * Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image. * @@ -598,7 +598,7 @@ export class Avatars { * @param {number} viewportWidth - Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280. * @param {number} viewportHeight - Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720. * @param {number} scale - Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1. - * @param {Theme} theme - Browser theme. Pass "light" or "dark". Defaults to "light". + * @param {BrowserTheme} theme - Browser theme. Pass "light" or "dark". Defaults to "light". * @param {string} userAgent - Custom user agent string. Defaults to browser default. * @param {boolean} fullpage - Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0. * @param {string} locale - Browser locale (e.g., "en-US", "fr-FR"). Defaults to browser default. @@ -617,15 +617,15 @@ export class Avatars { * @returns {Promise<ArrayBuffer>} * @deprecated Use the object parameter style method for a better developer experience. */ - getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): Promise<ArrayBuffer>; + getScreenshot(url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat): Promise<ArrayBuffer>; getScreenshot( - paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, - ...rest: [(object)?, (number)?, (number)?, (number)?, (Theme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] + paramsOrFirst: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat } | string, + ...rest: [(object)?, (number)?, (number)?, (number)?, (BrowserTheme)?, (string)?, (boolean)?, (string)?, (Timezone)?, (number)?, (number)?, (number)?, (boolean)?, (BrowserPermission[])?, (number)?, (number)?, (number)?, (number)?, (ImageFormat)?] ): Promise<ArrayBuffer> { - let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; + let params: { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: Theme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; + params = (paramsOrFirst || {}) as { url: string, headers?: object, viewportWidth?: number, viewportHeight?: number, scale?: number, theme?: BrowserTheme, userAgent?: string, fullpage?: boolean, locale?: string, timezone?: Timezone, latitude?: number, longitude?: number, accuracy?: number, touch?: boolean, permissions?: BrowserPermission[], sleep?: number, width?: number, height?: number, quality?: number, output?: ImageFormat }; } else { params = { url: paramsOrFirst as string, @@ -633,7 +633,7 @@ export class Avatars { viewportWidth: rest[1] as number, viewportHeight: rest[2] as number, scale: rest[3] as number, - theme: rest[4] as Theme, + theme: rest[4] as BrowserTheme, userAgent: rest[5] as string, fullpage: rest[6] as boolean, locale: rest[7] as string, diff --git a/src/services/functions.ts b/src/services/functions.ts index 75835a0b..abaec3aa 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -4,7 +4,7 @@ import type { Models } from '../models'; import { InputFile } from '../inputFile'; import { Runtime } from '../enums/runtime'; -import { Scopes } from '../enums/scopes'; +import { ProjectKeyScopes } from '../enums/project-key-scopes'; import { TemplateReferenceType } from '../enums/template-reference-type'; import { VCSReferenceType } from '../enums/vcs-reference-type'; import { DeploymentDownloadType } from '../enums/deployment-download-type'; @@ -97,19 +97,21 @@ export class Functions { * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} params.commands - Build Commands. - * @param {Scopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function. * @param {string} params.providerBranch - Production branch for the repo linked to the function. * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. * @param {string} params.providerRootDirectory - Path to function code in the linked repo. + * @param {string[]} params.providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} params.providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} params.buildSpecification - Build specification for the function deployments. * @param {string} params.runtimeSpecification - Runtime specification for the function executions. * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. * @throws {AppwriteException} * @returns {Promise<Models.Function>} */ - create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + create(params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; /** * Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. * @@ -124,12 +126,14 @@ export class Functions { * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} commands - Build Commands. - * @param {Scopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - List of scopes allowed for API key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} installationId - Appwrite Installation ID for VCS (Version Control System) deployment. * @param {string} providerRepositoryId - Repository ID of the repo linked to the function. * @param {string} providerBranch - Production branch for the repo linked to the function. * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. * @param {string} providerRootDirectory - Path to function code in the linked repo. + * @param {string[]} providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} buildSpecification - Build specification for the function deployments. * @param {string} runtimeSpecification - Runtime specification for the function executions. * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. @@ -137,15 +141,15 @@ export class Functions { * @returns {Promise<Models.Function>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + create(functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; create( - paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + paramsOrFirst: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise<Models.Function> { - let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { functionId: paramsOrFirst as string, @@ -159,15 +163,17 @@ export class Functions { logging: rest[7] as boolean, entrypoint: rest[8] as string, commands: rest[9] as string, - scopes: rest[10] as Scopes[], + scopes: rest[10] as ProjectKeyScopes[], installationId: rest[11] as string, providerRepositoryId: rest[12] as string, providerBranch: rest[13] as string, providerSilentMode: rest[14] as boolean, providerRootDirectory: rest[15] as string, - buildSpecification: rest[16] as string, - runtimeSpecification: rest[17] as string, - deploymentRetention: rest[18] as number + providerBranches: rest[16] as string[], + providerPaths: rest[17] as string[], + buildSpecification: rest[18] as string, + runtimeSpecification: rest[19] as string, + deploymentRetention: rest[20] as number }; } @@ -188,6 +194,8 @@ export class Functions { const providerBranch = params.providerBranch; const providerSilentMode = params.providerSilentMode; const providerRootDirectory = params.providerRootDirectory; + const providerBranches = params.providerBranches; + const providerPaths = params.providerPaths; const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; @@ -255,6 +263,12 @@ export class Functions { if (typeof providerRootDirectory !== 'undefined') { payload['providerRootDirectory'] = providerRootDirectory; } + if (typeof providerBranches !== 'undefined') { + payload['providerBranches'] = providerBranches; + } + if (typeof providerPaths !== 'undefined') { + payload['providerPaths'] = providerPaths; + } if (typeof buildSpecification !== 'undefined') { payload['buildSpecification'] = buildSpecification; } @@ -389,19 +403,21 @@ export class Functions { * @param {boolean} params.logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} params.entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} params.commands - Build Commands. - * @param {Scopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} params.scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} params.installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. * @param {string} params.providerRepositoryId - Repository ID of the repo linked to the function * @param {string} params.providerBranch - Production branch for the repo linked to the function * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. * @param {string} params.providerRootDirectory - Path to function code in the linked repo. + * @param {string[]} params.providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} params.providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} params.buildSpecification - Build specification for the function deployments. * @param {string} params.runtimeSpecification - Runtime specification for the function executions. * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. * @throws {AppwriteException} * @returns {Promise<Models.Function>} */ - update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; + update(params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Function>; /** * Update function by its unique ID. * @@ -416,12 +432,14 @@ export class Functions { * @param {boolean} logging - When disabled, executions will exclude logs and errors, and will be slightly faster. * @param {string} entrypoint - Entrypoint File. This path is relative to the "providerRootDirectory". * @param {string} commands - Build Commands. - * @param {Scopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. + * @param {ProjectKeyScopes[]} scopes - List of scopes allowed for API Key auto-generated for every execution. Maximum of 100 scopes are allowed. * @param {string} installationId - Appwrite Installation ID for VCS (Version Controle System) deployment. * @param {string} providerRepositoryId - Repository ID of the repo linked to the function * @param {string} providerBranch - Production branch for the repo linked to the function * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests. * @param {string} providerRootDirectory - Path to function code in the linked repo. + * @param {string[]} providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} buildSpecification - Build specification for the function deployments. * @param {string} runtimeSpecification - Runtime specification for the function executions. * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. @@ -429,15 +447,15 @@ export class Functions { * @returns {Promise<Models.Function>} * @deprecated Use the object parameter style method for a better developer experience. */ - update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; + update(functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Function>; update( - paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (Scopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + paramsOrFirst: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Runtime)?, (string[])?, (string[])?, (string)?, (number)?, (boolean)?, (boolean)?, (string)?, (string)?, (ProjectKeyScopes[])?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise<Models.Function> { - let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: Scopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { functionId: string, name: string, runtime?: Runtime, execute?: string[], events?: string[], schedule?: string, timeout?: number, enabled?: boolean, logging?: boolean, entrypoint?: string, commands?: string, scopes?: ProjectKeyScopes[], installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { functionId: paramsOrFirst as string, @@ -451,15 +469,17 @@ export class Functions { logging: rest[7] as boolean, entrypoint: rest[8] as string, commands: rest[9] as string, - scopes: rest[10] as Scopes[], + scopes: rest[10] as ProjectKeyScopes[], installationId: rest[11] as string, providerRepositoryId: rest[12] as string, providerBranch: rest[13] as string, providerSilentMode: rest[14] as boolean, providerRootDirectory: rest[15] as string, - buildSpecification: rest[16] as string, - runtimeSpecification: rest[17] as string, - deploymentRetention: rest[18] as number + providerBranches: rest[16] as string[], + providerPaths: rest[17] as string[], + buildSpecification: rest[18] as string, + runtimeSpecification: rest[19] as string, + deploymentRetention: rest[20] as number }; } @@ -480,6 +500,8 @@ export class Functions { const providerBranch = params.providerBranch; const providerSilentMode = params.providerSilentMode; const providerRootDirectory = params.providerRootDirectory; + const providerBranches = params.providerBranches; + const providerPaths = params.providerPaths; const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; @@ -541,6 +563,12 @@ export class Functions { if (typeof providerRootDirectory !== 'undefined') { payload['providerRootDirectory'] = providerRootDirectory; } + if (typeof providerBranches !== 'undefined') { + payload['providerBranches'] = providerBranches; + } + if (typeof providerPaths !== 'undefined') { + payload['providerPaths'] = providerPaths; + } if (typeof buildSpecification !== 'undefined') { payload['buildSpecification'] = buildSpecification; } diff --git a/src/services/health.ts b/src/services/health.ts index 1bd2cf03..6d4f6a85 100644 --- a/src/services/health.ts +++ b/src/services/health.ts @@ -2,7 +2,7 @@ import { AppwriteException, Client, type Payload, UploadProgress } from '../clie import type { Models } from '../models'; -import { Name } from '../enums/name'; +import { HealthQueueName } from '../enums/health-queue-name'; export class Health { client: Client; @@ -507,34 +507,34 @@ export class Health { * Returns the amount of failed jobs in a given queue. * * - * @param {Name} params.name - The name of the queue + * @param {HealthQueueName} params.name - The name of the queue * @param {number} params.threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. * @throws {AppwriteException} * @returns {Promise<Models.HealthQueue>} */ - getFailedJobs(params: { name: Name, threshold?: number }): Promise<Models.HealthQueue>; + getFailedJobs(params: { name: HealthQueueName, threshold?: number }): Promise<Models.HealthQueue>; /** * Returns the amount of failed jobs in a given queue. * * - * @param {Name} name - The name of the queue + * @param {HealthQueueName} name - The name of the queue * @param {number} threshold - Queue size threshold. When hit (equal or higher), endpoint returns server error. Default value is 5000. * @throws {AppwriteException} * @returns {Promise<Models.HealthQueue>} * @deprecated Use the object parameter style method for a better developer experience. */ - getFailedJobs(name: Name, threshold?: number): Promise<Models.HealthQueue>; + getFailedJobs(name: HealthQueueName, threshold?: number): Promise<Models.HealthQueue>; getFailedJobs( - paramsOrFirst: { name: Name, threshold?: number } | Name, + paramsOrFirst: { name: HealthQueueName, threshold?: number } | HealthQueueName, ...rest: [(number)?] ): Promise<Models.HealthQueue> { - let params: { name: Name, threshold?: number }; + let params: { name: HealthQueueName, threshold?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('name' in paramsOrFirst || 'threshold' in paramsOrFirst))) { - params = (paramsOrFirst || {}) as { name: Name, threshold?: number }; + params = (paramsOrFirst || {}) as { name: HealthQueueName, threshold?: number }; } else { params = { - name: paramsOrFirst as Name, + name: paramsOrFirst as HealthQueueName, threshold: rest[0] as number }; } diff --git a/src/services/organization.ts b/src/services/organization.ts new file mode 100644 index 00000000..baa874fb --- /dev/null +++ b/src/services/organization.ts @@ -0,0 +1,644 @@ +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +import { OrganizationKeyScopes } from '../enums/organization-key-scopes'; +import { Region } from '../enums/region'; + +export class Organization { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Get a list of all API keys from the current organization. + * + * @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: expire, accessedAt, name, scopes + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.KeyList>} + */ + listKeys(params?: { queries?: string[], total?: boolean }): Promise<Models.KeyList>; + /** + * Get a list of all API keys from the current organization. + * + * @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: expire, accessedAt, name, scopes + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.KeyList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listKeys(queries?: string[], total?: boolean): Promise<Models.KeyList>; + listKeys( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.KeyList> { + let params: { queries?: string[], total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + total: rest[0] as boolean + }; + } + + const queries = params.queries; + const total = params.total; + + + const apiPath = '/organization/keys'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new organization API key. + * + * @param {string} params.keyId - Key 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. + * @param {string} params.name - Key name. Max length: 128 chars. + * @param {OrganizationKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + createKey(params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }): Promise<Models.Key>; + /** + * Create a new organization API key. + * + * @param {string} keyId - Key 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. + * @param {string} name - Key name. Max length: 128 chars. + * @param {OrganizationKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createKey(keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string): Promise<Models.Key>; + createKey( + paramsOrFirst: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string } | string, + ...rest: [(string)?, (OrganizationKeyScopes[])?, (string)?] + ): Promise<Models.Key> { + let params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as OrganizationKeyScopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/organization/keys'; + const payload: Payload = {}; + if (typeof keyId !== 'undefined') { + payload['keyId'] = keyId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a key by its unique ID. This endpoint returns details about a specific API key in your organization including its scopes. + * + * @param {string} params.keyId - Key unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + getKey(params: { keyId: string }): Promise<Models.Key>; + /** + * Get a key by its unique ID. This endpoint returns details about a specific API key in your organization including its scopes. + * + * @param {string} keyId - Key unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getKey(keyId: string): Promise<Models.Key>; + getKey( + paramsOrFirst: { keyId: string } | string + ): Promise<Models.Key> { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} params.keyId - Key unique ID. + * @param {string} params.name - Key name. Max length: 128 chars. + * @param {OrganizationKeyScopes[]} params.scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} params.expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + */ + updateKey(params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }): Promise<Models.Key>; + /** + * Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key. + * + * @param {string} keyId - Key unique ID. + * @param {string} name - Key name. Max length: 128 chars. + * @param {OrganizationKeyScopes[]} scopes - Key scopes list. Maximum of 100 scopes are allowed. + * @param {string} expire - Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration. + * @throws {AppwriteException} + * @returns {Promise<Models.Key>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateKey(keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string): Promise<Models.Key>; + updateKey( + paramsOrFirst: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string } | string, + ...rest: [(string)?, (OrganizationKeyScopes[])?, (string)?] + ): Promise<Models.Key> { + let params: { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string, name: string, scopes: OrganizationKeyScopes[], expire?: string }; + } else { + params = { + keyId: paramsOrFirst as string, + name: rest[0] as string, + scopes: rest[1] as OrganizationKeyScopes[], + expire: rest[2] as string + }; + } + + const keyId = params.keyId; + const name = params.name; + const scopes = params.scopes; + const expire = params.expire; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof scopes === 'undefined') { + throw new AppwriteException('Missing required parameter: "scopes"'); + } + + const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof scopes !== 'undefined') { + payload['scopes'] = scopes; + } + if (typeof expire !== 'undefined') { + payload['expire'] = expire; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} params.keyId - Key unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteKey(params: { keyId: string }): Promise<{}>; + /** + * Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls. + * + * @param {string} keyId - Key unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteKey(keyId: string): Promise<{}>; + deleteKey( + paramsOrFirst: { keyId: string } | string + ): Promise<{}> { + let params: { keyId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { keyId: string }; + } else { + params = { + keyId: paramsOrFirst as string + }; + } + + const keyId = params.keyId; + + if (typeof keyId === 'undefined') { + throw new AppwriteException('Missing required parameter: "keyId"'); + } + + const apiPath = '/organization/keys/{keyId}'.replace('{keyId}', keyId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a list of all projects. You can use the query params to filter your results. + * + * @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: name, teamId, labels, search + * @param {string} params.search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProjectList>} + */ + listProjects(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.ProjectList>; + /** + * Get a list of all projects. You can use the query params to filter your results. + * + * @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: name, teamId, labels, search + * @param {string} search - Search term to filter your list results. Max length: 256 chars. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.ProjectList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listProjects(queries?: string[], search?: string, total?: boolean): Promise<Models.ProjectList>; + listProjects( + paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[], + ...rest: [(string)?, (boolean)?] + ): Promise<Models.ProjectList> { + let params: { queries?: string[], search?: string, total?: boolean }; + + if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean }; + } else { + params = { + queries: paramsOrFirst as string[], + search: rest[0] as string, + total: rest[1] as boolean + }; + } + + const queries = params.queries; + const search = params.search; + const total = params.total; + + + const apiPath = '/organization/projects'; + const payload: Payload = {}; + if (typeof queries !== 'undefined') { + payload['queries'] = queries; + } + if (typeof search !== 'undefined') { + payload['search'] = search; + } + if (typeof total !== 'undefined') { + payload['total'] = total; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Create a new project. + * + * @param {string} params.projectId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars. + * @param {string} params.name - Project name. Max length: 128 chars. + * @param {Region} params.region - Project Region. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + createProject(params: { projectId: string, name: string, region?: Region }): Promise<Models.Project>; + /** + * Create a new project. + * + * @param {string} projectId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, and hyphen. Can't start with a special char. Max length is 36 chars. + * @param {string} name - Project name. Max length: 128 chars. + * @param {Region} region - Project Region. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createProject(projectId: string, name: string, region?: Region): Promise<Models.Project>; + createProject( + paramsOrFirst: { projectId: string, name: string, region?: Region } | string, + ...rest: [(string)?, (Region)?] + ): Promise<Models.Project> { + let params: { projectId: string, name: string, region?: Region }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, name: string, region?: Region }; + } else { + params = { + projectId: paramsOrFirst as string, + name: rest[0] as string, + region: rest[1] as Region + }; + } + + const projectId = params.projectId; + const name = params.name; + const region = params.region; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/organization/projects'; + const payload: Payload = {}; + if (typeof projectId !== 'undefined') { + payload['projectId'] = projectId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof region !== 'undefined') { + payload['region'] = region; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload, + ); + } + + /** + * Get a project. + * + * @param {string} params.projectId - Project unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + getProject(params: { projectId: string }): Promise<Models.Project>; + /** + * Get a project. + * + * @param {string} projectId - Project unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getProject(projectId: string): Promise<Models.Project>; + getProject( + paramsOrFirst: { projectId: string } | string + ): Promise<Models.Project> { + let params: { projectId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string }; + } else { + params = { + projectId: paramsOrFirst as string + }; + } + + const projectId = params.projectId; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', projectId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + ); + } + + /** + * Update a project by its unique ID. + * + * @param {string} params.projectId - Project unique ID. + * @param {string} params.name - Project name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + */ + updateProject(params: { projectId: string, name: string }): Promise<Models.Project>; + /** + * Update a project by its unique ID. + * + * @param {string} projectId - Project unique ID. + * @param {string} name - Project name. Max length: 128 chars. + * @throws {AppwriteException} + * @returns {Promise<Models.Project>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateProject(projectId: string, name: string): Promise<Models.Project>; + updateProject( + paramsOrFirst: { projectId: string, name: string } | string, + ...rest: [(string)?] + ): Promise<Models.Project> { + let params: { projectId: string, name: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, name: string }; + } else { + params = { + projectId: paramsOrFirst as string, + name: rest[0] as string + }; + } + + const projectId = params.projectId; + const name = params.name; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', projectId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload, + ); + } + + /** + * Delete a project by its unique ID. + * + * @param {string} params.projectId - Project unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteProject(params: { projectId: string }): Promise<{}>; + /** + * Delete a project by its unique ID. + * + * @param {string} projectId - Project unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteProject(projectId: string): Promise<{}>; + deleteProject( + paramsOrFirst: { projectId: string } | string + ): Promise<{}> { + let params: { projectId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string }; + } else { + params = { + projectId: paramsOrFirst as string + }; + } + + const projectId = params.projectId; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + + const apiPath = '/organization/projects/{projectId}'.replace('{projectId}', projectId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload, + ); + } +} diff --git a/src/services/presences.ts b/src/services/presences.ts index 80cfb5b3..0088c90e 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -18,9 +18,9 @@ export class Presences { * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. * @param {number} params.ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} - * @returns {Promise<Models.PresenceList<Presence>>} + * @returns {Promise<Models.PresenceList>} */ - list<Presence extends Models.Presence = Models.DefaultPresence>(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise<Models.PresenceList<Presence>>; + list(params?: { queries?: string[], total?: boolean, ttl?: number }): Promise<Models.PresenceList>; /** * List presence logs. Expired entries are filtered out automatically. * @@ -29,14 +29,14 @@ export class Presences { * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. * @param {number} ttl - TTL (seconds) for caching list responses. Responses are stored in an in-memory key-value cache, keyed per project, collection, schema version (attributes and indexes), caller authorization roles, and the exact query — so users with different permissions never share cached entries. Schema changes invalidate cached entries automatically; document writes do not, so choose a TTL you are comfortable serving as stale data. Set to 0 to disable caching. Must be between 0 and 86400 (24 hours). * @throws {AppwriteException} - * @returns {Promise<Models.PresenceList<Presence>>} + * @returns {Promise<Models.PresenceList>} * @deprecated Use the object parameter style method for a better developer experience. */ - list<Presence extends Models.Presence = Models.DefaultPresence>(queries?: string[], total?: boolean, ttl?: number): Promise<Models.PresenceList<Presence>>; - list<Presence extends Models.Presence = Models.DefaultPresence>( + list(queries?: string[], total?: boolean, ttl?: number): Promise<Models.PresenceList>; + list( paramsOrFirst?: { queries?: string[], total?: boolean, ttl?: number } | string[], ...rest: [(boolean)?, (number)?] - ): Promise<Models.PresenceList<Presence>> { + ): Promise<Models.PresenceList> { let params: { queries?: string[], total?: boolean, ttl?: number }; if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -84,22 +84,22 @@ export class Presences { * * @param {string} params.presenceId - Presence unique ID. * @throws {AppwriteException} - * @returns {Promise<Presence>} + * @returns {Promise<Models.Presence>} */ - get<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string }): Promise<Presence>; + get(params: { presenceId: string }): Promise<Models.Presence>; /** * Get a presence log by its unique ID. Entries whose `expiresAt` is in the past are treated as not found. * * * @param {string} presenceId - Presence unique ID. * @throws {AppwriteException} - * @returns {Promise<Presence>} + * @returns {Promise<Models.Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - get<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string): Promise<Presence>; - get<Presence extends Models.Presence = Models.DefaultPresence>( + get(presenceId: string): Promise<Models.Presence>; + get( paramsOrFirst: { presenceId: string } | string - ): Promise<Presence> { + ): Promise<Models.Presence> { let params: { presenceId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -142,9 +142,9 @@ export class Presences { * @param {string} params.expiresAt - Presence expiry datetime. * @param {object} params.metadata - Presence metadata object. * @throws {AppwriteException} - * @returns {Promise<Presence>} + * @returns {Promise<Models.Presence>} */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Presence>; + upsert(params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Models.Presence>; /** * Create or update a presence log by its user ID. * @@ -156,14 +156,14 @@ export class Presences { * @param {string} expiresAt - Presence expiry datetime. * @param {object} metadata - Presence metadata object. * @throws {AppwriteException} - * @returns {Promise<Presence>} + * @returns {Promise<Models.Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; - upsert<Presence extends Models.Presence = Models.DefaultPresence>( + upsert(presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Models.Presence>; + upsert( paramsOrFirst: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] - ): Promise<Presence> { + ): Promise<Models.Presence> { let params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -239,9 +239,9 @@ export class Presences { * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} params.purge - When true, purge cached responses used by list presences endpoint. * @throws {AppwriteException} - * @returns {Promise<Presence>} + * @returns {Promise<Models.Presence>} */ - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Presence>; + update(params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Models.Presence>; /** * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -254,14 +254,14 @@ export class Presences { * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). * @param {boolean} purge - When true, purge cached responses used by list presences endpoint. * @throws {AppwriteException} - * @returns {Promise<Presence>} + * @returns {Promise<Models.Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>( + update(presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Models.Presence>; + update( paramsOrFirst: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, ...rest: [(string)?, (string)?, (string)?, (object)?, (string[])?, (boolean)?] - ): Promise<Presence> { + ): Promise<Models.Presence> { let params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { diff --git a/src/services/project.ts b/src/services/project.ts index 898b6973..3fcec931 100644 --- a/src/services/project.ts +++ b/src/services/project.ts @@ -938,7 +938,7 @@ export class Project { * Update the project OAuth2 Amazon configuration. * * @param {string} params.clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {string} params.clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Amazon>} @@ -948,7 +948,7 @@ export class Project { * Update the project OAuth2 Amazon configuration. * * @param {string} clientId - 'Client ID' of Amazon OAuth2 app. For example: amzn1.application-oa2-client.87400c00000000000000000000063d5b2 - * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: 79ffe4000000000000000000000000000000000000000000000000000002de55 + * @param {string} clientSecret - 'Client Secret' of Amazon OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Amazon>} @@ -1086,7 +1086,7 @@ export class Project { * Update the project OAuth2 Auth0 configuration. * * @param {string} params.clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} params.clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.endpoint - Domain of Auth0 instance. For example: example.us.auth0.com * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1097,7 +1097,7 @@ export class Project { * Update the project OAuth2 Auth0 configuration. * * @param {string} clientId - 'Client ID' of Auth0 OAuth2 app. For example: OaOkIA000000000000000000005KLSYq - * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: zXz0000-00000000000000000000000000000-00000000000000000000PJafnF + * @param {string} clientSecret - 'Client Secret' of Auth0 OAuth2 app. For example: your-oauth2-client-secret * @param {string} endpoint - Domain of Auth0 instance. For example: example.us.auth0.com * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1160,7 +1160,7 @@ export class Project { * Update the project OAuth2 Authentik configuration. * * @param {string} params.clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} params.clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.endpoint - Domain of Authentik instance. For example: example.authentik.com * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1171,7 +1171,7 @@ export class Project { * Update the project OAuth2 Authentik configuration. * * @param {string} clientId - 'Client ID' of Authentik OAuth2 app. For example: dTKOPa0000000000000000000000000000e7G8hv - * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK + * @param {string} clientSecret - 'Client Secret' of Authentik OAuth2 app. For example: your-oauth2-client-secret * @param {string} endpoint - Domain of Authentik instance. For example: example.authentik.com * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1234,7 +1234,7 @@ export class Project { * Update the project OAuth2 Autodesk configuration. * * @param {string} params.clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {string} params.clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Autodesk>} @@ -1244,7 +1244,7 @@ export class Project { * Update the project OAuth2 Autodesk configuration. * * @param {string} clientId - 'Client ID' of Autodesk OAuth2 app. For example: 5zw90v00000000000000000000kVYXN7 - * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: 7I000000000000MW + * @param {string} clientSecret - 'Client Secret' of Autodesk OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Autodesk>} @@ -1301,7 +1301,7 @@ export class Project { * Update the project OAuth2 Bitbucket configuration. * * @param {string} params.key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {string} params.secret - 'Secret' of Bitbucket OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Bitbucket>} @@ -1311,7 +1311,7 @@ export class Project { * Update the project OAuth2 Bitbucket configuration. * * @param {string} key - 'Key' of Bitbucket OAuth2 app. For example: Knt70000000000ByRc - * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: NMfLZJ00000000000000000000TLQdDx + * @param {string} secret - 'Secret' of Bitbucket OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Bitbucket>} @@ -1368,7 +1368,7 @@ export class Project { * Update the project OAuth2 Bitly configuration. * * @param {string} params.clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {string} params.clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Bitly>} @@ -1378,7 +1378,7 @@ export class Project { * Update the project OAuth2 Bitly configuration. * * @param {string} clientId - 'Client ID' of Bitly OAuth2 app. For example: d95151000000000000000000000000000067af9b - * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: a13e250000000000000000000000000000d73095 + * @param {string} clientSecret - 'Client Secret' of Bitly OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Bitly>} @@ -1435,7 +1435,7 @@ export class Project { * Update the project OAuth2 Box configuration. * * @param {string} params.clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {string} params.clientSecret - 'Client Secret' of Box OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Box>} @@ -1445,7 +1445,7 @@ export class Project { * Update the project OAuth2 Box configuration. * * @param {string} clientId - 'Client ID' of Box OAuth2 app. For example: deglcs00000000000000000000x2og6y - * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: OKM1f100000000000000000000eshEif + * @param {string} clientSecret - 'Client Secret' of Box OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Box>} @@ -1502,7 +1502,7 @@ export class Project { * Update the project OAuth2 Dailymotion configuration. * * @param {string} params.apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {string} params.apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Dailymotion>} @@ -1512,7 +1512,7 @@ export class Project { * Update the project OAuth2 Dailymotion configuration. * * @param {string} apiKey - 'API Key' of Dailymotion OAuth2 app. For example: 07a9000000000000067f - * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: a399a90000000000000000000000000000d90639 + * @param {string} apiSecret - 'API Secret' of Dailymotion OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Dailymotion>} @@ -1569,7 +1569,7 @@ export class Project { * Update the project OAuth2 Discord configuration. * * @param {string} params.clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {string} params.clientSecret - 'Client Secret' of Discord OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Discord>} @@ -1579,7 +1579,7 @@ export class Project { * Update the project OAuth2 Discord configuration. * * @param {string} clientId - 'Client ID' of Discord OAuth2 app. For example: 950722000000343754 - * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: YmPXnM000000000000000000002zFg5D + * @param {string} clientSecret - 'Client Secret' of Discord OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Discord>} @@ -1636,7 +1636,7 @@ export class Project { * Update the project OAuth2 Disqus configuration. * * @param {string} params.publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {string} params.secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Disqus>} @@ -1646,7 +1646,7 @@ export class Project { * Update the project OAuth2 Disqus configuration. * * @param {string} publicKey - 'Public Key, also known as API Key' of Disqus OAuth2 app. For example: cgegH70000000000000000000000000000000000000000000000000000Hr1nYX - * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: W7Bykj00000000000000000000000000000000000000000000000000003o43w9 + * @param {string} secretKey - 'Secret Key, also known as API Secret' of Disqus OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Disqus>} @@ -1703,7 +1703,7 @@ export class Project { * Update the project OAuth2 Dropbox configuration. * * @param {string} params.appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {string} params.appSecret - 'App Secret' of Dropbox OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Dropbox>} @@ -1713,7 +1713,7 @@ export class Project { * Update the project OAuth2 Dropbox configuration. * * @param {string} appKey - 'App Key' of Dropbox OAuth2 app. For example: jl000000000009t - * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: g200000000000vw + * @param {string} appSecret - 'App Secret' of Dropbox OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Dropbox>} @@ -1770,7 +1770,7 @@ export class Project { * Update the project OAuth2 Etsy configuration. * * @param {string} params.keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {string} params.sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Etsy>} @@ -1780,7 +1780,7 @@ export class Project { * Update the project OAuth2 Etsy configuration. * * @param {string} keyString - 'Keystring' of Etsy OAuth2 app. For example: nsgzxh0000000000008j85a2 - * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: tp000000ru + * @param {string} sharedSecret - 'Shared Secret' of Etsy OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Etsy>} @@ -1837,7 +1837,7 @@ export class Project { * Update the project OAuth2 Facebook configuration. * * @param {string} params.appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {string} params.appSecret - 'App Secret' of Facebook OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Facebook>} @@ -1847,7 +1847,7 @@ export class Project { * Update the project OAuth2 Facebook configuration. * * @param {string} appId - 'App ID' of Facebook OAuth2 app. For example: 260600000007694 - * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: 2d0b2800000000000000000000d38af4 + * @param {string} appSecret - 'App Secret' of Facebook OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Facebook>} @@ -1904,7 +1904,7 @@ export class Project { * Update the project OAuth2 Figma configuration. * * @param {string} params.clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {string} params.clientSecret - 'Client Secret' of Figma OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Figma>} @@ -1914,7 +1914,7 @@ export class Project { * Update the project OAuth2 Figma configuration. * * @param {string} clientId - 'Client ID' of Figma OAuth2 app. For example: byay5H0000000000VtiI40 - * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: yEpOYn0000000000000000004iIsU5 + * @param {string} clientSecret - 'Client Secret' of Figma OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Figma>} @@ -1971,7 +1971,7 @@ export class Project { * Update the project OAuth2 FusionAuth configuration. * * @param {string} params.clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} params.clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -1982,7 +1982,7 @@ export class Project { * Update the project OAuth2 FusionAuth configuration. * * @param {string} clientId - 'Client ID' of FusionAuth OAuth2 app. For example: b2222c00-0000-0000-0000-000000862097 - * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: Jx4s0C0000000000000000000000000000000wGqLsc + * @param {string} clientSecret - 'Client Secret' of FusionAuth OAuth2 app. For example: your-oauth2-client-secret * @param {string} endpoint - Domain of FusionAuth instance. For example: example.fusionauth.io * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2045,7 +2045,7 @@ export class Project { * Update the project OAuth2 GitHub configuration. * * @param {string} params.clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {string} params.clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Github>} @@ -2055,7 +2055,7 @@ export class Project { * Update the project OAuth2 GitHub configuration. * * @param {string} clientId - 'OAuth2 app Client ID, or App ID' of GitHub OAuth2 app. For example: e4d87900000000540733. Example of wrong value: 370006 - * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: 5e07c00000000000000000000000000000198bcc + * @param {string} clientSecret - 'Client Secret' of GitHub OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Github>} @@ -2112,7 +2112,7 @@ export class Project { * Update the project OAuth2 Gitlab configuration. * * @param {string} params.applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} params.secret - 'Secret' of Gitlab OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2123,7 +2123,7 @@ export class Project { * Update the project OAuth2 Gitlab configuration. * * @param {string} applicationId - 'Application ID' of Gitlab OAuth2 app. For example: d41ffe0000000000000000000000000000000000000000000000000000d5e252 - * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38 + * @param {string} secret - 'Secret' of Gitlab OAuth2 app. For example: your-oauth2-client-secret * @param {string} endpoint - Endpoint URL of self-hosted GitLab instance. For example: https://gitlab.com * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2186,7 +2186,7 @@ export class Project { * Update the project OAuth2 Google configuration. * * @param {string} params.clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret + * @param {string} params.clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-oauth2-client-secret * @param {ProjectOAuth2GooglePrompt[]} params.prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2197,7 +2197,7 @@ export class Project { * Update the project OAuth2 Google configuration. * * @param {string} clientId - 'Client ID' of Google OAuth2 app. For example: 120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com - * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: example-google-client-secret + * @param {string} clientSecret - 'Client Secret' of Google OAuth2 app. For example: your-oauth2-client-secret * @param {ProjectOAuth2GooglePrompt[]} prompt - Array of Google OAuth2 prompt values. If "none" is included, it must be the only element. "none" means: don't display any authentication or consent screens. Must not be specified with other values. "consent" means: prompt the user for consent. "select_account" means: prompt the user to select an account. * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2260,7 +2260,7 @@ export class Project { * Update the project OAuth2 Keycloak configuration. * * @param {string} params.clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} params.clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.endpoint - Domain of Keycloak instance. For example: keycloak.example.com * @param {string} params.realmName - Keycloak realm name. For example: appwrite-realm * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2272,7 +2272,7 @@ export class Project { * Update the project OAuth2 Keycloak configuration. * * @param {string} clientId - 'Client ID' of Keycloak OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: jdjrJd00000000000000000000HUsaZO + * @param {string} clientSecret - 'Client Secret' of Keycloak OAuth2 app. For example: your-oauth2-client-secret * @param {string} endpoint - Domain of Keycloak instance. For example: keycloak.example.com * @param {string} realmName - Keycloak realm name. For example: appwrite-realm * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2341,7 +2341,7 @@ export class Project { * Update the project OAuth2 Kick configuration. * * @param {string} params.clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {string} params.clientSecret - 'Client Secret' of Kick OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Kick>} @@ -2351,7 +2351,7 @@ export class Project { * Update the project OAuth2 Kick configuration. * * @param {string} clientId - 'Client ID' of Kick OAuth2 app. For example: 01KQ7C00000000000001MFHS32 - * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: 34ac5600000000000000000000000000000000000000000000000000e830c8b + * @param {string} clientSecret - 'Client Secret' of Kick OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Kick>} @@ -2408,7 +2408,7 @@ export class Project { * Update the project OAuth2 Linkedin configuration. * * @param {string} params.clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret + * @param {string} params.primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Linkedin>} @@ -2418,7 +2418,7 @@ export class Project { * Update the project OAuth2 Linkedin configuration. * * @param {string} clientId - 'Client ID' of Linkedin OAuth2 app. For example: 770000000000dv - * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: example-linkedin-client-secret + * @param {string} primaryClientSecret - 'Primary Client Secret or Secondary Client Secret' of Linkedin OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Linkedin>} @@ -2475,7 +2475,7 @@ export class Project { * Update the project OAuth2 Microsoft configuration. * * @param {string} params.applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} params.applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2486,7 +2486,7 @@ export class Project { * Update the project OAuth2 Microsoft configuration. * * @param {string} applicationId - 'Entra ID Application ID, also known as Client ID' of Microsoft OAuth2 app. For example: 00001111-aaaa-2222-bbbb-3333cccc4444 - * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u + * @param {string} applicationSecret - 'Entra ID Application Secret, also known as Client Secret' of Microsoft OAuth2 app. For example: your-oauth2-client-secret * @param {string} tenant - Microsoft Entra ID tenant identifier. Use 'common', 'organizations', 'consumers' or a specific tenant ID. For example: common * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} @@ -2549,7 +2549,7 @@ export class Project { * Update the project OAuth2 Notion configuration. * * @param {string} params.oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {string} params.oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Notion>} @@ -2559,7 +2559,7 @@ export class Project { * Update the project OAuth2 Notion configuration. * * @param {string} oauthClientId - 'OAuth Client ID' of Notion OAuth2 app. For example: 341d8700-0000-0000-0000-000000446ee3 - * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: secret_dLUr4b000000000000000000000000000000lFHAa9 + * @param {string} oauthClientSecret - 'OAuth Client Secret' of Notion OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Notion>} @@ -2616,7 +2616,7 @@ export class Project { * Update the project OAuth2 Oidc configuration. * * @param {string} params.clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} params.clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration * @param {string} params.authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize * @param {string} params.tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token @@ -2630,7 +2630,7 @@ export class Project { * Update the project OAuth2 Oidc configuration. * * @param {string} clientId - 'Client ID' of Oidc OAuth2 app. For example: qibI2x0000000000000000000000000006L2YFoG - * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV + * @param {string} clientSecret - 'Client Secret' of Oidc OAuth2 app. For example: your-oauth2-client-secret * @param {string} wellKnownURL - OpenID Connect well-known configuration URL. When provided, authorization, token, and user info endpoints can be discovered automatically. For example: https://myoauth.com/.well-known/openid-configuration * @param {string} authorizationURL - OpenID Connect authorization endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/authorize * @param {string} tokenURL - OpenID Connect token endpoint URL. Required when wellKnownURL is not provided. For example: https://myoauth.com/oauth2/token @@ -2711,7 +2711,7 @@ export class Project { * Update the project OAuth2 Okta configuration. * * @param {string} params.clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} params.clientSecret - 'Client Secret' of Okta OAuth2 app. For example: your-oauth2-client-secret * @param {string} params.domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ * @param {string} params.authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2723,7 +2723,7 @@ export class Project { * Update the project OAuth2 Okta configuration. * * @param {string} clientId - 'Client ID' of Okta OAuth2 app. For example: 0oa00000000000000698 - * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV + * @param {string} clientSecret - 'Client Secret' of Okta OAuth2 app. For example: your-oauth2-client-secret * @param {string} domain - Okta company domain. Required when enabling the provider. For example: trial-6400025.okta.com. Example of wrong value: trial-6400025-admin.okta.com, or https://trial-6400025.okta.com/ * @param {string} authorizationServerId - Custom Authorization Servers. Optional, can be left empty or unconfigured. For example: aus000000000000000h7z * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. @@ -2792,7 +2792,7 @@ export class Project { * Update the project OAuth2 Paypal configuration. * * @param {string} params.clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Paypal>} @@ -2802,7 +2802,7 @@ export class Project { * Update the project OAuth2 Paypal configuration. * * @param {string} clientId - 'Client ID' of Paypal OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of Paypal OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Paypal>} @@ -2859,7 +2859,7 @@ export class Project { * Update the project OAuth2 PaypalSandbox configuration. * * @param {string} params.clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} params.secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Paypal>} @@ -2869,7 +2869,7 @@ export class Project { * Update the project OAuth2 PaypalSandbox configuration. * * @param {string} clientId - 'Client ID' of PaypalSandbox OAuth2 app. For example: AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB - * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp + * @param {string} secretKey - 'Secret Key 1 or Secret Key 2' of PaypalSandbox OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Paypal>} @@ -2926,7 +2926,7 @@ export class Project { * Update the project OAuth2 Podio configuration. * * @param {string} params.clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {string} params.clientSecret - 'Client Secret' of Podio OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Podio>} @@ -2936,7 +2936,7 @@ export class Project { * Update the project OAuth2 Podio configuration. * * @param {string} clientId - 'Client ID' of Podio OAuth2 app. For example: appwrite-o0000000st-app - * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: Rn247T0000000000000000000000000000000000000000000000000000W2zWTN + * @param {string} clientSecret - 'Client Secret' of Podio OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Podio>} @@ -2993,7 +2993,7 @@ export class Project { * Update the project OAuth2 Salesforce configuration. * * @param {string} params.customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {string} params.customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Salesforce>} @@ -3003,7 +3003,7 @@ export class Project { * Update the project OAuth2 Salesforce configuration. * * @param {string} customerKey - 'Consumer Key' of Salesforce OAuth2 app. For example: 3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq - * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: 3w000000000000e2 + * @param {string} customerSecret - 'Consumer Secret' of Salesforce OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Salesforce>} @@ -3060,7 +3060,7 @@ export class Project { * Update the project OAuth2 Slack configuration. * * @param {string} params.clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {string} params.clientSecret - 'Client Secret' of Slack OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Slack>} @@ -3070,7 +3070,7 @@ export class Project { * Update the project OAuth2 Slack configuration. * * @param {string} clientId - 'Client ID' of Slack OAuth2 app. For example: 23000000089.15000000000023 - * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: 81656000000000000000000000f3d2fd + * @param {string} clientSecret - 'Client Secret' of Slack OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Slack>} @@ -3127,7 +3127,7 @@ export class Project { * Update the project OAuth2 Spotify configuration. * * @param {string} params.clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {string} params.clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Spotify>} @@ -3137,7 +3137,7 @@ export class Project { * Update the project OAuth2 Spotify configuration. * * @param {string} clientId - 'Client ID' of Spotify OAuth2 app. For example: 6ec271000000000000000000009beace - * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: db068a000000000000000000008b5b9f + * @param {string} clientSecret - 'Client Secret' of Spotify OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Spotify>} @@ -3194,7 +3194,7 @@ export class Project { * Update the project OAuth2 Stripe configuration. * * @param {string} params.clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {string} params.apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Stripe>} @@ -3204,7 +3204,7 @@ export class Project { * Update the project OAuth2 Stripe configuration. * * @param {string} clientId - 'Client ID' of Stripe OAuth2 app. For example: ca_UKibXX0000000000000000000006byvR - * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp + * @param {string} apiSecretKey - 'API Secret Key' of Stripe OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Stripe>} @@ -3261,7 +3261,7 @@ export class Project { * Update the project OAuth2 Tradeshift configuration. * * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Tradeshift>} @@ -3271,7 +3271,7 @@ export class Project { * Update the project OAuth2 Tradeshift configuration. * * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Tradeshift>} @@ -3328,7 +3328,7 @@ export class Project { * Update the project OAuth2 Tradeshift Sandbox configuration. * * @param {string} params.oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} params.oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Tradeshift>} @@ -3338,7 +3338,7 @@ export class Project { * Update the project OAuth2 Tradeshift Sandbox configuration. * * @param {string} oauth2ClientId - 'OAuth2 Client ID' of Tradeshift Sandbox OAuth2 app. For example: appwrite-tes00000.0000000000est-app - * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: 7cb52700-0000-0000-0000-000000ca5b83 + * @param {string} oauth2ClientSecret - 'OAuth2 Client Secret' of Tradeshift Sandbox OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Tradeshift>} @@ -3395,7 +3395,7 @@ export class Project { * Update the project OAuth2 Twitch configuration. * * @param {string} params.clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {string} params.clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Twitch>} @@ -3405,7 +3405,7 @@ export class Project { * Update the project OAuth2 Twitch configuration. * * @param {string} clientId - 'Client ID' of Twitch OAuth2 app. For example: vvi0in000000000000000000ikmt9p - * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: pmapue000000000000000000zylw3v + * @param {string} clientSecret - 'Client Secret' of Twitch OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Twitch>} @@ -3462,7 +3462,7 @@ export class Project { * Update the project OAuth2 WordPress configuration. * * @param {string} params.clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {string} params.clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2WordPress>} @@ -3472,7 +3472,7 @@ export class Project { * Update the project OAuth2 WordPress configuration. * * @param {string} clientId - 'Client ID' of WordPress OAuth2 app. For example: 130005 - * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk + * @param {string} clientSecret - 'Client Secret' of WordPress OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2WordPress>} @@ -3529,7 +3529,7 @@ export class Project { * Update the project OAuth2 X configuration. * * @param {string} params.customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {string} params.secretKey - 'Secret Key' of X OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2X>} @@ -3539,7 +3539,7 @@ export class Project { * Update the project OAuth2 X configuration. * * @param {string} customerKey - 'Customer Key' of X OAuth2 app. For example: slzZV0000000000000NFLaWT - * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: tkEPkp00000000000000000000000000000000000000FTxbI9 + * @param {string} secretKey - 'Secret Key' of X OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2X>} @@ -3596,7 +3596,7 @@ export class Project { * Update the project OAuth2 Yahoo configuration. * * @param {string} params.clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {string} params.clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Yahoo>} @@ -3606,7 +3606,7 @@ export class Project { * Update the project OAuth2 Yahoo configuration. * * @param {string} clientId - 'Client ID, also known as Customer Key' of Yahoo OAuth2 app. For example: dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm - * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: cf978f0000000000000000000000000000c5e2e9 + * @param {string} clientSecret - 'Client Secret, also known as Customer Secret' of Yahoo OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Yahoo>} @@ -3663,7 +3663,7 @@ export class Project { * Update the project OAuth2 Yandex configuration. * * @param {string} params.clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {string} params.clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Yandex>} @@ -3673,7 +3673,7 @@ export class Project { * Update the project OAuth2 Yandex configuration. * * @param {string} clientId - 'Client ID' of Yandex OAuth2 app. For example: 6a8a6a0000000000000000000091483c - * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: bbf98500000000000000000000c75a63 + * @param {string} clientSecret - 'Client Secret' of Yandex OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Yandex>} @@ -3730,7 +3730,7 @@ export class Project { * Update the project OAuth2 Zoho configuration. * * @param {string} params.clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {string} params.clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Zoho>} @@ -3740,7 +3740,7 @@ export class Project { * Update the project OAuth2 Zoho configuration. * * @param {string} clientId - 'Client ID' of Zoho OAuth2 app. For example: 1000.83C178000000000000000000RPNX0B - * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: fb5cac000000000000000000000000000000a68f6e + * @param {string} clientSecret - 'Client Secret' of Zoho OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Zoho>} @@ -3797,7 +3797,7 @@ export class Project { * Update the project OAuth2 Zoom configuration. * * @param {string} params.clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - * @param {string} params.clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {string} params.clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} params.enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Zoom>} @@ -3807,7 +3807,7 @@ export class Project { * Update the project OAuth2 Zoom configuration. * * @param {string} clientId - 'Client ID' of Zoom OAuth2 app. For example: QMAC00000000000000w0AQ - * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: GAWsG4000000000000000000007U01ON + * @param {string} clientSecret - 'Client Secret' of Zoom OAuth2 app. For example: your-oauth2-client-secret * @param {boolean} enabled - OAuth2 sign-in method status. Set to true to enable new session creation. Setting to true will trigger end-to-end credentials validation, and will throw if the credentials are invalid. * @throws {AppwriteException} * @returns {Promise<Models.OAuth2Zoom>} @@ -5570,23 +5570,23 @@ export class Project { /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicyId} params.policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. * @throws {AppwriteException} - * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} + * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail>} */ - getPolicy(params: { policyId: ProjectPolicyId }): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; + getPolicy(params: { policyId: ProjectPolicyId }): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail>; /** * Get a policy by its unique ID. This endpoint returns the current configuration for the requested project policy. * - * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy. + * @param {ProjectPolicyId} policyId - Policy ID. Can be one of: password-dictionary, password-history, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, deny-aliased-email, deny-disposable-email, deny-free-email. * @throws {AppwriteException} - * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>} + * @returns {Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail>} * @deprecated Use the object parameter style method for a better developer experience. */ - getPolicy(policyId: ProjectPolicyId): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy>; + getPolicy(policyId: ProjectPolicyId): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail>; getPolicy( paramsOrFirst: { policyId: ProjectPolicyId } | ProjectPolicyId - ): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy> { + ): Promise<Models.PolicyPasswordDictionary | Models.PolicyPasswordHistory | Models.PolicyPasswordPersonalData | Models.PolicySessionAlert | Models.PolicySessionDuration | Models.PolicySessionInvalidation | Models.PolicySessionLimit | Models.PolicyUserLimit | Models.PolicyMembershipPrivacy | Models.PolicyDenyAliasedEmail | Models.PolicyDenyDisposableEmail | Models.PolicyDenyFreeEmail> { let params: { policyId: ProjectPolicyId }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst) && ('policyId' in paramsOrFirst))) { @@ -5749,12 +5749,12 @@ export class Project { * * @param {string} params.host - SMTP server hostname (domain) * @param {number} params.port - SMTP server port - * @param {string} params.username - SMTP server username. Leave empty for no authorization. - * @param {string} params.password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). - * @param {string} params.senderEmail - Email address shown in inbox as the sender of the email. - * @param {string} params.senderName - Name shown in inbox as the sender of the email. - * @param {string} params.replyToEmail - Email used when user replies to the email. - * @param {string} params.replyToName - Name used when user replies to the email. + * @param {string} params.username - SMTP server username. Pass an empty string to clear a previously set value. + * @param {string} params.password - SMTP server password. Pass an empty string to clear a previously set value. This property is stored securely and cannot be read in future (write-only). + * @param {string} params.senderEmail - Email address shown in inbox as the sender of the email. Pass an empty string to clear a previously set value. + * @param {string} params.senderName - Name shown in inbox as the sender of the email. Pass an empty string to clear a previously set value. + * @param {string} params.replyToEmail - Email used when user replies to the email. Pass an empty string to clear a previously set value. + * @param {string} params.replyToName - Name used when user replies to the email. Pass an empty string to clear a previously set value. * @param {ProjectSMTPSecure} params.secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. * @param {boolean} params.enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. * @throws {AppwriteException} @@ -5766,12 +5766,12 @@ export class Project { * * @param {string} host - SMTP server hostname (domain) * @param {number} port - SMTP server port - * @param {string} username - SMTP server username. Leave empty for no authorization. - * @param {string} password - SMTP server password. Leave empty for no authorization. This property is stored securely and cannot be read in future (write-only). - * @param {string} senderEmail - Email address shown in inbox as the sender of the email. - * @param {string} senderName - Name shown in inbox as the sender of the email. - * @param {string} replyToEmail - Email used when user replies to the email. - * @param {string} replyToName - Name used when user replies to the email. + * @param {string} username - SMTP server username. Pass an empty string to clear a previously set value. + * @param {string} password - SMTP server password. Pass an empty string to clear a previously set value. This property is stored securely and cannot be read in future (write-only). + * @param {string} senderEmail - Email address shown in inbox as the sender of the email. Pass an empty string to clear a previously set value. + * @param {string} senderName - Name shown in inbox as the sender of the email. Pass an empty string to clear a previously set value. + * @param {string} replyToEmail - Email used when user replies to the email. Pass an empty string to clear a previously set value. + * @param {string} replyToName - Name used when user replies to the email. Pass an empty string to clear a previously set value. * @param {ProjectSMTPSecure} secure - Configures if communication with SMTP server is encrypted. Allowed values are: tls, ssl. Leave empty for no encryption. * @param {boolean} enabled - Enable or disable custom SMTP. Custom SMTP is useful for branding purposes, but also allows use of custom email templates. * @throws {AppwriteException} @@ -5982,8 +5982,8 @@ export class Project { * @param {string} params.subject - Subject of the email template. Can be up to 255 characters. * @param {string} params.message - Plain or HTML body of the email template message. Can be up to 10MB of content. * @param {string} params.senderName - Name of the email sender. - * @param {string} params.senderEmail - Email of the sender. - * @param {string} params.replyToEmail - Reply to email. + * @param {string} params.senderEmail - Email of the sender. Pass an empty string to clear a previously set value. + * @param {string} params.replyToEmail - Reply to email. Pass an empty string to clear a previously set value. * @param {string} params.replyToName - Reply to name. * @throws {AppwriteException} * @returns {Promise<Models.EmailTemplate>} @@ -5997,8 +5997,8 @@ export class Project { * @param {string} subject - Subject of the email template. Can be up to 255 characters. * @param {string} message - Plain or HTML body of the email template message. Can be up to 10MB of content. * @param {string} senderName - Name of the email sender. - * @param {string} senderEmail - Email of the sender. - * @param {string} replyToEmail - Reply to email. + * @param {string} senderEmail - Email of the sender. Pass an empty string to clear a previously set value. + * @param {string} replyToEmail - Reply to email. Pass an empty string to clear a previously set value. * @param {string} replyToName - Reply to name. * @throws {AppwriteException} * @returns {Promise<Models.EmailTemplate>} diff --git a/src/services/sites.ts b/src/services/sites.ts index a45f6478..d935cda7 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -104,13 +104,15 @@ export class Sites { * @param {string} params.providerBranch - Production branch for the repo linked to the site. * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. * @param {string} params.providerRootDirectory - Path to site code in the linked repo. + * @param {string[]} params.providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} params.providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} params.buildSpecification - Build specification for the site deployments. * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. * @throws {AppwriteException} * @returns {Promise<Models.Site>} */ - create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; + create(params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; /** * Create a new site. * @@ -132,6 +134,8 @@ export class Sites { * @param {string} providerBranch - Production branch for the repo linked to the site. * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. * @param {string} providerRootDirectory - Path to site code in the linked repo. + * @param {string[]} providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} buildSpecification - Build specification for the site deployments. * @param {string} runtimeSpecification - Runtime specification for the SSR executions. * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. @@ -139,15 +143,15 @@ export class Sites { * @returns {Promise<Models.Site>} * @deprecated Use the object parameter style method for a better developer experience. */ - create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; + create(siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; create( - paramsOrFirst: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + paramsOrFirst: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (BuildRuntime)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise<Models.Site> { - let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, buildRuntime: BuildRuntime, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, adapter?: Adapter, installationId?: string, fallbackFile?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { siteId: paramsOrFirst as string, @@ -168,9 +172,11 @@ export class Sites { providerBranch: rest[14] as string, providerSilentMode: rest[15] as boolean, providerRootDirectory: rest[16] as string, - buildSpecification: rest[17] as string, - runtimeSpecification: rest[18] as string, - deploymentRetention: rest[19] as number + providerBranches: rest[17] as string[], + providerPaths: rest[18] as string[], + buildSpecification: rest[19] as string, + runtimeSpecification: rest[20] as string, + deploymentRetention: rest[21] as number }; } @@ -192,6 +198,8 @@ export class Sites { const providerBranch = params.providerBranch; const providerSilentMode = params.providerSilentMode; const providerRootDirectory = params.providerRootDirectory; + const providerBranches = params.providerBranches; + const providerPaths = params.providerPaths; const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; @@ -265,6 +273,12 @@ export class Sites { if (typeof providerRootDirectory !== 'undefined') { payload['providerRootDirectory'] = providerRootDirectory; } + if (typeof providerBranches !== 'undefined') { + payload['providerBranches'] = providerBranches; + } + if (typeof providerPaths !== 'undefined') { + payload['providerPaths'] = providerPaths; + } if (typeof buildSpecification !== 'undefined') { payload['buildSpecification'] = buildSpecification; } @@ -406,13 +420,15 @@ export class Sites { * @param {string} params.providerBranch - Production branch for the repo linked to the site. * @param {boolean} params.providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. * @param {string} params.providerRootDirectory - Path to site code in the linked repo. + * @param {string[]} params.providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} params.providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} params.buildSpecification - Build specification for the site deployments. * @param {string} params.runtimeSpecification - Runtime specification for the SSR executions. * @param {number} params.deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. * @throws {AppwriteException} * @returns {Promise<Models.Site>} */ - update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; + update(params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }): Promise<Models.Site>; /** * Update site by its unique ID. * @@ -434,6 +450,8 @@ export class Sites { * @param {string} providerBranch - Production branch for the repo linked to the site. * @param {boolean} providerSilentMode - Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests. * @param {string} providerRootDirectory - Path to site code in the linked repo. + * @param {string[]} providerBranches - List of branch name patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all branches. + * @param {string[]} providerPaths - List of file path patterns to trigger automatic deployments. Supports wildcards. Leave empty to deploy on all file changes. * @param {string} buildSpecification - Build specification for the site deployments. * @param {string} runtimeSpecification - Runtime specification for the SSR executions. * @param {number} deploymentRetention - Days to keep non-active deployments before deletion. Value 0 means all deployments will be kept. @@ -441,15 +459,15 @@ export class Sites { * @returns {Promise<Models.Site>} * @deprecated Use the object parameter style method for a better developer experience. */ - update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; + update(siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number): Promise<Models.Site>; update( - paramsOrFirst: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, - ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string)?, (string)?, (number)?] + paramsOrFirst: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number } | string, + ...rest: [(string)?, (Framework)?, (boolean)?, (boolean)?, (number)?, (string)?, (string)?, (string)?, (string)?, (BuildRuntime)?, (Adapter)?, (string)?, (string)?, (string)?, (string)?, (boolean)?, (string)?, (string[])?, (string[])?, (string)?, (string)?, (number)?] ): Promise<Models.Site> { - let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + let params: { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; + params = (paramsOrFirst || {}) as { siteId: string, name: string, framework: Framework, enabled?: boolean, logging?: boolean, timeout?: number, installCommand?: string, buildCommand?: string, startCommand?: string, outputDirectory?: string, buildRuntime?: BuildRuntime, adapter?: Adapter, fallbackFile?: string, installationId?: string, providerRepositoryId?: string, providerBranch?: string, providerSilentMode?: boolean, providerRootDirectory?: string, providerBranches?: string[], providerPaths?: string[], buildSpecification?: string, runtimeSpecification?: string, deploymentRetention?: number }; } else { params = { siteId: paramsOrFirst as string, @@ -470,9 +488,11 @@ export class Sites { providerBranch: rest[14] as string, providerSilentMode: rest[15] as boolean, providerRootDirectory: rest[16] as string, - buildSpecification: rest[17] as string, - runtimeSpecification: rest[18] as string, - deploymentRetention: rest[19] as number + providerBranches: rest[17] as string[], + providerPaths: rest[18] as string[], + buildSpecification: rest[19] as string, + runtimeSpecification: rest[20] as string, + deploymentRetention: rest[21] as number }; } @@ -494,6 +514,8 @@ export class Sites { const providerBranch = params.providerBranch; const providerSilentMode = params.providerSilentMode; const providerRootDirectory = params.providerRootDirectory; + const providerBranches = params.providerBranches; + const providerPaths = params.providerPaths; const buildSpecification = params.buildSpecification; const runtimeSpecification = params.runtimeSpecification; const deploymentRetention = params.deploymentRetention; @@ -561,6 +583,12 @@ export class Sites { if (typeof providerRootDirectory !== 'undefined') { payload['providerRootDirectory'] = providerRootDirectory; } + if (typeof providerBranches !== 'undefined') { + payload['providerBranches'] = providerBranches; + } + if (typeof providerPaths !== 'undefined') { + payload['providerPaths'] = providerPaths; + } if (typeof buildSpecification !== 'undefined') { payload['buildSpecification'] = buildSpecification; } diff --git a/src/services/usage.ts b/src/services/usage.ts index 84c654ab..551274ee 100644 --- a/src/services/usage.ts +++ b/src/services/usage.ts @@ -70,7 +70,7 @@ export class Usage { } /** - * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, timestamp, resourceType, and resourceId. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. * * @param {string[]} params.queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. @@ -79,7 +79,7 @@ export class Usage { */ listGauges(params?: { queries?: string[], total?: boolean }): Promise<Models.UsageGaugeList>; /** - * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, and timestamp. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. + * Query usage gauge metrics (point-in-time resource snapshots) from the usage database. Returns individual gauge snapshots with metric, value, timestamp, resourceType, and resourceId. Pass Query objects as JSON strings to filter, paginate, and order results. Supported query methods: equal, greaterThanEqual, lessThanEqual, orderAsc, orderDesc, limit, offset. Supported filter attributes: metric, time. Use `orderDesc("time"), limit(1)` to fetch the most recent snapshot. When no time filter is supplied the endpoint defaults to the last 7 days. Default `limit(100)` is applied if none is given; user-supplied limits are capped at 500. The `total` field is capped at 5000 to keep counts predictable — pass `total=false` to skip the count entirely. * * @param {string[]} queries - Array of query strings as JSON. Supported: equal("metric", [...]), greaterThanEqual("time", "..."), lessThanEqual("time", "..."), orderAsc("time"), orderDesc("time"), limit(N), offset(N). * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. diff --git a/test/services/activities.test.js b/test/services/activities.test.js index 667ecc56..08d0d906 100644 --- a/test/services/activities.test.js +++ b/test/services/activities.test.js @@ -28,10 +28,10 @@ describe('Activities', () => { test('test method getEvent()', async () => { const data = { '\$id': '5e5ea5c16897e', - 'userType': 'user', - 'userId': '610fc2f985ee0', - 'userEmail': 'john@appwrite.io', - 'userName': 'John Doe', + 'actorType': 'user', + 'actorId': '610fc2f985ee0', + 'actorEmail': 'john@appwrite.io', + 'actorName': 'John Doe', 'resourceParent': 'database/ID', 'resourceType': 'collection', 'resourceId': '610fc2f985ee0', diff --git a/test/services/functions.test.js b/test/services/functions.test.js index f5e19c8d..02dd3d2c 100644 --- a/test/services/functions.test.js +++ b/test/services/functions.test.js @@ -55,6 +55,8 @@ describe('Functions', () => { 'providerBranch': 'main', 'providerRootDirectory': 'functions/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -131,6 +133,8 @@ describe('Functions', () => { 'providerBranch': 'main', 'providerRootDirectory': 'functions/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -175,6 +179,8 @@ describe('Functions', () => { 'providerBranch': 'main', 'providerRootDirectory': 'functions/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -234,6 +240,8 @@ describe('Functions', () => { 'providerBranch': 'main', 'providerRootDirectory': 'functions/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb',}; mockedFetch.mockImplementation(() => Response.json(data)); diff --git a/test/services/organization.test.js b/test/services/organization.test.js new file mode 100644 index 00000000..b9ede1fc --- /dev/null +++ b/test/services/organization.test.js @@ -0,0 +1,265 @@ +const { Client } = require("../../dist/client"); +const { InputFile } = require("../../dist/inputFile"); +const { Organization } = require("../../dist/services/organization"); + +const { fetch: mockedFetch, Response } = require("node-fetch-native-with-agent"); +jest.mock('node-fetch-native-with-agent', () => ({ ...jest.requireActual('node-fetch-native-with-agent'), fetch: jest.fn() })); + +describe('Organization', () => { + const client = new Client(); + const organization = new Organization(client); + + + test('test method listKeys()', async () => { + const data = { + 'total': 5, + 'keys': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.listKeys( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.createKey( + '<KEY_ID>', + '<NAME>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.getKey( + '<KEY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateKey()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'My API Key', + 'expire': '2020-10-15T06:38:00.000+00:00', + 'scopes': [], + 'secret': '919c2d18fb5d4...a2ae413da83346ad2', + 'accessedAt': '2020-10-15T06:38:00.000+00:00', + 'sdks': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.updateKey( + '<KEY_ID>', + '<NAME>', + [], + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteKey()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.deleteKey( + '<KEY_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method listProjects()', async () => { + const data = { + 'total': 5, + 'projects': [],}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.listProjects( + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method createProject()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.createProject( + '', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method getProject()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.getProject( + '<PROJECT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method updateProject()', async () => { + const data = { + '\$id': '5e5ea5c16897e', + '\$createdAt': '2020-10-15T06:38:00.000+00:00', + '\$updatedAt': '2020-10-15T06:38:00.000+00:00', + 'name': 'New Project', + 'teamId': '1592981250', + 'devKeys': [], + 'smtpEnabled': true, + 'smtpSenderName': 'John Appwrite', + 'smtpSenderEmail': 'john@appwrite.io', + 'smtpReplyToName': 'Support Team', + 'smtpReplyToEmail': 'support@appwrite.io', + 'smtpHost': 'mail.appwrite.io', + 'smtpPort': 25, + 'smtpUsername': 'emailuser', + 'smtpPassword': '', + 'smtpSecure': 'tls', + 'pingCount': 1, + 'pingedAt': '2020-10-15T06:38:00.000+00:00', + 'labels': [], + 'status': 'active', + 'authMethods': [], + 'services': [], + 'protocols': [], + 'region': 'fra', + 'blocks': [], + 'consoleAccessedAt': '2020-10-15T06:38:00.000+00:00',}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.updateProject( + '<PROJECT_ID>', + '<NAME>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + + test('test method deleteProject()', async () => { + const data = {message: ""}; + mockedFetch.mockImplementation(() => Response.json(data)); + + const response = await organization.deleteProject( + '<PROJECT_ID>', + ); + + // Remove custom toString method on the objects to allow for clean data comparison. + delete response.toString; + + expect(response).toEqual(data); + }); + }) diff --git a/test/services/presences.test.js b/test/services/presences.test.js index 2b43154c..e6e25bb8 100644 --- a/test/services/presences.test.js +++ b/test/services/presences.test.js @@ -67,7 +67,7 @@ describe('Presences', () => { expect(response).toEqual(data); }); - test('test method updatePresence()', async () => { + test('test method update()', async () => { const data = { '\$id': '5e5ea5c16897e', '\$createdAt': '2020-10-15T06:38:00.000+00:00', @@ -77,7 +77,7 @@ describe('Presences', () => { 'source': 'HTTP',}; mockedFetch.mockImplementation(() => Response.json(data)); - const response = await presences.updatePresence( + const response = await presences.update( '<PRESENCE_ID>', '<USER_ID>', ); diff --git a/test/services/project.test.js b/test/services/project.test.js index 7a18b7e7..3f46e8c9 100644 --- a/test/services/project.test.js +++ b/test/services/project.test.js @@ -374,7 +374,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'amzn1.application-oa2-client.87400c00000000000000000000063d5b2', - 'clientSecret': '79ffe4000000000000000000000000000000000000000000000000000002de55',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Amazon( @@ -410,7 +410,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'OaOkIA000000000000000000005KLSYq', - 'clientSecret': 'zXz0000-00000000000000000000000000000-00000000000000000000PJafnF', + 'clientSecret': 'your-oauth2-client-secret', 'endpoint': 'example.us.auth0.com',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -428,7 +428,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'dTKOPa0000000000000000000000000000e7G8hv', - 'clientSecret': 'ntQadq000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Hp5WK', + 'clientSecret': 'your-oauth2-client-secret', 'endpoint': 'example.authentik.com',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -446,7 +446,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '5zw90v00000000000000000000kVYXN7', - 'clientSecret': '7I000000000000MW',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Autodesk( @@ -463,7 +463,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'key': 'Knt70000000000ByRc', - 'secret': 'NMfLZJ00000000000000000000TLQdDx',}; + 'secret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Bitbucket( @@ -480,7 +480,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'd95151000000000000000000000000000067af9b', - 'clientSecret': 'a13e250000000000000000000000000000d73095',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Bitly( @@ -497,7 +497,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'deglcs00000000000000000000x2og6y', - 'clientSecret': 'OKM1f100000000000000000000eshEif',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Box( @@ -514,7 +514,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'apiKey': '07a9000000000000067f', - 'apiSecret': 'a399a90000000000000000000000000000d90639',}; + 'apiSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Dailymotion( @@ -531,7 +531,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '950722000000343754', - 'clientSecret': 'YmPXnM000000000000000000002zFg5D',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Discord( @@ -548,7 +548,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'publicKey': 'cgegH70000000000000000000000000000000000000000000000000000Hr1nYX', - 'secretKey': 'W7Bykj00000000000000000000000000000000000000000000000000003o43w9',}; + 'secretKey': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Disqus( @@ -565,7 +565,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'appKey': 'jl000000000009t', - 'appSecret': 'g200000000000vw',}; + 'appSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Dropbox( @@ -582,7 +582,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'keyString': 'nsgzxh0000000000008j85a2', - 'sharedSecret': 'tp000000ru',}; + 'sharedSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Etsy( @@ -599,7 +599,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'appId': '260600000007694', - 'appSecret': '2d0b2800000000000000000000d38af4',}; + 'appSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Facebook( @@ -616,7 +616,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'byay5H0000000000VtiI40', - 'clientSecret': 'yEpOYn0000000000000000004iIsU5',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Figma( @@ -633,7 +633,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'b2222c00-0000-0000-0000-000000862097', - 'clientSecret': 'Jx4s0C0000000000000000000000000000000wGqLsc', + 'clientSecret': 'your-oauth2-client-secret', 'endpoint': 'example.fusionauth.io',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -651,7 +651,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'e4d87900000000540733', - 'clientSecret': '5e07c00000000000000000000000000000198bcc',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2GitHub( @@ -668,7 +668,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'applicationId': 'd41ffe0000000000000000000000000000000000000000000000000000d5e252', - 'secret': 'gloas-838cfa0000000000000000000000000000000000000000000000000000ecbb38', + 'secret': 'your-oauth2-client-secret', 'endpoint': 'https://gitlab.com',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -686,7 +686,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '120000000095-92ifjb00000000000000000000g7ijfb.apps.googleusercontent.com', - 'clientSecret': 'example-google-client-secret', + 'clientSecret': 'your-oauth2-client-secret', 'prompt': [],}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -704,7 +704,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'appwrite-o0000000st-app', - 'clientSecret': 'jdjrJd00000000000000000000HUsaZO', + 'clientSecret': 'your-oauth2-client-secret', 'endpoint': 'keycloak.example.com', 'realmName': 'appwrite-realm',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -723,7 +723,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '01KQ7C00000000000001MFHS32', - 'clientSecret': '34ac5600000000000000000000000000000000000000000000000000e830c8b',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Kick( @@ -740,7 +740,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '770000000000dv', - 'primaryClientSecret': 'example-linkedin-client-secret',}; + 'primaryClientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Linkedin( @@ -757,7 +757,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'applicationSecret': 'your-oauth2-client-secret', 'tenant': 'common',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -775,7 +775,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'oauthClientId': '341d8700-0000-0000-0000-000000446ee3', - 'oauthClientSecret': 'secret_dLUr4b000000000000000000000000000000lFHAa9',}; + 'oauthClientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Notion( @@ -792,7 +792,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'qibI2x0000000000000000000000000006L2YFoG', - 'clientSecret': 'Ah68ed000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003qpcHV', + 'clientSecret': 'your-oauth2-client-secret', 'wellKnownURL': 'https://myoauth.com/.well-known/openid-configuration', 'authorizationURL': 'https://myoauth.com/oauth2/authorize', 'tokenURL': 'https://myoauth.com/oauth2/token', @@ -813,7 +813,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '0oa00000000000000698', - 'clientSecret': 'Kiq0000000000000000000000000000000000000-00000000000H2L5-3SJ-vRV', + 'clientSecret': 'your-oauth2-client-secret', 'domain': 'trial-6400025.okta.com', 'authorizationServerId': 'aus000000000000000h7z',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -832,7 +832,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + 'secretKey': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Paypal( @@ -849,7 +849,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'AdhIEG7-000000000000-0000000000000000000000000000000-0000000000000000000000-2pyB', - 'secretKey': 'EH8KCXtew--000000000000000000000000000000000000000_C-1_5UP_000000000000000CB7KDp',}; + 'secretKey': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2PaypalSandbox( @@ -866,7 +866,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'appwrite-oauth-test-app', - 'clientSecret': 'Rn247T0000000000000000000000000000000000000000000000000000W2zWTN',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Podio( @@ -883,7 +883,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'customerKey': '3MVG9I0000000000000000000000000000000000000000000000000000000000000000000000000C5Aejq', - 'customerSecret': '3w000000000000e2',}; + 'customerSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Salesforce( @@ -900,7 +900,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '23000000089.15000000000023', - 'clientSecret': '81656000000000000000000000f3d2fd',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Slack( @@ -917,7 +917,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '6ec271000000000000000000009beace', - 'clientSecret': 'db068a000000000000000000008b5b9f',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Spotify( @@ -934,7 +934,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'ca_UKibXX0000000000000000000006byvR', - 'apiSecretKey': 'sk_51SfOd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000QGWYfp',}; + 'apiSecretKey': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Stripe( @@ -951,7 +951,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + 'oauth2ClientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Tradeshift( @@ -968,7 +968,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'oauth2ClientId': 'appwrite-test-org.appwrite-test-app', - 'oauth2ClientSecret': '7cb52700-0000-0000-0000-000000ca5b83',}; + 'oauth2ClientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2TradeshiftSandbox( @@ -985,7 +985,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'vvi0in000000000000000000ikmt9p', - 'clientSecret': 'pmapue000000000000000000zylw3v',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Twitch( @@ -1002,7 +1002,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '130005', - 'clientSecret': 'PlBfJS0000000000000000000000000000000000000000000000000000EdUZJk',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2WordPress( @@ -1019,7 +1019,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'customerKey': 'slzZV0000000000000NFLaWT', - 'secretKey': 'tkEPkp00000000000000000000000000000000000000FTxbI9',}; + 'secretKey': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2X( @@ -1036,7 +1036,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'dj0yJm000000000000000000000000000000000000000000000000000000000000000000000000000000000000Z4PWRm', - 'clientSecret': 'cf978f0000000000000000000000000000c5e2e9',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Yahoo( @@ -1053,7 +1053,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '6a8a6a0000000000000000000091483c', - 'clientSecret': 'bbf98500000000000000000000c75a63',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Yandex( @@ -1070,7 +1070,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': '1000.83C178000000000000000000RPNX0B', - 'clientSecret': 'fb5cac000000000000000000000000000000a68f6e',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Zoho( @@ -1087,7 +1087,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'clientId': 'QMAC00000000000000w0AQ', - 'clientSecret': 'GAWsG4000000000000000000007U01ON',}; + 'clientSecret': 'your-oauth2-client-secret',}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.updateOAuth2Zoom( @@ -1104,7 +1104,7 @@ describe('Project', () => { '\$id': 'github', 'enabled': true, 'applicationId': '00001111-aaaa-2222-bbbb-3333cccc4444', - 'applicationSecret': 'A1bC2dE3fH4iJ5kL6mN7oP8qR9sT0u', + 'applicationSecret': 'your-oauth2-client-secret', 'tenant': 'common',}; mockedFetch.mockImplementation(() => Response.json(data)); @@ -1884,11 +1884,7 @@ describe('Project', () => { test('test method getPolicy()', async () => { const data = { '\$id': 'password-dictionary', - 'userId': true, - 'userEmail': true, - 'userPhone': true, - 'userName': true, - 'userMFA': true,}; + 'enabled': true,}; mockedFetch.mockImplementation(() => Response.json(data)); const response = await project.getPolicy( diff --git a/test/services/sites.test.js b/test/services/sites.test.js index 11e9f6da..64525f11 100644 --- a/test/services/sites.test.js +++ b/test/services/sites.test.js @@ -54,6 +54,8 @@ describe('Sites', () => { 'providerBranch': 'main', 'providerRootDirectory': 'sites/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb', 'buildRuntime': 'node-22', @@ -133,6 +135,8 @@ describe('Sites', () => { 'providerBranch': 'main', 'providerRootDirectory': 'sites/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb', 'buildRuntime': 'node-22', @@ -179,6 +183,8 @@ describe('Sites', () => { 'providerBranch': 'main', 'providerRootDirectory': 'sites/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb', 'buildRuntime': 'node-22', @@ -241,6 +247,8 @@ describe('Sites', () => { 'providerBranch': 'main', 'providerRootDirectory': 'sites/helloWorld', 'providerSilentMode': true, + 'providerBranches': [], + 'providerPaths': [], 'buildSpecification': 's-1vcpu-512mb', 'runtimeSpecification': 's-1vcpu-512mb', 'buildRuntime': 'node-22',