From 622e7da4c6f6fa425a1ba6cf21a7bc70d8d946e6 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Tue, 19 May 2026 14:41:36 +0530 Subject: [PATCH 01/12] chore: update Web SDK to 26.0.0 --- CHANGELOG.md | 9 + README.md | 2 +- .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- .../account/delete-mfa-authenticator.md | 2 +- .../account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/list-mfa-factors.md | 2 +- .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- .../account/update-mfa-recovery-codes.md | 2 +- .../get-event.md} | 8 +- docs/examples/activities/list-events.md | 15 + docs/examples/advisor/delete-report.md | 15 + docs/examples/advisor/get-insight.md | 16 + docs/examples/advisor/get-report.md | 15 + docs/examples/advisor/list-insights.md | 17 + docs/examples/advisor/list-reports.md | 16 + docs/examples/backups/create-archive.md | 16 + docs/examples/backups/create-policy.md | 21 + docs/examples/backups/create-restoration.md | 18 + docs/examples/backups/delete-archive.md | 15 + docs/examples/backups/delete-policy.md | 15 + docs/examples/backups/get-archive.md | 15 + docs/examples/backups/get-policy.md | 15 + docs/examples/backups/get-restoration.md | 15 + docs/examples/backups/list-archives.md | 15 + docs/examples/backups/list-policies.md | 15 + docs/examples/backups/list-restorations.md | 15 + docs/examples/backups/update-policy.md | 19 + .../databases/create-big-int-attribute.md | 22 + .../databases/create-boolean-attribute.md | 20 + docs/examples/databases/create-collection.md | 22 + .../databases/create-datetime-attribute.md | 20 + docs/examples/databases/create-document.md | 5 +- .../databases/create-email-attribute.md | 20 + .../databases/create-enum-attribute.md | 21 + .../databases/create-float-attribute.md | 22 + docs/examples/databases/create-index.md | 21 + .../databases/create-integer-attribute.md | 22 + .../examples/databases/create-ip-attribute.md | 20 + .../databases/create-line-attribute.md | 19 + .../databases/create-longtext-attribute.md | 21 + .../databases/create-mediumtext-attribute.md | 21 + .../databases/create-point-attribute.md | 19 + .../databases/create-polygon-attribute.md | 19 + .../create-relationship-attribute.md | 22 + .../databases/create-string-attribute.md | 22 + .../databases/create-text-attribute.md | 21 + .../databases/create-url-attribute.md | 20 + .../databases/create-varchar-attribute.md | 22 + docs/examples/databases/create.md | 17 + docs/examples/databases/delete-attribute.md | 17 + docs/examples/databases/delete-collection.md | 16 + docs/examples/databases/delete-documents.md | 18 + docs/examples/databases/delete-index.md | 17 + docs/examples/databases/delete.md | 15 + docs/examples/databases/get-attribute.md | 17 + docs/examples/databases/get-collection.md | 16 + docs/examples/databases/get-index.md | 17 + docs/examples/databases/get.md | 15 + docs/examples/databases/list-attributes.md | 18 + docs/examples/databases/list-collections.md | 18 + docs/examples/databases/list-indexes.md | 18 + docs/examples/databases/list.md | 17 + .../databases/update-big-int-attribute.md | 22 + .../databases/update-boolean-attribute.md | 20 + docs/examples/databases/update-collection.md | 21 + .../databases/update-datetime-attribute.md | 20 + docs/examples/databases/update-documents.md | 25 + .../databases/update-email-attribute.md | 20 + .../databases/update-enum-attribute.md | 21 + .../databases/update-float-attribute.md | 22 + .../databases/update-integer-attribute.md | 22 + .../examples/databases/update-ip-attribute.md | 20 + .../databases/update-line-attribute.md | 20 + .../databases/update-longtext-attribute.md | 20 + .../databases/update-mediumtext-attribute.md | 20 + .../databases/update-point-attribute.md | 20 + .../databases/update-polygon-attribute.md | 20 + .../update-relationship-attribute.md | 19 + .../databases/update-string-attribute.md | 21 + .../databases/update-text-attribute.md | 20 + .../databases/update-url-attribute.md | 20 + .../databases/update-varchar-attribute.md | 21 + docs/examples/databases/update.md | 17 + docs/examples/databases/upsert-documents.md | 18 + docs/examples/functions/create-deployment.md | 19 + .../functions/create-duplicate-deployment.md | 17 + .../functions/create-template-deployment.md | 21 + docs/examples/functions/create-variable.md | 19 + .../functions/create-vcs-deployment.md | 18 + docs/examples/functions/create.md | 34 + docs/examples/functions/delete-deployment.md | 16 + docs/examples/functions/delete-execution.md | 16 + docs/examples/functions/delete-variable.md | 16 + docs/examples/functions/delete.md | 15 + .../functions/get-deployment-download.md | 17 + docs/examples/functions/get-deployment.md | 16 + docs/examples/functions/get-variable.md | 16 + docs/examples/functions/get.md | 15 + docs/examples/functions/list-deployments.md | 18 + docs/examples/functions/list-runtimes.md | 13 + .../examples/functions/list-specifications.md | 13 + docs/examples/functions/list-variables.md | 17 + docs/examples/functions/list.md | 17 + .../functions/update-deployment-status.md | 16 + .../functions/update-function-deployment.md | 16 + docs/examples/functions/update-variable.md | 19 + docs/examples/functions/update.md | 34 + docs/examples/health/get-antivirus.md | 13 + docs/examples/health/get-cache.md | 13 + docs/examples/health/get-certificate.md | 15 + docs/examples/health/get-console-pausing.md | 16 + docs/examples/health/get-db.md | 13 + docs/examples/health/get-failed-jobs.md | 16 + docs/examples/health/get-pub-sub.md | 13 + docs/examples/health/get-queue-audits.md | 15 + docs/examples/health/get-queue-builds.md | 15 + .../examples/health/get-queue-certificates.md | 15 + docs/examples/health/get-queue-databases.md | 16 + docs/examples/health/get-queue-deletes.md | 15 + docs/examples/health/get-queue-functions.md | 15 + docs/examples/health/get-queue-logs.md | 15 + docs/examples/health/get-queue-mails.md | 15 + docs/examples/health/get-queue-messaging.md | 15 + docs/examples/health/get-queue-migrations.md | 15 + .../health/get-queue-stats-resources.md | 15 + docs/examples/health/get-queue-usage.md | 15 + docs/examples/health/get-queue-webhooks.md | 15 + docs/examples/health/get-storage-local.md | 13 + docs/examples/health/get-storage.md | 13 + docs/examples/health/get-time.md | 13 + docs/examples/health/get.md | 13 + .../messaging/create-apns-provider.md | 22 + docs/examples/messaging/create-email.md | 26 + .../examples/messaging/create-fcm-provider.md | 18 + .../messaging/create-mailgun-provider.md | 24 + .../messaging/create-msg-91-provider.md | 20 + docs/examples/messaging/create-push.md | 33 + .../messaging/create-resend-provider.md | 22 + .../messaging/create-sendgrid-provider.md | 22 + docs/examples/messaging/create-sms.md | 21 + .../messaging/create-smtp-provider.md | 28 + .../messaging/create-telesign-provider.md | 20 + .../messaging/create-textmagic-provider.md | 20 + docs/examples/messaging/create-topic.md | 17 + .../messaging/create-twilio-provider.md | 20 + .../messaging/create-vonage-provider.md | 20 + docs/examples/messaging/delete-provider.md | 15 + docs/examples/messaging/delete-topic.md | 15 + docs/examples/messaging/delete.md | 15 + docs/examples/messaging/get-message.md | 15 + docs/examples/messaging/get-provider.md | 15 + docs/examples/messaging/get-subscriber.md | 16 + docs/examples/messaging/get-topic.md | 15 + docs/examples/messaging/list-message-logs.md | 17 + docs/examples/messaging/list-messages.md | 17 + docs/examples/messaging/list-provider-logs.md | 17 + docs/examples/messaging/list-providers.md | 17 + .../messaging/list-subscriber-logs.md | 17 + docs/examples/messaging/list-subscribers.md | 18 + docs/examples/messaging/list-targets.md | 17 + docs/examples/messaging/list-topic-logs.md | 17 + docs/examples/messaging/list-topics.md | 17 + .../messaging/update-apns-provider.md | 22 + docs/examples/messaging/update-email.md | 26 + .../examples/messaging/update-fcm-provider.md | 18 + .../messaging/update-mailgun-provider.md | 24 + .../messaging/update-msg-91-provider.md | 20 + docs/examples/messaging/update-push.md | 33 + .../messaging/update-resend-provider.md | 22 + .../messaging/update-sendgrid-provider.md | 22 + docs/examples/messaging/update-sms.md | 21 + .../messaging/update-smtp-provider.md | 28 + .../messaging/update-telesign-provider.md | 20 + .../messaging/update-textmagic-provider.md | 20 + docs/examples/messaging/update-topic.md | 17 + .../messaging/update-twilio-provider.md | 20 + .../messaging/update-vonage-provider.md | 20 + docs/examples/presences/update.md | 1 + docs/examples/presences/upsert.md | 1 + .../project/create-android-platform.md | 17 + .../examples/project/create-apple-platform.md | 17 + docs/examples/project/create-ephemeral-key.md | 16 + docs/examples/project/create-key.md | 18 + .../examples/project/create-linux-platform.md | 17 + docs/examples/project/create-mock-phone.md | 16 + docs/examples/project/create-smtp-test.md | 15 + docs/examples/project/create-variable.md | 18 + docs/examples/project/create-web-platform.md | 17 + .../project/create-windows-platform.md | 17 + docs/examples/project/delete-key.md | 15 + docs/examples/project/delete-mock-phone.md | 15 + docs/examples/project/delete-platform.md | 15 + docs/examples/project/delete-variable.md | 15 + docs/examples/project/delete.md | 13 + docs/examples/project/get-email-template.md | 16 + docs/examples/project/get-key.md | 15 + docs/examples/project/get-mock-phone.md | 15 + .../examples/project/get-o-auth-2-provider.md | 15 + docs/examples/project/get-platform.md | 15 + docs/examples/project/get-policy.md | 15 + docs/examples/project/get-variable.md | 15 + docs/examples/project/get.md | 13 + docs/examples/project/list-email-templates.md | 16 + docs/examples/project/list-keys.md | 16 + docs/examples/project/list-mock-phones.md | 16 + .../project/list-o-auth-2-providers.md | 16 + docs/examples/project/list-platforms.md | 16 + docs/examples/project/list-policies.md | 16 + docs/examples/project/list-variables.md | 16 + .../project/update-android-platform.md | 17 + .../examples/project/update-apple-platform.md | 17 + docs/examples/project/update-auth-method.md | 16 + .../update-deny-aliased-email-policy.md | 15 + .../update-deny-disposable-email-policy.md | 15 + .../project/update-deny-free-email-policy.md | 15 + .../examples/project/update-email-template.md | 22 + docs/examples/project/update-key.md | 18 + docs/examples/project/update-labels.md | 15 + .../examples/project/update-linux-platform.md | 17 + .../update-membership-privacy-policy.md | 19 + docs/examples/project/update-mock-phone.md | 16 + .../project/update-o-auth-2-amazon.md | 17 + .../examples/project/update-o-auth-2-apple.md | 19 + .../project/update-o-auth-2-auth-0.md | 18 + .../project/update-o-auth-2-authentik.md | 18 + .../project/update-o-auth-2-autodesk.md | 17 + .../project/update-o-auth-2-bitbucket.md | 17 + .../examples/project/update-o-auth-2-bitly.md | 17 + docs/examples/project/update-o-auth-2-box.md | 17 + .../project/update-o-auth-2-dailymotion.md | 17 + .../project/update-o-auth-2-discord.md | 17 + .../project/update-o-auth-2-disqus.md | 17 + .../project/update-o-auth-2-dropbox.md | 17 + docs/examples/project/update-o-auth-2-etsy.md | 17 + .../project/update-o-auth-2-facebook.md | 17 + .../examples/project/update-o-auth-2-figma.md | 17 + .../project/update-o-auth-2-fusion-auth.md | 18 + .../project/update-o-auth-2-git-hub.md | 17 + .../project/update-o-auth-2-gitlab.md | 18 + .../project/update-o-auth-2-google.md | 18 + .../project/update-o-auth-2-keycloak.md | 19 + docs/examples/project/update-o-auth-2-kick.md | 17 + .../project/update-o-auth-2-linkedin.md | 17 + .../project/update-o-auth-2-microsoft.md | 18 + .../project/update-o-auth-2-notion.md | 17 + docs/examples/project/update-o-auth-2-oidc.md | 21 + docs/examples/project/update-o-auth-2-okta.md | 19 + .../project/update-o-auth-2-paypal-sandbox.md | 17 + .../project/update-o-auth-2-paypal.md | 17 + .../examples/project/update-o-auth-2-podio.md | 17 + .../project/update-o-auth-2-salesforce.md | 17 + .../examples/project/update-o-auth-2-slack.md | 17 + .../project/update-o-auth-2-spotify.md | 17 + .../project/update-o-auth-2-stripe.md | 17 + .../update-o-auth-2-tradeshift-sandbox.md | 17 + .../project/update-o-auth-2-tradeshift.md | 17 + .../project/update-o-auth-2-twitch.md | 17 + .../project/update-o-auth-2-word-press.md | 17 + .../examples/project/update-o-auth-2-yahoo.md | 17 + .../project/update-o-auth-2-yandex.md | 17 + docs/examples/project/update-o-auth-2-zoho.md | 17 + docs/examples/project/update-o-auth-2-zoom.md | 17 + docs/examples/project/update-o-auth-2x.md | 17 + .../update-password-dictionary-policy.md | 15 + .../project/update-password-history-policy.md | 15 + .../update-password-personal-data-policy.md | 15 + docs/examples/project/update-protocol.md | 16 + docs/examples/project/update-service.md | 16 + .../project/update-session-alert-policy.md | 15 + .../project/update-session-duration-policy.md | 15 + .../update-session-invalidation-policy.md | 15 + .../project/update-session-limit-policy.md | 15 + docs/examples/project/update-smtp.md | 24 + .../project/update-user-limit-policy.md | 15 + docs/examples/project/update-variable.md | 18 + docs/examples/project/update-web-platform.md | 17 + .../project/update-windows-platform.md | 17 + docs/examples/proxy/create-api-rule.md | 15 + docs/examples/proxy/create-function-rule.md | 17 + docs/examples/proxy/create-redirect-rule.md | 19 + docs/examples/proxy/create-site-rule.md | 17 + docs/examples/proxy/delete-rule.md | 15 + docs/examples/proxy/get-rule.md | 15 + docs/examples/proxy/list-rules.md | 16 + docs/examples/proxy/update-rule-status.md | 15 + docs/examples/sites/create-deployment.md | 20 + .../sites/create-duplicate-deployment.md | 16 + .../sites/create-template-deployment.md | 21 + docs/examples/sites/create-variable.md | 19 + docs/examples/sites/create-vcs-deployment.md | 18 + docs/examples/sites/create.md | 35 + docs/examples/sites/delete-deployment.md | 16 + docs/examples/sites/delete-log.md | 16 + docs/examples/sites/delete-variable.md | 16 + docs/examples/sites/delete.md | 15 + .../examples/sites/get-deployment-download.md | 17 + docs/examples/sites/get-deployment.md | 16 + docs/examples/sites/get-log.md | 16 + docs/examples/sites/get-variable.md | 16 + docs/examples/sites/get.md | 15 + docs/examples/sites/list-deployments.md | 18 + docs/examples/sites/list-frameworks.md | 13 + docs/examples/sites/list-logs.md | 17 + docs/examples/sites/list-specifications.md | 13 + docs/examples/sites/list-variables.md | 17 + docs/examples/sites/list.md | 17 + .../sites/update-deployment-status.md | 16 + docs/examples/sites/update-site-deployment.md | 16 + docs/examples/sites/update-variable.md | 19 + docs/examples/sites/update.md | 35 + docs/examples/storage/create-bucket.md | 25 + docs/examples/storage/delete-bucket.md | 15 + docs/examples/storage/get-bucket.md | 15 + docs/examples/storage/list-buckets.md | 17 + docs/examples/storage/update-bucket.md | 25 + .../tablesdb/create-big-int-column.md | 22 + .../tablesdb/create-boolean-column.md | 20 + .../tablesdb/create-datetime-column.md | 20 + docs/examples/tablesdb/create-email-column.md | 20 + docs/examples/tablesdb/create-enum-column.md | 21 + docs/examples/tablesdb/create-float-column.md | 22 + docs/examples/tablesdb/create-index.md | 21 + .../tablesdb/create-integer-column.md | 22 + docs/examples/tablesdb/create-ip-column.md | 20 + docs/examples/tablesdb/create-line-column.md | 19 + .../tablesdb/create-longtext-column.md | 21 + .../tablesdb/create-mediumtext-column.md | 21 + docs/examples/tablesdb/create-point-column.md | 19 + .../tablesdb/create-polygon-column.md | 19 + .../tablesdb/create-relationship-column.md | 22 + docs/examples/tablesdb/create-row.md | 5 +- .../examples/tablesdb/create-string-column.md | 22 + docs/examples/tablesdb/create-table.md | 22 + docs/examples/tablesdb/create-text-column.md | 21 + docs/examples/tablesdb/create-url-column.md | 20 + .../tablesdb/create-varchar-column.md | 22 + docs/examples/tablesdb/create.md | 17 + docs/examples/tablesdb/delete-column.md | 17 + docs/examples/tablesdb/delete-index.md | 17 + docs/examples/tablesdb/delete-rows.md | 18 + docs/examples/tablesdb/delete-table.md | 16 + docs/examples/tablesdb/delete.md | 15 + docs/examples/tablesdb/get-column.md | 17 + docs/examples/tablesdb/get-index.md | 17 + docs/examples/tablesdb/get-table.md | 16 + docs/examples/tablesdb/get.md | 15 + docs/examples/tablesdb/list-columns.md | 18 + docs/examples/tablesdb/list-indexes.md | 18 + docs/examples/tablesdb/list-tables.md | 18 + docs/examples/tablesdb/list.md | 17 + .../tablesdb/update-big-int-column.md | 22 + .../tablesdb/update-boolean-column.md | 20 + .../tablesdb/update-datetime-column.md | 20 + docs/examples/tablesdb/update-email-column.md | 20 + docs/examples/tablesdb/update-enum-column.md | 21 + docs/examples/tablesdb/update-float-column.md | 22 + .../tablesdb/update-integer-column.md | 22 + docs/examples/tablesdb/update-ip-column.md | 20 + docs/examples/tablesdb/update-line-column.md | 20 + .../tablesdb/update-longtext-column.md | 20 + .../tablesdb/update-mediumtext-column.md | 20 + docs/examples/tablesdb/update-point-column.md | 20 + .../tablesdb/update-polygon-column.md | 20 + .../tablesdb/update-relationship-column.md | 19 + docs/examples/tablesdb/update-rows.md | 25 + .../examples/tablesdb/update-string-column.md | 21 + docs/examples/tablesdb/update-table.md | 21 + docs/examples/tablesdb/update-text-column.md | 20 + docs/examples/tablesdb/update-url-column.md | 20 + .../tablesdb/update-varchar-column.md | 21 + docs/examples/tablesdb/update.md | 17 + docs/examples/tablesdb/upsert-rows.md | 18 + docs/examples/tokens/create-file-token.md | 17 + docs/examples/tokens/delete.md | 15 + docs/examples/tokens/get.md | 15 + docs/examples/tokens/list.md | 18 + docs/examples/tokens/update.md | 16 + docs/examples/usage/list-events.md | 16 + docs/examples/usage/list-gauges.md | 16 + docs/examples/users/create-argon-2-user.md | 18 + docs/examples/users/create-bcrypt-user.md | 18 + docs/examples/users/create-jwt.md | 17 + docs/examples/users/create-md-5-user.md | 18 + .../users/create-mfa-recovery-codes.md | 15 + docs/examples/users/create-ph-pass-user.md | 18 + .../users/create-scrypt-modified-user.md | 21 + docs/examples/users/create-scrypt-user.md | 23 + docs/examples/users/create-session.md | 15 + docs/examples/users/create-sha-user.md | 19 + docs/examples/users/create-target.md | 20 + docs/examples/users/create-token.md | 17 + docs/examples/users/create.md | 19 + docs/examples/users/delete-identity.md | 15 + .../users/delete-mfa-authenticator.md | 16 + .../delete-session.md} | 8 +- docs/examples/users/delete-sessions.md | 15 + docs/examples/users/delete-target.md | 16 + docs/examples/users/delete.md | 15 + docs/examples/users/get-mfa-recovery-codes.md | 15 + docs/examples/users/get-prefs.md | 15 + docs/examples/users/get-target.md | 16 + docs/examples/users/get.md | 15 + docs/examples/users/list-identities.md | 17 + docs/examples/users/list-logs.md | 17 + docs/examples/users/list-memberships.md | 18 + docs/examples/users/list-mfa-factors.md | 15 + docs/examples/users/list-sessions.md | 16 + docs/examples/users/list-targets.md | 17 + docs/examples/users/list.md | 17 + .../users/update-email-verification.md | 16 + docs/examples/users/update-email.md | 16 + docs/examples/users/update-impersonator.md | 16 + docs/examples/users/update-labels.md | 16 + .../users/update-mfa-recovery-codes.md | 15 + docs/examples/users/update-mfa.md | 16 + docs/examples/users/update-name.md | 16 + docs/examples/users/update-password.md | 16 + .../users/update-phone-verification.md | 16 + docs/examples/users/update-phone.md | 16 + docs/examples/users/update-prefs.md | 16 + docs/examples/users/update-status.md | 16 + docs/examples/users/update-target.md | 19 + docs/examples/webhooks/create.md | 23 + docs/examples/webhooks/delete.md | 15 + docs/examples/webhooks/get.md | 15 + docs/examples/webhooks/list.md | 16 + docs/examples/webhooks/update-secret.md | 16 + docs/examples/webhooks/update.md | 22 + package-lock.json | 4 +- package.json | 2 +- src/client.ts | 388 +- src/enums/adapter.ts | 4 + src/enums/attribute-status.ts | 7 + src/enums/backup-services.ts | 8 + src/enums/build-runtime.ts | 91 + src/enums/column-status.ts | 7 + src/enums/compression.ts | 5 + 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/framework.ts | 17 + src/enums/health-antivirus-status.ts | 5 + src/enums/health-check-status.ts | 4 + 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/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 | 91 + 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/vcs-reference-type.ts | 5 + src/index.ts | 57 +- src/models.ts | 6951 +++++++++++++++-- src/services/account.ts | 539 +- src/services/activities.ts | 123 + src/services/advisor.ts | 316 + src/services/avatars.ts | 40 +- src/services/backups.ts | 761 ++ src/services/databases.ts | 5280 ++++++++++++- src/services/functions.ts | 1965 ++++- src/services/graphql.ts | 25 +- src/services/health.ts | 1050 +++ src/services/locale.ts | 25 +- src/services/messaging.ts | 4215 +++++++++- src/services/presences.ts | 79 +- src/services/project.ts | 6466 +++++++++++++++ src/services/proxy.ts | 548 ++ src/services/realtime.ts | 34 +- src/services/sites.ts | 1924 +++++ src/services/storage.ts | 455 +- src/services/tables-db.ts | 5166 +++++++++++- src/services/teams.ts | 25 +- src/services/tokens.ts | 322 + src/services/usage.ts | 137 + src/services/users.ts | 2948 +++++++ src/services/webhooks.ts | 473 ++ 503 files changed, 46998 insertions(+), 1608 deletions(-) rename docs/examples/{account/create-verification.md => activities/get-event.md} (56%) 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/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-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-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-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/delete-attribute.md create mode 100644 docs/examples/databases/delete-collection.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.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-index.md create mode 100644 docs/examples/databases/get.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-indexes.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-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-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-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-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-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-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/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/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-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-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/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/delete-bucket.md create mode 100644 docs/examples/storage/get-bucket.md create mode 100644 docs/examples/storage/list-buckets.md create mode 100644 docs/examples/storage/update-bucket.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-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-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-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/delete-column.md create mode 100644 docs/examples/tablesdb/delete-index.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.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-table.md create mode 100644 docs/examples/tablesdb/get.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-tables.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-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-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-rows.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 rename docs/examples/{account/update-verification.md => users/delete-session.md} (60%) 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 src/enums/adapter.ts create mode 100644 src/enums/attribute-status.ts create mode 100644 src/enums/backup-services.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/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/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/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/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/vcs-reference-type.ts create mode 100644 src/services/activities.ts create mode 100644 src/services/advisor.ts create mode 100644 src/services/backups.ts create mode 100644 src/services/health.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/tokens.ts create mode 100644 src/services/usage.ts create mode 100644 src/services/users.ts create mode 100644 src/services/webhooks.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index bbee4e7c..7e8c9dfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 26.0.0 + +* Added: Isomorphic `Client` typed by auth capability — services narrow available methods by auth type at compile time +* Added: Static factory constructors `Client.from`, `Client.fromSession`, `Client.fromAPIKey`, `Client.fromCookie`, `Client.fromJWT`, `Client.fromDevKey`, and `Client.fromImpersonation` +* Added: Server-side auth via `apiKey`, `cookie`, and `jwt` factories +* Added: Admin and server-only endpoints (`Users`, `Projects`, function and site deployments, storage buckets, and more) +* Deprecated: `new Client()` constructor and `setEndpoint`/`setProject`/setter pattern remain for backwards compatibility but are now marked deprecated +* Updated: `x-sdk-platform` header now reflects browser or server runtime + ## 25.1.1 * Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs) diff --git a/README.md b/README.md index 6ebf9c36..8044285e 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ import { Client, Account } from "appwrite"; To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services: ```html - + ``` diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index cf6a6098..df016baf 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.createMFAAuthenticator({ +const result = await account.createMfaAuthenticator({ type: AuthenticatorType.Totp }); diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index d9d9856d..03c03be3 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.createMFAChallenge({ +const result = await account.createMfaChallenge({ factor: AuthenticationFactor.Email }); diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 3c292f26..42aa7ac0 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.createMFARecoveryCodes(); +const result = await account.createMfaRecoveryCodes(); console.log(result); ``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 079f0b95..626b4172 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.deleteMFAAuthenticator({ +const result = await account.deleteMfaAuthenticator({ type: AuthenticatorType.Totp }); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index 1d102583..a2bca114 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.getMFARecoveryCodes(); +const result = await account.getMfaRecoveryCodes(); console.log(result); ``` diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 9950129b..63148467 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.listMFAFactors(); +const result = await account.listMfaFactors(); console.log(result); ``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index bf25c76b..7aa949c7 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.updateMFAAuthenticator({ +const result = await account.updateMfaAuthenticator({ type: AuthenticatorType.Totp, otp: '' }); diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index a16ea43a..34e5b267 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.updateMFAChallenge({ +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 index 8bc8273c..3d22c889 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.updateMFARecoveryCodes(); +const result = await account.updateMfaRecoveryCodes(); console.log(result); ``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/activities/get-event.md similarity index 56% rename from docs/examples/account/create-verification.md rename to docs/examples/activities/get-event.md index 0795d0ac..b3259ff8 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/activities/get-event.md @@ -1,14 +1,14 @@ ```javascript -import { Client, Account } from "appwrite"; +import { Client, Activities } from "appwrite"; const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint .setProject(''); // Your project ID -const account = new Account(client); +const activities = new Activities(client); -const result = await account.createVerification({ - url: 'https://example.com' +const result = await activities.getEvent({ + eventId: '' }); console.log(result); diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md new file mode 100644 index 00000000..883371e3 --- /dev/null +++ b/docs/examples/activities/list-events.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Activities } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const activities = new Activities(client); + +const result = await activities.listEvents({ + queries: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md new file mode 100644 index 00000000..3237bea0 --- /dev/null +++ b/docs/examples/advisor/delete-report.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.deleteReport({ + reportId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md new file mode 100644 index 00000000..28661f98 --- /dev/null +++ b/docs/examples/advisor/get-insight.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.getInsight({ + reportId: '', + insightId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md new file mode 100644 index 00000000..79736784 --- /dev/null +++ b/docs/examples/advisor/get-report.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.getReport({ + reportId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md new file mode 100644 index 00000000..c9b8f2ea --- /dev/null +++ b/docs/examples/advisor/list-insights.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.listInsights({ + reportId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md new file mode 100644 index 00000000..9480e970 --- /dev/null +++ b/docs/examples/advisor/list-reports.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Advisor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const advisor = new Advisor(client); + +const result = await advisor.listReports({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md new file mode 100644 index 00000000..5a0c1d32 --- /dev/null +++ b/docs/examples/backups/create-archive.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Backups, BackupServices } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.createArchive({ + services: [BackupServices.Databases], + resourceId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md new file mode 100644 index 00000000..183a19c8 --- /dev/null +++ b/docs/examples/backups/create-policy.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Backups, BackupServices } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.createPolicy({ + policyId: '', + services: [BackupServices.Databases], + retention: 1, + schedule: '', + name: '', // optional + resourceId: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md new file mode 100644 index 00000000..19e40470 --- /dev/null +++ b/docs/examples/backups/create-restoration.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Backups, BackupServices } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.createRestoration({ + archiveId: '', + services: [BackupServices.Databases], + newResourceId: '', // optional + newResourceName: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md new file mode 100644 index 00000000..95722eb3 --- /dev/null +++ b/docs/examples/backups/delete-archive.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.deleteArchive({ + archiveId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md new file mode 100644 index 00000000..07499bb6 --- /dev/null +++ b/docs/examples/backups/delete-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.deletePolicy({ + policyId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md new file mode 100644 index 00000000..2ab79ac7 --- /dev/null +++ b/docs/examples/backups/get-archive.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.getArchive({ + archiveId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md new file mode 100644 index 00000000..aed31bf7 --- /dev/null +++ b/docs/examples/backups/get-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.getPolicy({ + policyId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md new file mode 100644 index 00000000..c0deac84 --- /dev/null +++ b/docs/examples/backups/get-restoration.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.getRestoration({ + restorationId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md new file mode 100644 index 00000000..33a1dd26 --- /dev/null +++ b/docs/examples/backups/list-archives.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.listArchives({ + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md new file mode 100644 index 00000000..4a7fa7bd --- /dev/null +++ b/docs/examples/backups/list-policies.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.listPolicies({ + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md new file mode 100644 index 00000000..04c3a373 --- /dev/null +++ b/docs/examples/backups/list-restorations.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.listRestorations({ + queries: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md new file mode 100644 index 00000000..69a5503c --- /dev/null +++ b/docs/examples/backups/update-policy.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Backups } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const backups = new Backups(client); + +const result = await backups.updatePolicy({ + policyId: '', + name: '', // optional + retention: 1, // optional + schedule: '', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..e0e4541f --- /dev/null +++ b/docs/examples/databases/create-big-int-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createBigIntAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md new file mode 100644 index 00000000..d41f60bb --- /dev/null +++ b/docs/examples/databases/create-boolean-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createBooleanAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: false, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md new file mode 100644 index 00000000..0da70c48 --- /dev/null +++ b/docs/examples/databases/create-collection.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createCollection({ + databaseId: '', + collectionId: '', + name: '', + permissions: [Permission.read(Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + attributes: [], // optional + indexes: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md new file mode 100644 index 00000000..b59332b8 --- /dev/null +++ b/docs/examples/databases/create-datetime-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 4d8d7f90..eff84945 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -10,15 +10,16 @@ const databases = new Databases(client); const result = await databases.createDocument({ databaseId: '', collectionId: '', - documentId: '', + documentId: '', // optional data: { "username": "walter.obrien", "email": "walter.obrien@example.com", "fullName": "Walter O'Brien", "age": 30, "isAdmin": false - }, + }, // optional permissions: [Permission.read(Role.any())], // optional + documents: [], // optional transactionId: '' // 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..87444399 --- /dev/null +++ b/docs/examples/databases/create-email-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createEmailAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'email@example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md new file mode 100644 index 00000000..0787923a --- /dev/null +++ b/docs/examples/databases/create-enum-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createEnumAttribute({ + databaseId: '', + collectionId: '', + key: '', + elements: [], + required: false, + xdefault: '', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md new file mode 100644 index 00000000..3d46dc43 --- /dev/null +++ b/docs/examples/databases/create-float-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createFloatAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md new file mode 100644 index 00000000..7f77071a --- /dev/null +++ b/docs/examples/databases/create-index.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases, DatabasesIndexType, OrderBy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createIndex({ + databaseId: '', + collectionId: '', + key: '', + type: DatabasesIndexType.Key, + attributes: [], + orders: [OrderBy.Asc], // optional + lengths: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md new file mode 100644 index 00000000..4c700cbb --- /dev/null +++ b/docs/examples/databases/create-integer-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createIntegerAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + min: null, // optional + max: null, // optional + xdefault: null, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md new file mode 100644 index 00000000..3bd98af5 --- /dev/null +++ b/docs/examples/databases/create-ip-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createIpAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md new file mode 100644 index 00000000..659af6e0 --- /dev/null +++ b/docs/examples/databases/create-line-attribute.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createLineAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md new file mode 100644 index 00000000..a1352102 --- /dev/null +++ b/docs/examples/databases/create-longtext-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createLongtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md new file mode 100644 index 00000000..f2035f29 --- /dev/null +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createMediumtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md new file mode 100644 index 00000000..46dbb28d --- /dev/null +++ b/docs/examples/databases/create-point-attribute.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createPointAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [1, 2] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md new file mode 100644 index 00000000..d57f1e25 --- /dev/null +++ b/docs/examples/databases/create-polygon-attribute.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createPolygonAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md new file mode 100644 index 00000000..d11019bd --- /dev/null +++ b/docs/examples/databases/create-relationship-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases, RelationshipType, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createRelationshipAttribute({ + databaseId: '', + collectionId: '', + relatedCollectionId: '', + type: RelationshipType.OneToOne, + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: RelationMutate.Cascade // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md new file mode 100644 index 00000000..6e284ce2 --- /dev/null +++ b/docs/examples/databases/create-string-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createStringAttribute({ + databaseId: '', + collectionId: '', + key: '', + size: 1, + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md new file mode 100644 index 00000000..c0cb5c3d --- /dev/null +++ b/docs/examples/databases/create-text-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createTextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md new file mode 100644 index 00000000..31c85599 --- /dev/null +++ b/docs/examples/databases/create-url-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createUrlAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'https://example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md new file mode 100644 index 00000000..111ae5fd --- /dev/null +++ b/docs/examples/databases/create-varchar-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createVarcharAttribute({ + databaseId: '', + collectionId: '', + key: '', + size: 1, + required: false, + xdefault: '', // optional + array: false, // optional + encrypt: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md new file mode 100644 index 00000000..d9ec0129 --- /dev/null +++ b/docs/examples/databases/create.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.create({ + databaseId: '', + name: '', + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md new file mode 100644 index 00000000..5a6f68e7 --- /dev/null +++ b/docs/examples/databases/delete-attribute.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.deleteAttribute({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md new file mode 100644 index 00000000..2f9d0e23 --- /dev/null +++ b/docs/examples/databases/delete-collection.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.deleteCollection({ + databaseId: '', + collectionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md new file mode 100644 index 00000000..21e5725e --- /dev/null +++ b/docs/examples/databases/delete-documents.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.deleteDocuments({ + databaseId: '', + collectionId: '', + queries: [], // optional + transactionId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md new file mode 100644 index 00000000..5a47e2db --- /dev/null +++ b/docs/examples/databases/delete-index.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.deleteIndex({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md new file mode 100644 index 00000000..b0de2e3f --- /dev/null +++ b/docs/examples/databases/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.delete({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md new file mode 100644 index 00000000..315e3766 --- /dev/null +++ b/docs/examples/databases/get-attribute.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.getAttribute({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md new file mode 100644 index 00000000..b3341d61 --- /dev/null +++ b/docs/examples/databases/get-collection.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.getCollection({ + databaseId: '', + collectionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md new file mode 100644 index 00000000..2347e48e --- /dev/null +++ b/docs/examples/databases/get-index.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.getIndex({ + databaseId: '', + collectionId: '', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md new file mode 100644 index 00000000..3ecc657a --- /dev/null +++ b/docs/examples/databases/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.get({ + databaseId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md new file mode 100644 index 00000000..3ea4e27e --- /dev/null +++ b/docs/examples/databases/list-attributes.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.listAttributes({ + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md new file mode 100644 index 00000000..915c58a7 --- /dev/null +++ b/docs/examples/databases/list-collections.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.listCollections({ + databaseId: '', + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md new file mode 100644 index 00000000..b7bbd5e9 --- /dev/null +++ b/docs/examples/databases/list-indexes.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.listIndexes({ + databaseId: '', + collectionId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md new file mode 100644 index 00000000..bdb054c4 --- /dev/null +++ b/docs/examples/databases/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.list({ + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` 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..df732291 --- /dev/null +++ b/docs/examples/databases/update-big-int-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateBigIntAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md new file mode 100644 index 00000000..46f589bc --- /dev/null +++ b/docs/examples/databases/update-boolean-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateBooleanAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: false, + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md new file mode 100644 index 00000000..8ae672fd --- /dev/null +++ b/docs/examples/databases/update-collection.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateCollection({ + databaseId: '', + collectionId: '', + name: '', // optional + permissions: [Permission.read(Role.any())], // optional + documentSecurity: false, // optional + enabled: false, // optional + purge: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md new file mode 100644 index 00000000..3b0ab4eb --- /dev/null +++ b/docs/examples/databases/update-datetime-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateDatetimeAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '2020-10-15T06:38:00.000+00:00', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md new file mode 100644 index 00000000..ed953513 --- /dev/null +++ b/docs/examples/databases/update-documents.md @@ -0,0 +1,25 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md new file mode 100644 index 00000000..3da6e229 --- /dev/null +++ b/docs/examples/databases/update-email-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateEmailAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'email@example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md new file mode 100644 index 00000000..a6d700e7 --- /dev/null +++ b/docs/examples/databases/update-enum-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateEnumAttribute({ + databaseId: '', + collectionId: '', + key: '', + elements: [], + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md new file mode 100644 index 00000000..2502c75f --- /dev/null +++ b/docs/examples/databases/update-float-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateFloatAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md new file mode 100644 index 00000000..4b8b26b9 --- /dev/null +++ b/docs/examples/databases/update-integer-attribute.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateIntegerAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md new file mode 100644 index 00000000..e467a4dc --- /dev/null +++ b/docs/examples/databases/update-ip-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateIpAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md new file mode 100644 index 00000000..cb963988 --- /dev/null +++ b/docs/examples/databases/update-line-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateLineAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md new file mode 100644 index 00000000..ef74a098 --- /dev/null +++ b/docs/examples/databases/update-longtext-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateLongtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md new file mode 100644 index 00000000..c3e34af0 --- /dev/null +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateMediumtextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md new file mode 100644 index 00000000..de0391b1 --- /dev/null +++ b/docs/examples/databases/update-point-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updatePointAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [1, 2], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md new file mode 100644 index 00000000..7d13baee --- /dev/null +++ b/docs/examples/databases/update-polygon-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updatePolygonAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: [[[1, 2], [3, 4], [5, 6], [1, 2]]], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md new file mode 100644 index 00000000..51dbfd69 --- /dev/null +++ b/docs/examples/databases/update-relationship-attribute.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Databases, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateRelationshipAttribute({ + databaseId: '', + collectionId: '', + key: '', + onDelete: RelationMutate.Cascade, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md new file mode 100644 index 00000000..891d851b --- /dev/null +++ b/docs/examples/databases/update-string-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateStringAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md new file mode 100644 index 00000000..b954a492 --- /dev/null +++ b/docs/examples/databases/update-text-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateTextAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md new file mode 100644 index 00000000..040eafe9 --- /dev/null +++ b/docs/examples/databases/update-url-attribute.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateUrlAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: 'https://example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md new file mode 100644 index 00000000..67b82ae6 --- /dev/null +++ b/docs/examples/databases/update-varchar-attribute.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateVarcharAttribute({ + databaseId: '', + collectionId: '', + key: '', + required: false, + xdefault: '', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md new file mode 100644 index 00000000..aa15b64a --- /dev/null +++ b/docs/examples/databases/update.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.update({ + databaseId: '', + name: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md new file mode 100644 index 00000000..ade173ca --- /dev/null +++ b/docs/examples/databases/upsert-documents.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.upsertDocuments({ + databaseId: '', + collectionId: '', + documents: [], + transactionId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md new file mode 100644 index 00000000..048e8de5 --- /dev/null +++ b/docs/examples/functions/create-deployment.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.createDeployment({ + functionId: '', + code: document.getElementById('uploader').files[0], + activate: false, + entrypoint: '', // optional + commands: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md new file mode 100644 index 00000000..d3cbb752 --- /dev/null +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.createDuplicateDeployment({ + functionId: '', + deploymentId: '', + buildId: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md new file mode 100644 index 00000000..e1f5a1c5 --- /dev/null +++ b/docs/examples/functions/create-template-deployment.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Functions, TemplateReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.createTemplateDeployment({ + functionId: '', + repository: '', + owner: '', + rootDirectory: '', + type: TemplateReferenceType.Commit, + reference: '', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md new file mode 100644 index 00000000..351967ae --- /dev/null +++ b/docs/examples/functions/create-variable.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.createVariable({ + functionId: '', + variableId: '', + key: '', + value: '', + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md new file mode 100644 index 00000000..ecf7b679 --- /dev/null +++ b/docs/examples/functions/create-vcs-deployment.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Functions, VCSReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.createVcsDeployment({ + functionId: '', + type: VCSReferenceType.Branch, + reference: '', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md new file mode 100644 index 00000000..35a6b33f --- /dev/null +++ b/docs/examples/functions/create.md @@ -0,0 +1,34 @@ +```javascript +import { Client, Functions, Runtime, Scopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.create({ + functionId: '', + name: '', + runtime: Runtime.Node145, + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '', // optional + commands: '', // optional + scopes: [Scopes.ProjectRead], // optional + installationId: '', // optional + providerRepositoryId: '', // optional + providerBranch: '', // optional + providerSilentMode: false, // optional + providerRootDirectory: '', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md new file mode 100644 index 00000000..ea60b025 --- /dev/null +++ b/docs/examples/functions/delete-deployment.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.deleteDeployment({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md new file mode 100644 index 00000000..bfef2df9 --- /dev/null +++ b/docs/examples/functions/delete-execution.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.deleteExecution({ + functionId: '', + executionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md new file mode 100644 index 00000000..d5a28b13 --- /dev/null +++ b/docs/examples/functions/delete-variable.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.deleteVariable({ + functionId: '', + variableId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md new file mode 100644 index 00000000..6211af35 --- /dev/null +++ b/docs/examples/functions/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.delete({ + functionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md new file mode 100644 index 00000000..eb098d89 --- /dev/null +++ b/docs/examples/functions/get-deployment-download.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions, DeploymentDownloadType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = functions.getDeploymentDownload({ + functionId: '', + deploymentId: '', + type: DeploymentDownloadType.Source // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md new file mode 100644 index 00000000..09227179 --- /dev/null +++ b/docs/examples/functions/get-deployment.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.getDeployment({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md new file mode 100644 index 00000000..dec53083 --- /dev/null +++ b/docs/examples/functions/get-variable.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.getVariable({ + functionId: '', + variableId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md new file mode 100644 index 00000000..fa5bf658 --- /dev/null +++ b/docs/examples/functions/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.get({ + functionId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md new file mode 100644 index 00000000..9f15b95e --- /dev/null +++ b/docs/examples/functions/list-deployments.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.listDeployments({ + functionId: '', + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md new file mode 100644 index 00000000..6d879f03 --- /dev/null +++ b/docs/examples/functions/list-runtimes.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.listRuntimes(); + +console.log(result); +``` diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md new file mode 100644 index 00000000..19e9a4c5 --- /dev/null +++ b/docs/examples/functions/list-specifications.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.listSpecifications(); + +console.log(result); +``` diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md new file mode 100644 index 00000000..fded4882 --- /dev/null +++ b/docs/examples/functions/list-variables.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.listVariables({ + functionId: '', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md new file mode 100644 index 00000000..14ec102a --- /dev/null +++ b/docs/examples/functions/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.list({ + queries: [], // optional + search: '', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md new file mode 100644 index 00000000..1368d478 --- /dev/null +++ b/docs/examples/functions/update-deployment-status.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.updateDeploymentStatus({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md new file mode 100644 index 00000000..b5918fd2 --- /dev/null +++ b/docs/examples/functions/update-function-deployment.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.updateFunctionDeployment({ + functionId: '', + deploymentId: '' +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md new file mode 100644 index 00000000..58f549fe --- /dev/null +++ b/docs/examples/functions/update-variable.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.updateVariable({ + functionId: '', + variableId: '', + key: '', // optional + value: '', // optional + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md new file mode 100644 index 00000000..56394751 --- /dev/null +++ b/docs/examples/functions/update.md @@ -0,0 +1,34 @@ +```javascript +import { Client, Functions, Runtime, Scopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.update({ + functionId: '', + name: '', + runtime: Runtime.Node145, // optional + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '', // optional + commands: '', // optional + scopes: [Scopes.ProjectRead], // optional + installationId: '', // optional + providerRepositoryId: '', // optional + providerBranch: '', // optional + providerSilentMode: false, // optional + providerRootDirectory: '', // optional + buildSpecification: '', // optional + runtimeSpecification: '', // optional + deploymentRetention: 0 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md new file mode 100644 index 00000000..05c6502f --- /dev/null +++ b/docs/examples/health/get-antivirus.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getAntivirus(); + +console.log(result); +``` diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md new file mode 100644 index 00000000..1b71eee9 --- /dev/null +++ b/docs/examples/health/get-cache.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getCache(); + +console.log(result); +``` diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md new file mode 100644 index 00000000..0f20e19e --- /dev/null +++ b/docs/examples/health/get-certificate.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getCertificate({ + domain: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md new file mode 100644 index 00000000..bca1b45a --- /dev/null +++ b/docs/examples/health/get-console-pausing.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getConsolePausing({ + threshold: null, // optional + inactivityDays: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md new file mode 100644 index 00000000..561b6ab7 --- /dev/null +++ b/docs/examples/health/get-db.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getDB(); + +console.log(result); +``` diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md new file mode 100644 index 00000000..737c8d8b --- /dev/null +++ b/docs/examples/health/get-failed-jobs.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health, Name } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getFailedJobs({ + name: Name.V1Database, + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md new file mode 100644 index 00000000..e8244436 --- /dev/null +++ b/docs/examples/health/get-pub-sub.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getPubSub(); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md new file mode 100644 index 00000000..301446b0 --- /dev/null +++ b/docs/examples/health/get-queue-audits.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueAudits({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md new file mode 100644 index 00000000..a6b37dd4 --- /dev/null +++ b/docs/examples/health/get-queue-builds.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueBuilds({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md new file mode 100644 index 00000000..60e91f5f --- /dev/null +++ b/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueCertificates({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md new file mode 100644 index 00000000..23eb2561 --- /dev/null +++ b/docs/examples/health/get-queue-databases.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueDatabases({ + name: '', // optional + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md new file mode 100644 index 00000000..77d514f2 --- /dev/null +++ b/docs/examples/health/get-queue-deletes.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueDeletes({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md new file mode 100644 index 00000000..72a18645 --- /dev/null +++ b/docs/examples/health/get-queue-functions.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueFunctions({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md new file mode 100644 index 00000000..0086f86b --- /dev/null +++ b/docs/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueLogs({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md new file mode 100644 index 00000000..7800f23b --- /dev/null +++ b/docs/examples/health/get-queue-mails.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueMails({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md new file mode 100644 index 00000000..408e4016 --- /dev/null +++ b/docs/examples/health/get-queue-messaging.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueMessaging({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md new file mode 100644 index 00000000..5bfaf659 --- /dev/null +++ b/docs/examples/health/get-queue-migrations.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueMigrations({ + threshold: null // optional +}); + +console.log(result); +``` 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..45999f02 --- /dev/null +++ b/docs/examples/health/get-queue-stats-resources.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueStatsResources({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md new file mode 100644 index 00000000..ae90ba51 --- /dev/null +++ b/docs/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueUsage({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 00000000..461ae283 --- /dev/null +++ b/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getQueueWebhooks({ + threshold: null // optional +}); + +console.log(result); +``` diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md new file mode 100644 index 00000000..6acb21e2 --- /dev/null +++ b/docs/examples/health/get-storage-local.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getStorageLocal(); + +console.log(result); +``` diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md new file mode 100644 index 00000000..27391b51 --- /dev/null +++ b/docs/examples/health/get-storage.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getStorage(); + +console.log(result); +``` diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md new file mode 100644 index 00000000..2727c0b9 --- /dev/null +++ b/docs/examples/health/get-time.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.getTime(); + +console.log(result); +``` diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md new file mode 100644 index 00000000..5dce8db6 --- /dev/null +++ b/docs/examples/health/get.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Health } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const health = new Health(client); + +const result = await health.get(); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md new file mode 100644 index 00000000..5859a952 --- /dev/null +++ b/docs/examples/messaging/create-apns-provider.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createApnsProvider({ + providerId: '', + name: '', + authKey: '', // optional + authKeyId: '', // optional + teamId: '', // optional + bundleId: '', // optional + sandbox: false, // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md new file mode 100644 index 00000000..08b5b0ed --- /dev/null +++ b/docs/examples/messaging/create-email.md @@ -0,0 +1,26 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md new file mode 100644 index 00000000..aba9af52 --- /dev/null +++ b/docs/examples/messaging/create-fcm-provider.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createFcmProvider({ + providerId: '', + name: '', + serviceAccountJSON: {}, // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md new file mode 100644 index 00000000..8e231f4b --- /dev/null +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,24 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` 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..65b4493f --- /dev/null +++ b/docs/examples/messaging/create-msg-91-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createMsg91Provider({ + providerId: '', + name: '', + templateId: '', // optional + senderId: '', // optional + authKey: '', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md new file mode 100644 index 00000000..1daf07b5 --- /dev/null +++ b/docs/examples/messaging/create-push.md @@ -0,0 +1,33 @@ +```javascript +import { Client, Messaging, MessagePriority } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new 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: MessagePriority.Normal // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md new file mode 100644 index 00000000..947a9e2c --- /dev/null +++ b/docs/examples/messaging/create-resend-provider.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 00000000..05d8eac1 --- /dev/null +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md new file mode 100644 index 00000000..152b0542 --- /dev/null +++ b/docs/examples/messaging/create-sms.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md new file mode 100644 index 00000000..5ce889c4 --- /dev/null +++ b/docs/examples/messaging/create-smtp-provider.md @@ -0,0 +1,28 @@ +```javascript +import { Client, Messaging, SmtpEncryption } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createSmtpProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md new file mode 100644 index 00000000..a1ebd717 --- /dev/null +++ b/docs/examples/messaging/create-telesign-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md new file mode 100644 index 00000000..9f81c7e6 --- /dev/null +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md new file mode 100644 index 00000000..fa8b1dad --- /dev/null +++ b/docs/examples/messaging/create-topic.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createTopic({ + topicId: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md new file mode 100644 index 00000000..186cff00 --- /dev/null +++ b/docs/examples/messaging/create-twilio-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md new file mode 100644 index 00000000..74fb12d9 --- /dev/null +++ b/docs/examples/messaging/create-vonage-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md new file mode 100644 index 00000000..8a371422 --- /dev/null +++ b/docs/examples/messaging/delete-provider.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.deleteProvider({ + providerId: '<PROVIDER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md new file mode 100644 index 00000000..3ef42894 --- /dev/null +++ b/docs/examples/messaging/delete-topic.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.deleteTopic({ + topicId: '<TOPIC_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md new file mode 100644 index 00000000..a4f42e5e --- /dev/null +++ b/docs/examples/messaging/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.delete({ + messageId: '<MESSAGE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md new file mode 100644 index 00000000..7b10f853 --- /dev/null +++ b/docs/examples/messaging/get-message.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.getMessage({ + messageId: '<MESSAGE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md new file mode 100644 index 00000000..54c28480 --- /dev/null +++ b/docs/examples/messaging/get-provider.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.getProvider({ + providerId: '<PROVIDER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md new file mode 100644 index 00000000..8363067b --- /dev/null +++ b/docs/examples/messaging/get-subscriber.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.getSubscriber({ + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md new file mode 100644 index 00000000..6d6ea170 --- /dev/null +++ b/docs/examples/messaging/get-topic.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.getTopic({ + topicId: '<TOPIC_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md new file mode 100644 index 00000000..cc90cf0b --- /dev/null +++ b/docs/examples/messaging/list-message-logs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listMessageLogs({ + messageId: '<MESSAGE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md new file mode 100644 index 00000000..dd451294 --- /dev/null +++ b/docs/examples/messaging/list-messages.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listMessages({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md new file mode 100644 index 00000000..cf599a86 --- /dev/null +++ b/docs/examples/messaging/list-provider-logs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listProviderLogs({ + providerId: '<PROVIDER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md new file mode 100644 index 00000000..243f83fa --- /dev/null +++ b/docs/examples/messaging/list-providers.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listProviders({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md new file mode 100644 index 00000000..eea608b3 --- /dev/null +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listSubscriberLogs({ + subscriberId: '<SUBSCRIBER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md new file mode 100644 index 00000000..2c888eff --- /dev/null +++ b/docs/examples/messaging/list-subscribers.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listSubscribers({ + topicId: '<TOPIC_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md new file mode 100644 index 00000000..e99f37a6 --- /dev/null +++ b/docs/examples/messaging/list-targets.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listTargets({ + messageId: '<MESSAGE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md new file mode 100644 index 00000000..7a057dd0 --- /dev/null +++ b/docs/examples/messaging/list-topic-logs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listTopicLogs({ + topicId: '<TOPIC_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md new file mode 100644 index 00000000..9b7114e0 --- /dev/null +++ b/docs/examples/messaging/list-topics.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.listTopics({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md new file mode 100644 index 00000000..33d44077 --- /dev/null +++ b/docs/examples/messaging/update-apns-provider.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md new file mode 100644 index 00000000..e7ef6af9 --- /dev/null +++ b/docs/examples/messaging/update-email.md @@ -0,0 +1,26 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md new file mode 100644 index 00000000..860952e3 --- /dev/null +++ b/docs/examples/messaging/update-fcm-provider.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.updateFcmProvider({ + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + serviceAccountJSON: {} // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md new file mode 100644 index 00000000..64b1ef5a --- /dev/null +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,24 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` 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..8adf6c85 --- /dev/null +++ b/docs/examples/messaging/update-msg-91-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md new file mode 100644 index 00000000..bb399fdd --- /dev/null +++ b/docs/examples/messaging/update-push.md @@ -0,0 +1,33 @@ +```javascript +import { Client, Messaging, MessagePriority } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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: MessagePriority.Normal // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md new file mode 100644 index 00000000..6fe46a37 --- /dev/null +++ b/docs/examples/messaging/update-resend-provider.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 00000000..67ae148e --- /dev/null +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md new file mode 100644 index 00000000..40df7c77 --- /dev/null +++ b/docs/examples/messaging/update-sms.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md new file mode 100644 index 00000000..aaeae762 --- /dev/null +++ b/docs/examples/messaging/update-smtp-provider.md @@ -0,0 +1,28 @@ +```javascript +import { Client, Messaging, SmtpEncryption } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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: 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md new file mode 100644 index 00000000..03519b79 --- /dev/null +++ b/docs/examples/messaging/update-telesign-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md new file mode 100644 index 00000000..9d29c079 --- /dev/null +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md new file mode 100644 index 00000000..307bc143 --- /dev/null +++ b/docs/examples/messaging/update-topic.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.updateTopic({ + topicId: '<TOPIC_ID>', + name: '<NAME>', // optional + subscribe: ["any"] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md new file mode 100644 index 00000000..8aebdc79 --- /dev/null +++ b/docs/examples/messaging/update-twilio-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md new file mode 100644 index 00000000..506d29d0 --- /dev/null +++ b/docs/examples/messaging/update-vonage-provider.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const messaging = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/presences/update.md b/docs/examples/presences/update.md index 79e5aa91..01cc3fc7 100644 --- a/docs/examples/presences/update.md +++ b/docs/examples/presences/update.md @@ -9,6 +9,7 @@ const presences = new Presences(client); const result = await presences.update({ presenceId: '<PRESENCE_ID>', + userId: '<USER_ID>', // optional status: '<STATUS>', // optional expiresAt: '2020-10-15T06:38:00.000+00:00', // optional metadata: {}, // optional diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md index e8fb6349..3d13e32e 100644 --- a/docs/examples/presences/upsert.md +++ b/docs/examples/presences/upsert.md @@ -10,6 +10,7 @@ const presences = new Presences(client); const result = await presences.upsert({ presenceId: '<PRESENCE_ID>', status: '<STATUS>', + userId: '<USER_ID>', // optional permissions: [Permission.read(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..7ea0aef8 --- /dev/null +++ b/docs/examples/project/create-android-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createAndroidPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + applicationId: '<APPLICATION_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md new file mode 100644 index 00000000..a83fc859 --- /dev/null +++ b/docs/examples/project/create-apple-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createApplePlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + bundleIdentifier: '<BUNDLE_IDENTIFIER>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md new file mode 100644 index 00000000..377ac851 --- /dev/null +++ b/docs/examples/project/create-ephemeral-key.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ProjectKeyScopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createEphemeralKey({ + scopes: [ProjectKeyScopes.ProjectRead], + duration: 600 +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md new file mode 100644 index 00000000..0c4dd820 --- /dev/null +++ b/docs/examples/project/create-key.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project, ProjectKeyScopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [ProjectKeyScopes.ProjectRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md new file mode 100644 index 00000000..93103d34 --- /dev/null +++ b/docs/examples/project/create-linux-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createLinuxPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageName: '<PACKAGE_NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md new file mode 100644 index 00000000..918d5853 --- /dev/null +++ b/docs/examples/project/create-mock-phone.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createMockPhone({ + number: '+12065550100', + otp: '<OTP>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md new file mode 100644 index 00000000..cd0f8ed4 --- /dev/null +++ b/docs/examples/project/create-smtp-test.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createSMTPTest({ + emails: [] +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md new file mode 100644 index 00000000..98a4f66f --- /dev/null +++ b/docs/examples/project/create-variable.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createVariable({ + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md new file mode 100644 index 00000000..d0ddc06a --- /dev/null +++ b/docs/examples/project/create-web-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createWebPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + hostname: 'app.example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md new file mode 100644 index 00000000..c6c220e1 --- /dev/null +++ b/docs/examples/project/create-windows-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.createWindowsPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md new file mode 100644 index 00000000..fa9681e1 --- /dev/null +++ b/docs/examples/project/delete-key.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.deleteKey({ + keyId: '<KEY_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md new file mode 100644 index 00000000..5a59358f --- /dev/null +++ b/docs/examples/project/delete-mock-phone.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.deleteMockPhone({ + number: '+12065550100' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md new file mode 100644 index 00000000..70562379 --- /dev/null +++ b/docs/examples/project/delete-platform.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.deletePlatform({ + platformId: '<PLATFORM_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md new file mode 100644 index 00000000..a50b5ae4 --- /dev/null +++ b/docs/examples/project/delete-variable.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.deleteVariable({ + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md new file mode 100644 index 00000000..757763cc --- /dev/null +++ b/docs/examples/project/delete.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.delete(); + +console.log(result); +``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md new file mode 100644 index 00000000..2d1c9e3e --- /dev/null +++ b/docs/examples/project/get-email-template.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ProjectEmailTemplateId, ProjectEmailTemplateLocale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.getEmailTemplate({ + templateId: ProjectEmailTemplateId.Verification, + locale: ProjectEmailTemplateLocale.Af // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md new file mode 100644 index 00000000..655569e9 --- /dev/null +++ b/docs/examples/project/get-key.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.getKey({ + keyId: '<KEY_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md new file mode 100644 index 00000000..6f0b3154 --- /dev/null +++ b/docs/examples/project/get-mock-phone.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.getMockPhone({ + number: '+12065550100' +}); + +console.log(result); +``` 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..4447791a --- /dev/null +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project, ProjectOAuthProviderId } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.getOAuth2Provider({ + providerId: ProjectOAuthProviderId.Amazon +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md new file mode 100644 index 00000000..908cad46 --- /dev/null +++ b/docs/examples/project/get-platform.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.getPlatform({ + platformId: '<PLATFORM_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md new file mode 100644 index 00000000..a6a74aef --- /dev/null +++ b/docs/examples/project/get-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project, ProjectPolicyId } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.getPolicy({ + policyId: ProjectPolicyId.PasswordDictionary +}); + +console.log(result); +``` diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md new file mode 100644 index 00000000..53b059c0 --- /dev/null +++ b/docs/examples/project/get-variable.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.getVariable({ + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md new file mode 100644 index 00000000..96bc8614 --- /dev/null +++ b/docs/examples/project/get.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.get(); + +console.log(result); +``` diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md new file mode 100644 index 00000000..6ae1f3c1 --- /dev/null +++ b/docs/examples/project/list-email-templates.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.listEmailTemplates({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md new file mode 100644 index 00000000..c5f521a8 --- /dev/null +++ b/docs/examples/project/list-keys.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.listKeys({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md new file mode 100644 index 00000000..3e5d66e7 --- /dev/null +++ b/docs/examples/project/list-mock-phones.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.listMockPhones({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` 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..8d8fcc75 --- /dev/null +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.listOAuth2Providers({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md new file mode 100644 index 00000000..b6303317 --- /dev/null +++ b/docs/examples/project/list-platforms.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.listPlatforms({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md new file mode 100644 index 00000000..a06943da --- /dev/null +++ b/docs/examples/project/list-policies.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.listPolicies({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md new file mode 100644 index 00000000..6fec55b5 --- /dev/null +++ b/docs/examples/project/list-variables.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.listVariables({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md new file mode 100644 index 00000000..3fa7dcf8 --- /dev/null +++ b/docs/examples/project/update-android-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateAndroidPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + applicationId: '<APPLICATION_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md new file mode 100644 index 00000000..e6bf227a --- /dev/null +++ b/docs/examples/project/update-apple-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateApplePlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + bundleIdentifier: '<BUNDLE_IDENTIFIER>' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md new file mode 100644 index 00000000..68da4b94 --- /dev/null +++ b/docs/examples/project/update-auth-method.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ProjectAuthMethodId } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateAuthMethod({ + methodId: ProjectAuthMethodId.EmailPassword, + enabled: false +}); + +console.log(result); +``` 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..0c19b5f9 --- /dev/null +++ b/docs/examples/project/update-deny-aliased-email-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateDenyAliasedEmailPolicy({ + enabled: false +}); + +console.log(result); +``` 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..12706609 --- /dev/null +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateDenyDisposableEmailPolicy({ + enabled: false +}); + +console.log(result); +``` 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..19297d98 --- /dev/null +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateDenyFreeEmailPolicy({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md new file mode 100644 index 00000000..ae06c888 --- /dev/null +++ b/docs/examples/project/update-email-template.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Project, ProjectEmailTemplateId, ProjectEmailTemplateLocale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateEmailTemplate({ + templateId: ProjectEmailTemplateId.Verification, + locale: 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 +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md new file mode 100644 index 00000000..e926daeb --- /dev/null +++ b/docs/examples/project/update-key.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project, ProjectKeyScopes } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateKey({ + keyId: '<KEY_ID>', + name: '<NAME>', + scopes: [ProjectKeyScopes.ProjectRead], + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md new file mode 100644 index 00000000..47a133e8 --- /dev/null +++ b/docs/examples/project/update-labels.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateLabels({ + labels: [] +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md new file mode 100644 index 00000000..2744862e --- /dev/null +++ b/docs/examples/project/update-linux-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateLinuxPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageName: '<PACKAGE_NAME>' +}); + +console.log(result); +``` 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..06ebae70 --- /dev/null +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateMembershipPrivacyPolicy({ + userId: false, // optional + userEmail: false, // optional + userPhone: false, // optional + userName: false, // optional + userMFA: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md new file mode 100644 index 00000000..971173c2 --- /dev/null +++ b/docs/examples/project/update-mock-phone.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateMockPhone({ + number: '+12065550100', + otp: '<OTP>' +}); + +console.log(result); +``` 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..dab2d701 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Amazon({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..948c9a59 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new 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 +}); + +console.log(result); +``` 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..abde7451 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Auth0({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..41c118bf --- /dev/null +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Authentik({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..febb558a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Autodesk({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..f96ea278 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Bitbucket({ + key: '<KEY>', // optional + secret: '<SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..08cafcd0 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Bitly({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..08221d3d --- /dev/null +++ b/docs/examples/project/update-o-auth-2-box.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Box({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..8a520b29 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Dailymotion({ + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..5c921ceb --- /dev/null +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Discord({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..c091a6d0 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Disqus({ + publicKey: '<PUBLIC_KEY>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..c804af9f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Dropbox({ + appKey: '<APP_KEY>', // optional + appSecret: '<APP_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..8deff628 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Etsy({ + keyString: '<KEY_STRING>', // optional + sharedSecret: '<SHARED_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..74d1534f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Facebook({ + appId: '<APP_ID>', // optional + appSecret: '<APP_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..81038e28 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Figma({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..1cb70651 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2FusionAuth({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + endpoint: '<ENDPOINT>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..16bb06c8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2GitHub({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..d0c9806b --- /dev/null +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Gitlab({ + applicationId: '<APPLICATION_ID>', // optional + secret: '<SECRET>', // optional + endpoint: 'https://example.com', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..d13a8a45 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-google.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project, ProjectOAuth2GooglePrompt } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Google({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + prompt: [ProjectOAuth2GooglePrompt.None], // optional + enabled: false // optional +}); + +console.log(result); +``` 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..644c8e2e --- /dev/null +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new 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 +}); + +console.log(result); +``` 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..e5e2f559 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Kick({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..884e7110 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Linkedin({ + clientId: '<CLIENT_ID>', // optional + primaryClientSecret: '<PRIMARY_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..7cb0676a --- /dev/null +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Microsoft({ + applicationId: '<APPLICATION_ID>', // optional + applicationSecret: '<APPLICATION_SECRET>', // optional + tenant: '<TENANT>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..fa46c71c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Notion({ + oauthClientId: '<OAUTH_CLIENT_ID>', // optional + oauthClientSecret: '<OAUTH_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..557c27b9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new 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 +}); + +console.log(result); +``` 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..b0d3b94f --- /dev/null +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new 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 +}); + +console.log(result); +``` 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..45e6a7b1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2PaypalSandbox({ + clientId: '<CLIENT_ID>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..2a732863 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Paypal({ + clientId: '<CLIENT_ID>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..3c0497d9 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Podio({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..532733d5 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Salesforce({ + customerKey: '<CUSTOMER_KEY>', // optional + customerSecret: '<CUSTOMER_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..325b644c --- /dev/null +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Slack({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..d1f186b1 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Spotify({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..01413997 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Stripe({ + clientId: '<CLIENT_ID>', // optional + apiSecretKey: '<API_SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..62a7a899 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2TradeshiftSandbox({ + oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional + oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..646ca091 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Tradeshift({ + oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional + oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..d641bd65 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Twitch({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..f865a5fc --- /dev/null +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2WordPress({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..7e9d5279 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Yahoo({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..9e551cf8 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Yandex({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..ab2cfcd0 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Zoho({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..fbefecd3 --- /dev/null +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2Zoom({ + clientId: '<CLIENT_ID>', // optional + clientSecret: '<CLIENT_SECRET>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..144b4a8c --- /dev/null +++ b/docs/examples/project/update-o-auth-2x.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateOAuth2X({ + customerKey: '<CUSTOMER_KEY>', // optional + secretKey: '<SECRET_KEY>', // optional + enabled: false // optional +}); + +console.log(result); +``` 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..d1083d12 --- /dev/null +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updatePasswordDictionaryPolicy({ + enabled: false +}); + +console.log(result); +``` 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..22c26817 --- /dev/null +++ b/docs/examples/project/update-password-history-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updatePasswordHistoryPolicy({ + total: 1 +}); + +console.log(result); +``` 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..e8984f4b --- /dev/null +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updatePasswordPersonalDataPolicy({ + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md new file mode 100644 index 00000000..2c278772 --- /dev/null +++ b/docs/examples/project/update-protocol.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ProjectProtocolId } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateProtocol({ + protocolId: ProjectProtocolId.Rest, + enabled: false +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md new file mode 100644 index 00000000..d2daa084 --- /dev/null +++ b/docs/examples/project/update-service.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Project, ProjectServiceId } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateService({ + serviceId: ProjectServiceId.Account, + enabled: false +}); + +console.log(result); +``` 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..3f04b2c5 --- /dev/null +++ b/docs/examples/project/update-session-alert-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateSessionAlertPolicy({ + enabled: false +}); + +console.log(result); +``` 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..5a63205e --- /dev/null +++ b/docs/examples/project/update-session-duration-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateSessionDurationPolicy({ + duration: 5 +}); + +console.log(result); +``` 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..8e5e01ca --- /dev/null +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateSessionInvalidationPolicy({ + enabled: false +}); + +console.log(result); +``` 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..8b245e29 --- /dev/null +++ b/docs/examples/project/update-session-limit-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateSessionLimitPolicy({ + total: 1 +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md new file mode 100644 index 00000000..ac68fa13 --- /dev/null +++ b/docs/examples/project/update-smtp.md @@ -0,0 +1,24 @@ +```javascript +import { Client, Project, ProjectSMTPSecure } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new 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: ProjectSMTPSecure.Tls, // optional + enabled: false // optional +}); + +console.log(result); +``` 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..89f16441 --- /dev/null +++ b/docs/examples/project/update-user-limit-policy.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateUserLimitPolicy({ + total: 1 +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md new file mode 100644 index 00000000..ba9e4391 --- /dev/null +++ b/docs/examples/project/update-variable.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateVariable({ + variableId: '<VARIABLE_ID>', + key: '<KEY>', // optional + value: '<VALUE>', // optional + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md new file mode 100644 index 00000000..832dbfbd --- /dev/null +++ b/docs/examples/project/update-web-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateWebPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + hostname: 'app.example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md new file mode 100644 index 00000000..3d0f26b1 --- /dev/null +++ b/docs/examples/project/update-windows-platform.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Project } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const project = new Project(client); + +const result = await project.updateWindowsPlatform({ + platformId: '<PLATFORM_ID>', + name: '<NAME>', + packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md new file mode 100644 index 00000000..e7455452 --- /dev/null +++ b/docs/examples/proxy/create-api-rule.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.createAPIRule({ + domain: '' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md new file mode 100644 index 00000000..44a93995 --- /dev/null +++ b/docs/examples/proxy/create-function-rule.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.createFunctionRule({ + domain: '', + functionId: '<FUNCTION_ID>', + branch: '<BRANCH>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md new file mode 100644 index 00000000..7caa9c8e --- /dev/null +++ b/docs/examples/proxy/create-redirect-rule.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Proxy, StatusCode, ProxyResourceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.createRedirectRule({ + domain: '', + url: 'https://example.com', + statusCode: StatusCode.MovedPermanently301, + resourceId: '<RESOURCE_ID>', + resourceType: ProxyResourceType.Site +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md new file mode 100644 index 00000000..02db6911 --- /dev/null +++ b/docs/examples/proxy/create-site-rule.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.createSiteRule({ + domain: '', + siteId: '<SITE_ID>', + branch: '<BRANCH>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md new file mode 100644 index 00000000..115d78b9 --- /dev/null +++ b/docs/examples/proxy/delete-rule.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.deleteRule({ + ruleId: '<RULE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md new file mode 100644 index 00000000..6f52a062 --- /dev/null +++ b/docs/examples/proxy/get-rule.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.getRule({ + ruleId: '<RULE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md new file mode 100644 index 00000000..fb993b0d --- /dev/null +++ b/docs/examples/proxy/list-rules.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.listRules({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md new file mode 100644 index 00000000..46e579e4 --- /dev/null +++ b/docs/examples/proxy/update-rule-status.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Proxy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const proxy = new Proxy(client); + +const result = await proxy.updateRuleStatus({ + ruleId: '<RULE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md new file mode 100644 index 00000000..cf7ffe9c --- /dev/null +++ b/docs/examples/sites/create-deployment.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.createDeployment({ + siteId: '<SITE_ID>', + code: document.getElementById('uploader').files[0], + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md new file mode 100644 index 00000000..d9172798 --- /dev/null +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.createDuplicateDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md new file mode 100644 index 00000000..e1ebe775 --- /dev/null +++ b/docs/examples/sites/create-template-deployment.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Sites, TemplateReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.createTemplateDeployment({ + siteId: '<SITE_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + rootDirectory: '<ROOT_DIRECTORY>', + type: TemplateReferenceType.Branch, + reference: '<REFERENCE>', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md new file mode 100644 index 00000000..0b7a3fef --- /dev/null +++ b/docs/examples/sites/create-variable.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.createVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md new file mode 100644 index 00000000..d58947e9 --- /dev/null +++ b/docs/examples/sites/create-vcs-deployment.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Sites, VCSReferenceType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.createVcsDeployment({ + siteId: '<SITE_ID>', + type: VCSReferenceType.Branch, + reference: '<REFERENCE>', + activate: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md new file mode 100644 index 00000000..85e35285 --- /dev/null +++ b/docs/examples/sites/create.md @@ -0,0 +1,35 @@ +```javascript +import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.create({ + siteId: '<SITE_ID>', + name: '<NAME>', + framework: Framework.Analog, + buildRuntime: 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: 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 +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md new file mode 100644 index 00000000..a344accd --- /dev/null +++ b/docs/examples/sites/delete-deployment.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.deleteDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md new file mode 100644 index 00000000..65eb61b1 --- /dev/null +++ b/docs/examples/sites/delete-log.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.deleteLog({ + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md new file mode 100644 index 00000000..e2297008 --- /dev/null +++ b/docs/examples/sites/delete-variable.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.deleteVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md new file mode 100644 index 00000000..cb6756e2 --- /dev/null +++ b/docs/examples/sites/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.delete({ + siteId: '<SITE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md new file mode 100644 index 00000000..badf3a7c --- /dev/null +++ b/docs/examples/sites/get-deployment-download.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites, DeploymentDownloadType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = sites.getDeploymentDownload({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', + type: DeploymentDownloadType.Source // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md new file mode 100644 index 00000000..6986b429 --- /dev/null +++ b/docs/examples/sites/get-deployment.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.getDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md new file mode 100644 index 00000000..5a2c590e --- /dev/null +++ b/docs/examples/sites/get-log.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.getLog({ + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md new file mode 100644 index 00000000..e0fbe48e --- /dev/null +++ b/docs/examples/sites/get-variable.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.getVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md new file mode 100644 index 00000000..012ab9d6 --- /dev/null +++ b/docs/examples/sites/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.get({ + siteId: '<SITE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md new file mode 100644 index 00000000..b141b7f7 --- /dev/null +++ b/docs/examples/sites/list-deployments.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.listDeployments({ + siteId: '<SITE_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md new file mode 100644 index 00000000..13d10fc1 --- /dev/null +++ b/docs/examples/sites/list-frameworks.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.listFrameworks(); + +console.log(result); +``` diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md new file mode 100644 index 00000000..106aef04 --- /dev/null +++ b/docs/examples/sites/list-logs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.listLogs({ + siteId: '<SITE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md new file mode 100644 index 00000000..26faef89 --- /dev/null +++ b/docs/examples/sites/list-specifications.md @@ -0,0 +1,13 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.listSpecifications(); + +console.log(result); +``` diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md new file mode 100644 index 00000000..31b80257 --- /dev/null +++ b/docs/examples/sites/list-variables.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.listVariables({ + siteId: '<SITE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md new file mode 100644 index 00000000..34f07a29 --- /dev/null +++ b/docs/examples/sites/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md new file mode 100644 index 00000000..358c4dbb --- /dev/null +++ b/docs/examples/sites/update-deployment-status.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.updateDeploymentStatus({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md new file mode 100644 index 00000000..7388a96b --- /dev/null +++ b/docs/examples/sites/update-site-deployment.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.updateSiteDeployment({ + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md new file mode 100644 index 00000000..62e63991 --- /dev/null +++ b/docs/examples/sites/update-variable.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Sites } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.updateVariable({ + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', // optional + value: '<VALUE>', // optional + secret: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md new file mode 100644 index 00000000..0e925ec1 --- /dev/null +++ b/docs/examples/sites/update.md @@ -0,0 +1,35 @@ +```javascript +import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const sites = new Sites(client); + +const result = await sites.update({ + siteId: '<SITE_ID>', + name: '<NAME>', + framework: 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: BuildRuntime.Node145, // optional + adapter: 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 +}); + +console.log(result); +``` diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md new file mode 100644 index 00000000..8908249d --- /dev/null +++ b/docs/examples/storage/create-bucket.md @@ -0,0 +1,25 @@ +```javascript +import { Client, Storage, Compression, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const storage = new Storage(client); + +const result = await storage.createBucket({ + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: [Permission.read(Role.any())], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: Compression.None, // optional + encryption: false, // optional + antivirus: false, // optional + transformations: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md new file mode 100644 index 00000000..3e87249d --- /dev/null +++ b/docs/examples/storage/delete-bucket.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const storage = new Storage(client); + +const result = await storage.deleteBucket({ + bucketId: '<BUCKET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md new file mode 100644 index 00000000..804d20af --- /dev/null +++ b/docs/examples/storage/get-bucket.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const storage = new Storage(client); + +const result = await storage.getBucket({ + bucketId: '<BUCKET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md new file mode 100644 index 00000000..a2313243 --- /dev/null +++ b/docs/examples/storage/list-buckets.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const storage = new Storage(client); + +const result = await storage.listBuckets({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md new file mode 100644 index 00000000..974561f4 --- /dev/null +++ b/docs/examples/storage/update-bucket.md @@ -0,0 +1,25 @@ +```javascript +import { Client, Storage, Compression, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const storage = new Storage(client); + +const result = await storage.updateBucket({ + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: [Permission.read(Role.any())], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: Compression.None, // optional + encryption: false, // optional + antivirus: false, // optional + transformations: false // optional +}); + +console.log(result); +``` 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..b3c0bd77 --- /dev/null +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md new file mode 100644 index 00000000..0774f1d1 --- /dev/null +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createBooleanColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: false, // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md new file mode 100644 index 00000000..6357ae46 --- /dev/null +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md new file mode 100644 index 00000000..5d83cee6 --- /dev/null +++ b/docs/examples/tablesdb/create-email-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createEmailColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'email@example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md new file mode 100644 index 00000000..1a3f013b --- /dev/null +++ b/docs/examples/tablesdb/create-enum-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createEnumColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md new file mode 100644 index 00000000..efc0553d --- /dev/null +++ b/docs/examples/tablesdb/create-float-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md new file mode 100644 index 00000000..ae53bf23 --- /dev/null +++ b/docs/examples/tablesdb/create-index.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB, TablesDBIndexType, OrderBy } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + type: TablesDBIndexType.Key, + columns: [], + orders: [OrderBy.Asc], // optional + lengths: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md new file mode 100644 index 00000000..1bf07163 --- /dev/null +++ b/docs/examples/tablesdb/create-integer-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md new file mode 100644 index 00000000..91c877ce --- /dev/null +++ b/docs/examples/tablesdb/create-ip-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createIpColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md new file mode 100644 index 00000000..0239130e --- /dev/null +++ b/docs/examples/tablesdb/create-line-column.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createLineColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [[1, 2], [3, 4], [5, 6]] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md new file mode 100644 index 00000000..dda9dae5 --- /dev/null +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md new file mode 100644 index 00000000..c5be8a15 --- /dev/null +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md new file mode 100644 index 00000000..7a61823c --- /dev/null +++ b/docs/examples/tablesdb/create-point-column.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createPointColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [1, 2] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md new file mode 100644 index 00000000..fdf5c476 --- /dev/null +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md new file mode 100644 index 00000000..412f020d --- /dev/null +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB, RelationshipType, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createRelationshipColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + relatedTableId: '<RELATED_TABLE_ID>', + type: RelationshipType.OneToOne, + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: RelationMutate.Cascade // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 105c4445..3ca869aa 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -10,15 +10,16 @@ const tablesDB = new TablesDB(client); const result = await tablesDB.createRow({ databaseId: '<DATABASE_ID>', tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', + rowId: '<ROW_ID>', // optional data: { "username": "walter.obrien", "email": "walter.obrien@example.com", "fullName": "Walter O'Brien", "age": 30, "isAdmin": false - }, + }, // optional permissions: [Permission.read(Role.any())], // optional + rows: [], // optional 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..0032c72a --- /dev/null +++ b/docs/examples/tablesdb/create-string-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md new file mode 100644 index 00000000..064719d4 --- /dev/null +++ b/docs/examples/tablesdb/create-table.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + name: '<NAME>', + permissions: [Permission.read(Role.any())], // optional + rowSecurity: false, // optional + enabled: false, // optional + columns: [], // optional + indexes: [] // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md new file mode 100644 index 00000000..07c96773 --- /dev/null +++ b/docs/examples/tablesdb/create-text-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md new file mode 100644 index 00000000..1a619f2c --- /dev/null +++ b/docs/examples/tablesdb/create-url-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createUrlColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'https://example.com', // optional + array: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md new file mode 100644 index 00000000..9d5dbd68 --- /dev/null +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md new file mode 100644 index 00000000..458d1f6d --- /dev/null +++ b/docs/examples/tablesdb/create.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.create({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md new file mode 100644 index 00000000..d61e885b --- /dev/null +++ b/docs/examples/tablesdb/delete-column.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md new file mode 100644 index 00000000..33229588 --- /dev/null +++ b/docs/examples/tablesdb/delete-index.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md new file mode 100644 index 00000000..fe1867cb --- /dev/null +++ b/docs/examples/tablesdb/delete-rows.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md new file mode 100644 index 00000000..701ccbb6 --- /dev/null +++ b/docs/examples/tablesdb/delete-table.md @@ -0,0 +1,16 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.deleteTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md new file mode 100644 index 00000000..73a9ec80 --- /dev/null +++ b/docs/examples/tablesdb/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.delete({ + databaseId: '<DATABASE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md new file mode 100644 index 00000000..e3a6c982 --- /dev/null +++ b/docs/examples/tablesdb/get-column.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.getColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md new file mode 100644 index 00000000..d3629791 --- /dev/null +++ b/docs/examples/tablesdb/get-index.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.getIndex({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md new file mode 100644 index 00000000..828b8f1a --- /dev/null +++ b/docs/examples/tablesdb/get-table.md @@ -0,0 +1,16 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.getTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md new file mode 100644 index 00000000..f1623964 --- /dev/null +++ b/docs/examples/tablesdb/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.get({ + databaseId: '<DATABASE_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md new file mode 100644 index 00000000..68aa5218 --- /dev/null +++ b/docs/examples/tablesdb/list-columns.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.listColumns({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md new file mode 100644 index 00000000..41430a18 --- /dev/null +++ b/docs/examples/tablesdb/list-indexes.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.listIndexes({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md new file mode 100644 index 00000000..f224cecc --- /dev/null +++ b/docs/examples/tablesdb/list-tables.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.listTables({ + databaseId: '<DATABASE_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md new file mode 100644 index 00000000..86908f75 --- /dev/null +++ b/docs/examples/tablesdb/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` 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..25cdbba3 --- /dev/null +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md new file mode 100644 index 00000000..a5c66a01 --- /dev/null +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateBooleanColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: false, + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md new file mode 100644 index 00000000..af608bbc --- /dev/null +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md new file mode 100644 index 00000000..2a53e577 --- /dev/null +++ b/docs/examples/tablesdb/update-email-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateEmailColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'email@example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md new file mode 100644 index 00000000..873d7e03 --- /dev/null +++ b/docs/examples/tablesdb/update-enum-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateEnumColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + elements: [], + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md new file mode 100644 index 00000000..97d1ac7c --- /dev/null +++ b/docs/examples/tablesdb/update-float-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md new file mode 100644 index 00000000..377b1c8c --- /dev/null +++ b/docs/examples/tablesdb/update-integer-column.md @@ -0,0 +1,22 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md new file mode 100644 index 00000000..c45e95fb --- /dev/null +++ b/docs/examples/tablesdb/update-ip-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateIpColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md new file mode 100644 index 00000000..1d6e7a46 --- /dev/null +++ b/docs/examples/tablesdb/update-line-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md new file mode 100644 index 00000000..61b1ae88 --- /dev/null +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateLongtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md new file mode 100644 index 00000000..99174099 --- /dev/null +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateMediumtextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md new file mode 100644 index 00000000..186b6ff0 --- /dev/null +++ b/docs/examples/tablesdb/update-point-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updatePointColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: [1, 2], // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md new file mode 100644 index 00000000..18f1aabb --- /dev/null +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md new file mode 100644 index 00000000..fde78015 --- /dev/null +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -0,0 +1,19 @@ +```javascript +import { Client, TablesDB, RelationMutate } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateRelationshipColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + onDelete: RelationMutate.Cascade, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md new file mode 100644 index 00000000..8e2bca2d --- /dev/null +++ b/docs/examples/tablesdb/update-rows.md @@ -0,0 +1,25 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md new file mode 100644 index 00000000..f2d493b6 --- /dev/null +++ b/docs/examples/tablesdb/update-string-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateStringColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md new file mode 100644 index 00000000..af4068d8 --- /dev/null +++ b/docs/examples/tablesdb/update-table.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateTable({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + name: '<NAME>', // optional + permissions: [Permission.read(Role.any())], // optional + rowSecurity: false, // optional + enabled: false, // optional + purge: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md new file mode 100644 index 00000000..208c044e --- /dev/null +++ b/docs/examples/tablesdb/update-text-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateTextColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md new file mode 100644 index 00000000..1af088c8 --- /dev/null +++ b/docs/examples/tablesdb/update-url-column.md @@ -0,0 +1,20 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateUrlColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: 'https://example.com', + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md new file mode 100644 index 00000000..d387b934 --- /dev/null +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -0,0 +1,21 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.updateVarcharColumn({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + key: '', + required: false, + xdefault: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md new file mode 100644 index 00000000..f0a8a2f7 --- /dev/null +++ b/docs/examples/tablesdb/update.md @@ -0,0 +1,17 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.update({ + databaseId: '<DATABASE_ID>', + name: '<NAME>', // optional + enabled: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md new file mode 100644 index 00000000..a01aca2e --- /dev/null +++ b/docs/examples/tablesdb/upsert-rows.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.upsertRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rows: [], + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md new file mode 100644 index 00000000..40061e71 --- /dev/null +++ b/docs/examples/tokens/create-file-token.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tokens = new Tokens(client); + +const result = await tokens.createFileToken({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md new file mode 100644 index 00000000..448d2aa7 --- /dev/null +++ b/docs/examples/tokens/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tokens = new Tokens(client); + +const result = await tokens.delete({ + tokenId: '<TOKEN_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md new file mode 100644 index 00000000..257f81f9 --- /dev/null +++ b/docs/examples/tokens/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tokens = new Tokens(client); + +const result = await tokens.get({ + tokenId: '<TOKEN_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md new file mode 100644 index 00000000..ac836baa --- /dev/null +++ b/docs/examples/tokens/list.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tokens = new Tokens(client); + +const result = await tokens.list({ + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md new file mode 100644 index 00000000..b2284219 --- /dev/null +++ b/docs/examples/tokens/update.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Tokens } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tokens = new Tokens(client); + +const result = await tokens.update({ + tokenId: '<TOKEN_ID>', + expire: '2020-10-15T06:38:00.000+00:00' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md new file mode 100644 index 00000000..8b3b8559 --- /dev/null +++ b/docs/examples/usage/list-events.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Usage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const usage = new Usage(client); + +const result = await usage.listEvents({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md new file mode 100644 index 00000000..9a2e97f4 --- /dev/null +++ b/docs/examples/usage/list-gauges.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Usage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const usage = new Usage(client); + +const result = await usage.listGauges({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` 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..fd77c87d --- /dev/null +++ b/docs/examples/users/create-argon-2-user.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createArgon2User({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md new file mode 100644 index 00000000..4f283be0 --- /dev/null +++ b/docs/examples/users/create-bcrypt-user.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createBcryptUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md new file mode 100644 index 00000000..07a17be6 --- /dev/null +++ b/docs/examples/users/create-jwt.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createJWT({ + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', // optional + duration: 0 // optional +}); + +console.log(result); +``` 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..851d9fc9 --- /dev/null +++ b/docs/examples/users/create-md-5-user.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createMD5User({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` 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..a9cc4bd4 --- /dev/null +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createMfaRecoveryCodes({ + userId: '<USER_ID>' +}); + +console.log(result); +``` 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..f7464853 --- /dev/null +++ b/docs/examples/users/create-ph-pass-user.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createPHPassUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +}); + +console.log(result); +``` 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..2a783bab --- /dev/null +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md new file mode 100644 index 00000000..808539b0 --- /dev/null +++ b/docs/examples/users/create-scrypt-user.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md new file mode 100644 index 00000000..db9f0202 --- /dev/null +++ b/docs/examples/users/create-session.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createSession({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md new file mode 100644 index 00000000..c3d7fbbd --- /dev/null +++ b/docs/examples/users/create-sha-user.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users, PasswordHash } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createSHAUser({ + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordVersion: PasswordHash.Sha1, // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md new file mode 100644 index 00000000..b62723ce --- /dev/null +++ b/docs/examples/users/create-target.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Users, MessagingProviderType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + providerType: MessagingProviderType.Email, + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md new file mode 100644 index 00000000..39d85e57 --- /dev/null +++ b/docs/examples/users/create-token.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.createToken({ + userId: '<USER_ID>', + length: 4, // optional + expire: 60 // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md new file mode 100644 index 00000000..ae89fb9f --- /dev/null +++ b/docs/examples/users/create.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.create({ + userId: '<USER_ID>', + email: 'email@example.com', // optional + phone: '+12065550100', // optional + password: '', // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md new file mode 100644 index 00000000..595d3d9b --- /dev/null +++ b/docs/examples/users/delete-identity.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.deleteIdentity({ + identityId: '<IDENTITY_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md new file mode 100644 index 00000000..81d5b18b --- /dev/null +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users, AuthenticatorType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.deleteMfaAuthenticator({ + userId: '<USER_ID>', + type: AuthenticatorType.Totp +}); + +console.log(result); +``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/users/delete-session.md similarity index 60% rename from docs/examples/account/update-verification.md rename to docs/examples/users/delete-session.md index 3b52a83c..49ccaf42 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/users/delete-session.md @@ -1,15 +1,15 @@ ```javascript -import { Client, Account } from "appwrite"; +import { Client, Users } from "appwrite"; const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID -const account = new Account(client); +const users = new Users(client); -const result = await account.updateVerification({ +const result = await users.deleteSession({ userId: '<USER_ID>', - secret: '<SECRET>' + sessionId: '<SESSION_ID>' }); console.log(result); diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md new file mode 100644 index 00000000..7ba6f4fd --- /dev/null +++ b/docs/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.deleteSessions({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md new file mode 100644 index 00000000..3e0eb547 --- /dev/null +++ b/docs/examples/users/delete-target.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.deleteTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md new file mode 100644 index 00000000..82974a00 --- /dev/null +++ b/docs/examples/users/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.delete({ + userId: '<USER_ID>' +}); + +console.log(result); +``` 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..c9c19e22 --- /dev/null +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.getMfaRecoveryCodes({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md new file mode 100644 index 00000000..f5f8df30 --- /dev/null +++ b/docs/examples/users/get-prefs.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.getPrefs({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md new file mode 100644 index 00000000..4426de45 --- /dev/null +++ b/docs/examples/users/get-target.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.getTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md new file mode 100644 index 00000000..a3aa0246 --- /dev/null +++ b/docs/examples/users/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.get({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md new file mode 100644 index 00000000..f3500c6e --- /dev/null +++ b/docs/examples/users/list-identities.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.listIdentities({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md new file mode 100644 index 00000000..58516305 --- /dev/null +++ b/docs/examples/users/list-logs.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.listLogs({ + userId: '<USER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md new file mode 100644 index 00000000..07d7e782 --- /dev/null +++ b/docs/examples/users/list-memberships.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.listMemberships({ + userId: '<USER_ID>', + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md new file mode 100644 index 00000000..b15be0c8 --- /dev/null +++ b/docs/examples/users/list-mfa-factors.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.listMfaFactors({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md new file mode 100644 index 00000000..f5f1d7df --- /dev/null +++ b/docs/examples/users/list-sessions.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.listSessions({ + userId: '<USER_ID>', + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md new file mode 100644 index 00000000..38276a41 --- /dev/null +++ b/docs/examples/users/list-targets.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.listTargets({ + userId: '<USER_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md new file mode 100644 index 00000000..10f14129 --- /dev/null +++ b/docs/examples/users/list.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.list({ + queries: [], // optional + search: '<SEARCH>', // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md new file mode 100644 index 00000000..41cc7818 --- /dev/null +++ b/docs/examples/users/update-email-verification.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateEmailVerification({ + userId: '<USER_ID>', + emailVerification: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md new file mode 100644 index 00000000..26f56f62 --- /dev/null +++ b/docs/examples/users/update-email.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateEmail({ + userId: '<USER_ID>', + email: 'email@example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md new file mode 100644 index 00000000..917cd1f7 --- /dev/null +++ b/docs/examples/users/update-impersonator.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateImpersonator({ + userId: '<USER_ID>', + impersonator: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md new file mode 100644 index 00000000..5754ca2e --- /dev/null +++ b/docs/examples/users/update-labels.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateLabels({ + userId: '<USER_ID>', + labels: [] +}); + +console.log(result); +``` 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..c79714d6 --- /dev/null +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateMfaRecoveryCodes({ + userId: '<USER_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md new file mode 100644 index 00000000..9a4c579c --- /dev/null +++ b/docs/examples/users/update-mfa.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateMfa({ + userId: '<USER_ID>', + mfa: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md new file mode 100644 index 00000000..5462a36d --- /dev/null +++ b/docs/examples/users/update-name.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateName({ + userId: '<USER_ID>', + name: '<NAME>' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md new file mode 100644 index 00000000..62915d50 --- /dev/null +++ b/docs/examples/users/update-password.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updatePassword({ + userId: '<USER_ID>', + password: '' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md new file mode 100644 index 00000000..882cc511 --- /dev/null +++ b/docs/examples/users/update-phone-verification.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updatePhoneVerification({ + userId: '<USER_ID>', + phoneVerification: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md new file mode 100644 index 00000000..8b367e9a --- /dev/null +++ b/docs/examples/users/update-phone.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updatePhone({ + userId: '<USER_ID>', + number: '+12065550100' +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md new file mode 100644 index 00000000..89f38d33 --- /dev/null +++ b/docs/examples/users/update-prefs.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updatePrefs({ + userId: '<USER_ID>', + prefs: {} +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md new file mode 100644 index 00000000..c9e583b2 --- /dev/null +++ b/docs/examples/users/update-status.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateStatus({ + userId: '<USER_ID>', + status: false +}); + +console.log(result); +``` diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md new file mode 100644 index 00000000..76868514 --- /dev/null +++ b/docs/examples/users/update-target.md @@ -0,0 +1,19 @@ +```javascript +import { Client, Users } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const users = new Users(client); + +const result = await users.updateTarget({ + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // optional + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md new file mode 100644 index 00000000..d5d87086 --- /dev/null +++ b/docs/examples/webhooks/create.md @@ -0,0 +1,23 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const webhooks = new 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 +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md new file mode 100644 index 00000000..d80acfbd --- /dev/null +++ b/docs/examples/webhooks/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const webhooks = new Webhooks(client); + +const result = await webhooks.delete({ + webhookId: '<WEBHOOK_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md new file mode 100644 index 00000000..5d737d5e --- /dev/null +++ b/docs/examples/webhooks/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const webhooks = new Webhooks(client); + +const result = await webhooks.get({ + webhookId: '<WEBHOOK_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md new file mode 100644 index 00000000..282d3546 --- /dev/null +++ b/docs/examples/webhooks/list.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const webhooks = new Webhooks(client); + +const result = await webhooks.list({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md new file mode 100644 index 00000000..7736f73c --- /dev/null +++ b/docs/examples/webhooks/update-secret.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const webhooks = new Webhooks(client); + +const result = await webhooks.updateSecret({ + webhookId: '<WEBHOOK_ID>', + secret: '<SECRET>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md new file mode 100644 index 00000000..2dad3865 --- /dev/null +++ b/docs/examples/webhooks/update.md @@ -0,0 +1,22 @@ +```javascript +import { Client, Webhooks } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const webhooks = new 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 +}); + +console.log(result); +``` diff --git a/package-lock.json b/package-lock.json index ee1f26d3..a3aa13e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "appwrite", - "version": "25.1.1", + "version": "26.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "appwrite", - "version": "25.1.1", + "version": "26.0.0", "license": "BSD-3-Clause", "dependencies": { "json-bigint": "1.0.0" diff --git a/package.json b/package.json index af76357c..b3307c14 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "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.1", + "version": "26.0.0", "license": "BSD-3-Clause", "main": "dist/cjs/sdk.js", "exports": { diff --git a/src/client.ts b/src/client.ts index 26012676..38a1ac44 100644 --- a/src/client.ts +++ b/src/client.ts @@ -344,8 +344,48 @@ class AppwriteException extends Error { /** * Client that handles requests to Appwrite */ -class Client { +type SDKPlatform = 'client' | 'server'; +type ClientAuth = 'browser' | 'session' | 'devKey' | 'impersonation'; +type ServerAuth = 'apiKey' | 'jwt' | 'cookie'; +type Auth = ClientAuth | ServerAuth; +declare const clientAuthBrand: unique symbol; + +// Forces TypeScript to display the expanded shape on hover instead of an alias name. +type Prettify<T> = { [K in keyof T]: T[K] } & {}; + +type BaseClientParams = { + endpoint: string; + endpointRealtime?: string; + selfSigned?: boolean; + projectId: string; + locale?: string; +}; + +type ImpersonationTarget = + | { userId: string; email?: never; phone?: never } + | { email: string; userId?: never; phone?: never } + | { phone: string; userId?: never; email?: never }; + +type LegacyClientSetter = Extract<keyof ClientRuntime<any>, `set${string}`>; +type ClientAuthBuilder = Extract<keyof ClientRuntime<any>, `with${string}`>; +type ClientInternalMethod = LegacyClientSetter | ClientAuthBuilder; +export type Client<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientInternalMethod>; +type LegacyClient<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientAuthBuilder>; + +type ClientConstructor = { + new <TAuth extends Auth = 'browser'>(): LegacyClient<TAuth>; + from(params: Prettify<BaseClientParams>): Client<'browser'>; + fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'>; + fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'>; + fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'>; + fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'>; + fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'>; + fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'>; +}; + +class ClientRuntime<TAuth extends Auth = 'browser'> { static CHUNK_SIZE = 1024 * 1024 * 5; + declare readonly [clientAuthBrand]?: TAuth; /** * Holds configuration such as project. @@ -362,6 +402,9 @@ class Client { impersonateuserid: string; impersonateuseremail: string; impersonateuserphone: string; + key: string; + forwardeduseragent: string; + selfSigned: boolean; } = { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', @@ -374,18 +417,133 @@ class Client { impersonateuserid: '', impersonateuseremail: '', impersonateuserphone: '', + key: '', + forwardeduseragent: '', + selfSigned: false, }; + + private sdkPlatform: SDKPlatform = 'server'; + /** * Custom headers for API requests. */ headers: Headers = { 'x-sdk-name': 'Web', - 'x-sdk-platform': 'client', + 'x-sdk-platform': 'server', 'x-sdk-language': 'web', - 'x-sdk-version': '25.1.1', + 'x-sdk-version': '26.0.0', 'X-Appwrite-Response-Format': '1.9.5', }; + static from(params: Prettify<BaseClientParams>): Client<'browser'> { + return new ClientRuntime<'browser'>().applyBase<'browser'>(params, 'client'); + } + + static fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'> { + const client = new ClientRuntime<'session'>() + .applyBase<'session'>(params, 'client'); + client.headers['X-Appwrite-Session'] = params.session; + client.config.session = params.session; + return client; + } + + static fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'> { + const client = new ClientRuntime<'apiKey'>() + .applyBase<'apiKey'>(params, 'server'); + client.headers['X-Appwrite-Key'] = params.apiKey; + (client.config as unknown as Record<string, string>).key = params.apiKey; + return client; + } + + static fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'> { + const client = new ClientRuntime<'cookie'>() + .applyBase<'cookie'>(params, 'server'); + client.headers['Cookie'] = params.cookie; + client.config.cookie = params.cookie; + return client; + } + + static fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'> { + const client = new ClientRuntime<'jwt'>() + .applyBase<'jwt'>(params, 'server'); + client.headers['X-Appwrite-JWT'] = params.jwt; + client.config.jwt = params.jwt; + return client; + } + + static fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'> { + const client = new ClientRuntime<'devKey'>() + .applyBase<'devKey'>(params, 'client'); + client.headers['X-Appwrite-Dev-Key'] = params.devKey; + client.config.devkey = params.devKey; + return client; + } + + static fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'> { + const targets = [ + params.userId !== undefined, + params.email !== undefined, + params.phone !== undefined + ].filter(Boolean).length; + + if (targets !== 1) { + throw new AppwriteException('Exactly one impersonation target must be provided'); + } + + const client = new ClientRuntime<'impersonation'>() + .applyBase<'impersonation'>(params, 'client'); + + client.headers['X-Appwrite-Session'] = params.session; + client.config.session = params.session; + + if (params.userId !== undefined) { + client.headers['X-Appwrite-Impersonate-User-Id'] = params.userId; + client.config.impersonateuserid = params.userId; + return client; + } + if (params.email !== undefined) { + client.headers['X-Appwrite-Impersonate-User-Email'] = params.email; + client.config.impersonateuseremail = params.email; + return client; + } + client.headers['X-Appwrite-Impersonate-User-Phone'] = params.phone; + client.config.impersonateuserphone = params.phone; + return client; + } + + withJWT(jwt: string): this { + this.headers['X-Appwrite-JWT'] = jwt; + this.config.jwt = jwt; + return this; + } + + withForwardedUserAgent(forwardedUserAgent: string): this { + this.headers['X-Forwarded-User-Agent'] = forwardedUserAgent; + return this; + } + + private applyBase<T extends Auth>(params: BaseClientParams, sdkPlatform: SDKPlatform): ClientRuntime<T> { + const client = this as unknown as ClientRuntime<T>; + client.sdkPlatform = sdkPlatform; + client.headers['x-sdk-platform'] = sdkPlatform === 'server' ? 'server' : 'client'; + client.setEndpoint(params.endpoint); + client.setProject(params.projectId); + + if (params.locale !== undefined) { + client.setLocale(params.locale); + } + + if (params.endpointRealtime !== undefined) { + client.setEndpointRealtime(params.endpointRealtime); + } + + if (params.selfSigned !== undefined) { + client.setSelfSigned(params.selfSigned); + } + + return client; + } + /** * Get Headers * @@ -407,6 +565,9 @@ class Client { * * @returns {this} */ + /** + * @deprecated Use `Client.from`, `Client.fromSession`, `Client.fromAPIKey`, or another static factory instead. + */ setEndpoint(endpoint: string): this { if (!endpoint || typeof endpoint !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -429,6 +590,9 @@ class Client { * * @returns {this} */ + /** + * @deprecated Use the `endpointRealtime` field on a static factory params object instead. + */ setEndpointRealtime(endpointRealtime: string): this { if (!endpointRealtime || typeof endpointRealtime !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -443,130 +607,120 @@ class Client { } /** - * Set Project + * Set self-signed * - * Your project ID + * @param {boolean} selfSigned * - * @param value string - * - * @return {this} + * @returns {this} + */ + /** + * @deprecated Use the `selfSigned` field on a static factory params object instead. + */ + setSelfSigned(selfSigned: boolean): this { + this.config.selfSigned = selfSigned; + return this; + } + + /** + * @deprecated Use a static client factory or factory params object instead. */ setProject(value: string): this { this.headers['X-Appwrite-Project'] = value; this.config.project = value; - return this; + return this as unknown as this; } + /** - * Set JWT - * - * Your secret JSON Web Token - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setJWT(value: string): this { + setJWT(value: string): ClientRuntime<'jwt'> { this.headers['X-Appwrite-JWT'] = value; this.config.jwt = value; - return this; + return this as unknown as ClientRuntime<'jwt'>; } + /** - * Set Locale - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ setLocale(value: string): this { this.headers['X-Appwrite-Locale'] = value; this.config.locale = value; - return this; + return this as unknown as this; } + /** - * Set Session - * - * The user session to authenticate with - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setSession(value: string): this { + setSession(value: string): ClientRuntime<'session'> { this.headers['X-Appwrite-Session'] = value; this.config.session = value; - return this; + return this as unknown as ClientRuntime<'session'>; } + /** - * Set DevKey - * - * Your secret dev API key - * - * @param value string - * - * @return {this} + * @deprecated Use a static client factory or factory params object instead. */ - setDevKey(value: string): this { + setDevKey(value: string): ClientRuntime<'devKey'> { this.headers['X-Appwrite-Dev-Key'] = value; this.config.devkey = value; - return this; + return this as unknown as ClientRuntime<'devKey'>; } + /** - * 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} + * @deprecated Use a static client factory or factory params object instead. */ - setCookie(value: string): this { + setCookie(value: string): ClientRuntime<'cookie'> { this.headers['Cookie'] = value; this.config.cookie = value; - return this; + return this as unknown as ClientRuntime<'cookie'>; } + /** - * 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} + * @deprecated Use a static client factory or factory params object instead. */ - setImpersonateUserId(value: string): this { + setImpersonateUserId(value: string): ClientRuntime<'impersonation'> { this.headers['X-Appwrite-Impersonate-User-Id'] = value; this.config.impersonateuserid = value; - return this; + return this as unknown as ClientRuntime<'impersonation'>; } + /** - * 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} + * @deprecated Use a static client factory or factory params object instead. */ - setImpersonateUserEmail(value: string): this { + setImpersonateUserEmail(value: string): ClientRuntime<'impersonation'> { this.headers['X-Appwrite-Impersonate-User-Email'] = value; this.config.impersonateuseremail = value; - return this; + return this as unknown as ClientRuntime<'impersonation'>; } + /** - * 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} + * @deprecated Use a static client factory or factory params object instead. */ - setImpersonateUserPhone(value: string): this { + setImpersonateUserPhone(value: string): ClientRuntime<'impersonation'> { this.headers['X-Appwrite-Impersonate-User-Phone'] = value; this.config.impersonateuserphone = value; - return this; + return this as unknown as ClientRuntime<'impersonation'>; } + /** + * @deprecated Use a static client factory or factory params object instead. + */ + setKey(value: string): ClientRuntime<'apiKey'> { + this.headers['X-Appwrite-Key'] = value; + this.config.key = value; + return this as unknown as ClientRuntime<'apiKey'>; + } + + /** + * @deprecated Use a static client factory or factory params object instead. + */ + setForwardedUserAgent(value: string): this { + this.headers['X-Forwarded-User-Agent'] = value; + this.config.forwardeduseragent = value; + return this as unknown as this; + } + + private realtime: Realtime = { socket: undefined, timeout: undefined, @@ -580,9 +734,13 @@ class Client { lastMessage: undefined, connect: () => { clearTimeout(this.realtime.timeout); - this.realtime.timeout = window?.setTimeout(() => { - this.realtime.createSocket(); - }, 50); + this.realtime.timeout = typeof window !== 'undefined' + ? window.setTimeout(() => { + this.realtime.createSocket(); + }, 50) + : setTimeout(() => { + this.realtime.createSocket(); + }, 50) as unknown as TimeoutHandle; }, getTimeout: () => { switch (true) { @@ -598,14 +756,20 @@ class Client { }, createHeartbeat: () => { if (this.realtime.heartbeat) { - clearTimeout(this.realtime.heartbeat); + clearInterval(this.realtime.heartbeat as any); } - this.realtime.heartbeat = window?.setInterval(() => { - this.realtime.socket?.send(JSONbig.stringify({ - type: 'ping' - })); - }, 20_000); + this.realtime.heartbeat = typeof window !== 'undefined' + ? window.setInterval(() => { + this.realtime.socket?.send(JSONbig.stringify({ + type: 'ping' + })); + }, 20_000) + : setInterval(() => { + this.realtime.socket?.send(JSONbig.stringify({ + type: 'ping' + })); + }, 20_000) as unknown as TimeoutHandle; }, createSocket: () => { if (this.realtime.subscriptions.size < 1) { @@ -691,8 +855,14 @@ class Client { let session = this.config.session; if (!session) { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.config.project}`]; + try { + if (typeof window !== 'undefined' && window.localStorage) { + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.config.project}`]; + } + } catch (error) { + console.error('Failed to parse cookie fallback:', error); + } } if (session && !messageData?.user) { this.realtime.socket?.send(JSONbig.stringify(<RealtimeRequest>{ @@ -857,7 +1027,7 @@ class Client { headers = Object.assign({}, this.headers, headers); - if (typeof window !== 'undefined' && window.localStorage) { + if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage) { const cookieFallback = window.localStorage.getItem('cookieFallback'); if (cookieFallback) { headers['X-Fallback-Cookies'] = cookieFallback; @@ -869,12 +1039,12 @@ class Client { headers, }; - if (headers['X-Appwrite-Dev-Key'] === undefined) { + if (this.sdkPlatform === 'client' && headers['X-Appwrite-Dev-Key'] === undefined) { options.credentials = 'include'; } if (method === 'GET') { - for (const [key, value] of Object.entries(Client.flatten(params))) { + for (const [key, value] of Object.entries(ClientRuntime.flatten(params))) { url.searchParams.append(key, value); } } else { @@ -884,6 +1054,10 @@ class Client { break; case 'multipart/form-data': + if (typeof FormData === 'undefined' || typeof File === 'undefined') { + throw new AppwriteException('Multipart requests require File and FormData globals'); + } + const formData = new FormData(); for (const [key, value] of Object.entries(params)) { @@ -908,13 +1082,17 @@ class Client { } async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) { + if (typeof File === 'undefined' || typeof FormData === 'undefined') { + throw new AppwriteException('Chunked uploads require File and FormData globals'); + } + const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? []; if (!file || !fileParam) { throw new Error('File not found in payload'); } - if (file.size <= Client.CHUNK_SIZE) { + if (file.size <= ClientRuntime.CHUNK_SIZE) { return await this.call(method, url, headers, originalPayload); } @@ -922,26 +1100,27 @@ class Client { let response = null; while (start < file.size) { - let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk + let end = start + ClientRuntime.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 chunkHeaders = { ...headers }; + chunkHeaders['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); + response = await this.call(method, url, chunkHeaders, 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) + chunksTotal: Math.ceil(file.size / ClientRuntime.CHUNK_SIZE), + chunksUploaded: Math.ceil(end / ClientRuntime.CHUNK_SIZE) }); } @@ -967,9 +1146,9 @@ class Client { const response = await fetch(uri, options); // type opaque: No-CORS, different-origin response (CORS-issue) - if (response.type === 'opaque') { + if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && response.type === 'opaque') { throw new AppwriteException( - `Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`, + `Invalid Origin. Register your new client (${typeof window !== 'undefined' ? window.location.host : 'unknown'}) as a new Web platform on your project console dashboard`, 403, "forbidden", "" @@ -1003,7 +1182,7 @@ class Client { const cookieFallback = response.headers.get('X-Fallback-Cookies'); - if (typeof window !== 'undefined' && window.localStorage && cookieFallback) { + if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage && cookieFallback) { window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); window.localStorage.setItem('cookieFallback', cookieFallback); } @@ -1021,7 +1200,7 @@ class Client { for (const [key, value] of Object.entries(data)) { let finalKey = prefix ? prefix + '[' + key +']' : key; if (Array.isArray(value)) { - output = { ...output, ...Client.flatten(value, finalKey) }; + output = { ...output, ...ClientRuntime.flatten(value, finalKey) }; } else { output[finalKey] = value; } @@ -1031,8 +1210,9 @@ class Client { } } +const Client = ClientRuntime as unknown as ClientConstructor; + export { Client, AppwriteException }; +export type { Models, SDKPlatform, ClientAuth, ServerAuth, Payload, RealtimeResponseEvent, UploadProgress }; export { Query } from './query'; -export type { Models, Payload, UploadProgress }; -export type { RealtimeResponseEvent }; 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/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/build-runtime.ts b/src/enums/build-runtime.ts new file mode 100644 index 00000000..1466d635 --- /dev/null +++ b/src/enums/build-runtime.ts @@ -0,0 +1,91 @@ +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', + 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/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/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/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/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..f4d20688 --- /dev/null +++ b/src/enums/runtime.ts @@ -0,0 +1,91 @@ +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', + 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/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/index.ts b/src/index.ts index 89b0a515..caffb1df 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,18 +7,29 @@ */ 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 { Realtime } from './services/realtime'; -export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; +export type { Models, Payload, RealtimeResponseEvent, UploadProgress, SDKPlatform, ClientAuth, ServerAuth } from './client'; export type { RealtimeSubscription } from './services/realtime'; export type { QueryTypes, QueryTypesList } from './query'; export { Permission } from './permission'; @@ -36,7 +47,51 @@ 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/models.ts b/src/models.ts index 9556fba0..404dc453 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1,5 +1,20 @@ +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 @@ -50,6 +65,90 @@ export namespace Models { 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 */ @@ -106,6 +205,34 @@ export namespace Models { 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 */ @@ -134,6 +261,76 @@ export namespace Models { 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 */ @@ -148,6 +345,34 @@ export namespace Models { 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 */ @@ -219,1238 +444,6648 @@ export namespace Models { } /** - * Locale codes list + * Variables List */ - export type LocaleCodeList = { + export type VariableList = { /** - * Total number of localeCodes that matched your query. + * Total number of variables that matched your query. */ total: number; /** - * List of localeCodes. + * List of variables. */ - localeCodes: LocaleCode[]; + variables: Variable[]; } /** - * Transaction List + * Mock Numbers List */ - export type TransactionList = { + export type MockNumberList = { /** - * Total number of transactions that matched your query. + * Total number of mockNumbers that matched your query. */ total: number; /** - * List of transactions. + * List of mockNumbers. */ - transactions: Transaction[]; + mockNumbers: MockNumber[]; } /** - * Row + * Policies List */ - export type Row = { - /** - * Row ID. - */ - $id: string; + export type PolicyList = { /** - * Row sequence ID. + * Total number of policies in the given project. */ - $sequence: string; + total: number; /** - * Table ID. + * List of policies. */ - $tableId: string; + 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 = { /** - * Database ID. + * Total number of templates that matched your query. */ - $databaseId: string; + total: number; /** - * Row creation date in ISO 8601 format. + * List of templates. */ - $createdAt: string; + templates: EmailTemplate[]; + } + + /** + * Status List + */ + export type HealthStatusList = { /** - * Row update date in ISO 8601 format. + * Total number of statuses that matched your query. */ - $updatedAt: string; + total: number; /** - * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * List of statuses. */ - $permissions: string[]; + statuses: HealthStatus[]; } - export type DefaultRow = Row & { - [key: string]: any; - [__default]: true; - }; - /** - * Document + * Rule List */ - export type Document = { - /** - * Document ID. - */ - $id: string; + export type ProxyRuleList = { /** - * Document sequence ID. + * Total number of rules that matched your query. */ - $sequence: string; + total: number; /** - * Collection ID. + * List of rules. */ - $collectionId: string; + rules: ProxyRule[]; + } + + /** + * Locale codes list + */ + export type LocaleCodeList = { /** - * Database ID. + * Total number of localeCodes that matched your query. */ - $databaseId: string; + total: number; /** - * Document creation date in ISO 8601 format. + * List of localeCodes. */ - $createdAt: string; + localeCodes: LocaleCode[]; + } + + /** + * Provider list + */ + export type ProviderList = { /** - * Document update date in ISO 8601 format. + * Total number of providers that matched your query. */ - $updatedAt: string; + total: number; /** - * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * List of providers. */ - $permissions: string[]; + providers: Provider[]; } - export type DefaultDocument = Document & { - [key: string]: any; - [__default]: true; - }; - /** - * Presence + * Message list */ - export type Presence = { + export type MessageList = { /** - * Presence ID. + * Total number of messages that matched your query. */ - $id: string; + total: number; /** - * Presence creation date in ISO 8601 format. + * List of messages. */ - $createdAt: string; + messages: Message[]; + } + + /** + * Topic list + */ + export type TopicList = { /** - * Presence update date in ISO 8601 format. + * Total number of topics that matched your query. */ - $updatedAt: string; + total: number; /** - * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * List of topics. */ - $permissions: string[]; + topics: Topic[]; + } + + /** + * Subscriber list + */ + export type SubscriberList = { /** - * User ID. + * Total number of subscribers that matched your query. */ - userId: string; + total: number; /** - * Presence status. + * List of subscribers. */ - status?: string; + subscribers: Subscriber[]; + } + + /** + * Target list + */ + export type TargetList = { /** - * Presence source. + * Total number of targets that matched your query. */ - source: string; + total: number; /** - * Presence expiry date in ISO 8601 format. + * List of targets. */ - expiresAt?: string; + targets: Target[]; } - export type DefaultPresence = Presence & { - [key: string]: any; - [__default]: true; - }; + /** + * Transaction List + */ + export type TransactionList = { + /** + * Total number of transactions that matched your query. + */ + total: number; + /** + * List of transactions. + */ + transactions: Transaction[]; + } /** - * Log + * Specifications List */ - export type Log = { + export type SpecificationList = { /** - * Event name. + * Total number of specifications that matched your query. */ - event: string; + total: number; /** - * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. + * List of specifications. */ - userId: string; + specifications: Specification[]; + } + + /** + * Insights List + */ + export type InsightList = { /** - * User email of the actor recorded for this log. During impersonation, this is the original impersonator. + * Total number of insights that matched your query. */ - userEmail: string; + total: number; /** - * User name of the actor recorded for this log. During impersonation, this is the original impersonator. + * List of insights. */ - userName: string; + insights: Insight[]; + } + + /** + * Reports List + */ + export type ReportList = { /** - * API mode when event triggered. + * Total number of reports that matched your query. */ - mode: string; + total: number; /** - * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. + * List of reports. */ - userType: string; + reports: Report[]; + } + + /** + * Database + */ + export type Database = { /** - * IP session in use when the session was created. + * Database ID. */ - ip: string; + $id: string; /** - * Log creation date in ISO 8601 format. + * Database name. */ - time: string; + name: string; /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + * Database creation date in ISO 8601 format. */ - osCode: string; + $createdAt: string; /** - * Operating system name. + * Database update date in ISO 8601 format. */ - osName: string; + $updatedAt: string; /** - * Operating system version. + * 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. */ - osVersion: string; + enabled: boolean; /** - * Client type. + * Database type. */ - clientType: string; + type: DatabaseType; /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + * Database backup policies. */ - clientCode: string; + policies: BackupPolicy[]; /** - * Client name. + * Database backup archives. */ - clientName: string; + archives: BackupArchive[]; + } + + /** + * Collection + */ + export type Collection = { /** - * Client version. + * Collection ID. */ - clientVersion: string; + $id: string; /** - * Client engine name. + * Collection creation date in ISO 8601 format. */ - clientEngine: string; + $createdAt: string; /** - * Client engine name. + * Collection update date in ISO 8601 format. */ - clientEngineVersion: string; + $updatedAt: string; /** - * Device name. + * Collection permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - deviceName: string; + $permissions: string[]; /** - * Device brand name. + * Database ID. */ - deviceBrand: string; + databaseId: string; /** - * Device model name. + * Collection name. */ - deviceModel: string; + name: string; /** - * Country two-character ISO 3166-1 alpha code. + * Collection enabled. Can be 'enabled' or 'disabled'. When disabled, the collection is inaccessible to users, but remains accessible to Server SDKs using API keys. */ - countryCode: string; + enabled: boolean; /** - * Country name. + * Whether document-level permissions are enabled. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - countryName: string; + 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; } /** - * User + * Attributes List */ - export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + export type AttributeList = { /** - * User ID. + * Total number of attributes in the given collection. */ - $id: string; + total: number; /** - * User creation date in ISO 8601 format. + * List of attributes. */ - $createdAt: string; + 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 = { /** - * User update date in ISO 8601 format. + * Attribute Key. */ - $updatedAt: string; + key: string; /** - * User name. + * Attribute type. */ - name: string; + type: string; /** - * Hashed user password. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - password?: string; + status: AttributeStatus; /** - * Password hashing algorithm. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - hash?: string; + error: string; /** - * Password hashing algorithm configuration. + * Is attribute required? */ - hashOptions?: object; + required: boolean; /** - * User registration date in ISO 8601 format. + * Is attribute an array? */ - registration: string; + array?: boolean; /** - * User status. Pass `true` for enabled and `false` for disabled. + * Attribute creation date in ISO 8601 format. */ - status: boolean; + $createdAt: string; /** - * Labels for the user. + * Attribute update date in ISO 8601 format. */ - labels: string[]; + $updatedAt: string; /** - * Password update time in ISO 8601 format. + * Attribute size. */ - passwordUpdate: string; + size: number; /** - * User email address. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - email: string; + default?: string; /** - * User phone number in E.164 format. + * Defines whether this attribute is encrypted or not. */ - phone: string; + encrypt?: boolean; + } + + /** + * AttributeInteger + */ + export type AttributeInteger = { /** - * Email verification status. + * Attribute Key. */ - emailVerification: boolean; + key: string; /** - * Phone verification status. + * Attribute type. */ - phoneVerification: boolean; + type: string; /** - * Multi factor authentication status. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - mfa: boolean; + status: AttributeStatus; /** - * User preferences as a key-value object + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - prefs: Preferences; + error: string; /** - * 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. + * Is attribute required? */ - targets: Target[]; + required: boolean; /** - * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. + * Is attribute an array? */ - accessedAt: string; + array?: boolean; /** - * Whether the user can impersonate other users. + * Attribute creation date in ISO 8601 format. */ - impersonator?: boolean; + $createdAt: string; /** - * 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. + * Attribute update date in ISO 8601 format. */ - impersonatorUserId?: string; - } - - /** - * AlgoMD5 - */ - export type AlgoMd5 = { + $updatedAt: string; /** - * Algo type. + * Minimum value to enforce for new documents. */ - type: string; - } - - /** - * AlgoSHA - */ - export type AlgoSha = { + min?: number | bigint; /** - * Algo type. + * Maximum value to enforce for new documents. */ - type: string; - } - - /** - * AlgoPHPass - */ - export type AlgoPhpass = { + max?: number | bigint; /** - * Algo type. + * Default value for attribute when not provided. Cannot be set when attribute is required. */ - type: string; + default?: number; } /** - * AlgoBcrypt + * AttributeBigInt */ - export type AlgoBcrypt = { + export type AttributeBigint = { /** - * Algo type. + * Attribute Key. */ - type: string; - } - - /** - * AlgoScrypt - */ - export type AlgoScrypt = { + key: string; /** - * Algo type. + * Attribute type. */ type: string; /** - * CPU complexity of computed hash. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - costCpu: number; + status: AttributeStatus; /** - * Memory complexity of computed hash. + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - costMemory: number; + error: string; /** - * Parallelization of computed hash. + * Is attribute required? */ - costParallel: number; + required: boolean; /** - * Length used to compute hash. + * Is attribute an array? */ - length: number; - } - - /** - * AlgoScryptModified - */ - export type AlgoScryptModified = { + array?: boolean; /** - * Algo type. + * Attribute creation date in ISO 8601 format. */ - type: string; + $createdAt: string; /** - * Salt used to compute hash. + * Attribute update date in ISO 8601 format. */ - salt: string; + $updatedAt: string; /** - * Separator used to compute hash. + * Minimum value to enforce for new documents. */ - saltSeparator: string; + min?: number | bigint; /** - * Key used to compute hash. + * Maximum value to enforce for new documents. */ - signerKey: string; + max?: number | bigint; + /** + * Default value for attribute when not provided. Cannot be set when attribute is required. + */ + default?: number | bigint; } /** - * AlgoArgon2 + * AttributeFloat */ - export type AlgoArgon2 = { + export type AttributeFloat = { /** - * Algo type. + * Attribute Key. + */ + key: string; + /** + * Attribute type. */ type: string; /** - * Memory used to compute hash. + * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ - memoryCost: number; + status: AttributeStatus; /** - * Amount of time consumed to compute hash + * Error message. Displays error generated on failure of creating or deleting an attribute. */ - timeCost: number; + error: string; /** - * Number of threads used to compute hash. + * Is attribute required? */ - threads: number; - } - - /** - * Preferences - */ - export type Preferences = { - } - - export type DefaultPreferences = Preferences & { - [key: string]: any; - [__default]: true; - }; - - /** - * Session - */ - export type Session = { + required: boolean; /** - * Session ID. + * Is attribute an array? */ - $id: string; + array?: boolean; /** - * Session creation date in ISO 8601 format. + * Attribute creation date in ISO 8601 format. */ $createdAt: string; /** - * Session update date in ISO 8601 format. + * Attribute update date in ISO 8601 format. */ $updatedAt: string; /** - * User ID. + * Minimum value to enforce for new documents. */ - userId: string; + min?: number; /** - * Session expiration date in ISO 8601 format. + * Maximum value to enforce for new documents. */ - expire: string; + max?: number; /** - * Session Provider. + * 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; /** - * Session Provider User ID. + * Is provider enabled? */ - providerUid: string; + enabled: boolean; /** - * Session Provider Access Token. + * Type of provider. */ - providerAccessToken: string; + type: string; /** - * The date of when the access token expires in ISO 8601 format. + * Provider credentials. */ - providerAccessTokenExpiry: string; + credentials: object; /** - * Session Provider Refresh Token. + * Provider options. */ - providerRefreshToken: string; + options?: object; + } + + /** + * Message + */ + export type Message = { /** - * IP in use when the session was created. + * Message ID. */ - ip: string; + $id: string; /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + * Message creation time in ISO 8601 format. */ - osCode: string; + $createdAt: string; /** - * Operating system name. + * Message update date in ISO 8601 format. */ - osName: string; + $updatedAt: string; /** - * Operating system version. + * Message provider type. */ - osVersion: string; + providerType: string; /** - * Client type. + * Topic IDs set as recipients. */ - clientType: string; + topics: string[]; /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + * User IDs set as recipients. */ - clientCode: string; + users: string[]; /** - * Client name. + * Target IDs set as recipients. */ - clientName: string; + targets: string[]; /** - * Client version. + * The scheduled time for message. */ - clientVersion: string; + scheduledAt?: string; /** - * Client engine name. + * The time when the message was delivered. */ - clientEngine: string; + deliveredAt?: string; /** - * Client engine name. + * Delivery errors if any. */ - clientEngineVersion: string; + 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 = { /** - * Device name. + * Target ID. */ - deviceName: string; + $id: string; /** - * Device brand name. + * Target creation time in ISO 8601 format. */ - deviceBrand: string; + $createdAt: string; /** - * Device model name. + * Target update date in ISO 8601 format. */ - deviceModel: string; + $updatedAt: string; /** - * Country two-character ISO 3166-1 alpha code. + * Target Name. */ - countryCode: string; + name: string; /** - * Country name. + * User ID. */ - countryName: string; + userId: string; /** - * Returns true if this the current user session. + * Provider ID. */ - current: boolean; + providerId?: string; /** - * Returns a list of active session factors. + * The target provider type. Can be one of the following: `email`, `sms` or `push`. */ - factors: string[]; + providerType: string; /** - * Secret used to authenticate the user. Only included if the request was made with an API key + * The target identifier. */ - secret: string; + identifier: string; /** - * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. + * Is the target expired. */ - mfaUpdatedAt: string; + expired: boolean; } /** - * Identity + * Insight */ - export type Identity = { + export type Insight = { /** - * Identity ID. + * Insight ID. */ $id: string; /** - * Identity creation date in ISO 8601 format. + * Insight creation date in ISO 8601 format. */ $createdAt: string; /** - * Identity update date in ISO 8601 format. + * Insight update date in ISO 8601 format. */ $updatedAt: string; /** - * User ID. + * Parent report ID. Insights always belong to a report. */ - userId: string; + reportId: string; /** - * Identity Provider. + * 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). */ - provider: string; + type: string; /** - * ID of the User in the Identity Provider. + * Insight severity. One of info, warning, critical. */ - providerUid: string; + severity: string; /** - * Email of the User in the Identity Provider. + * Insight status. One of active, dismissed. */ - providerEmail: string; + status: string; /** - * Identity Provider Access Token. + * Type of the resource the insight is about. Plural noun, e.g. databases, sites, functions. */ - providerAccessToken: string; + resourceType: string; /** - * The date of when the access token expires in ISO 8601 format. + * ID of the resource the insight is about. */ - providerAccessTokenExpiry: string; + resourceId: string; /** - * Identity Provider Refresh Token. + * 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. */ - providerRefreshToken: string; - } - - /** - * Token - */ - export type Token = { + parentResourceType: string; /** - * Token ID. + * ID of the parent resource. Empty when the resource has no parent. */ - $id: string; + parentResourceId: string; /** - * Token creation date in ISO 8601 format. + * Insight title. */ - $createdAt: string; + title: string; /** - * User ID. + * Short markdown summary describing the insight. */ - userId: string; + summary: 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. + * List of call-to-action buttons attached to this insight. */ - secret: string; + ctas: InsightCTA[]; /** - * Token expiration date in ISO 8601 format. + * Time the insight was analyzed in ISO 8601 format. */ - expire: string; + analyzedAt?: 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. + * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. */ - phrase: string; + dismissedAt?: string; + /** + * User ID that dismissed the insight. Empty when not dismissed. + */ + dismissedBy?: string; } /** - * JWT + * InsightCTA */ - export type Jwt = { + export type InsightCTA = { /** - * JWT encoded string. + * Human-readable label for the CTA, used in UI. */ - jwt: string; + 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; } /** - * Locale + * Report */ - export type Locale = { + export type Report = { /** - * User IP address. + * Report ID. */ - ip: string; + $id: string; /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format + * Report creation date in ISO 8601 format. */ - countryCode: string; + $createdAt: string; /** - * Country name. This field support localization. + * Report update date in ISO 8601 format. */ - country: string; + $updatedAt: 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. + * ID of the third-party app that submitted the report. */ - continentCode: string; + appId: string; /** - * Continent name. This field support localization. + * Analyzer that produced this report. e.g. lighthouse, audit, databaseAnalyzer. */ - continent: string; + type: string; /** - * True if country is part of the European Union. + * Short, human-readable title for the report. */ - eu: boolean; + title: string; /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format + * Markdown summary describing the report. */ - currency: string; - } - - /** - * LocaleCode - */ - export type LocaleCode = { + summary: string; /** - * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) + * Plural noun describing what the report analyzes, e.g. databases, sites, urls. */ - code: string; + targetType: string; /** - * Locale name + * Free-form target identifier (URL for lighthouse, resource ID for db). */ - name: string; + 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; } /** - * File + * ActivityEvent */ - export type File = { + export type ActivityEvent = { /** - * File ID. + * Event ID. */ $id: string; /** - * Bucket ID. - */ - bucketId: string; - /** - * File creation date in ISO 8601 format. - */ - $createdAt: string; - /** - * File update date in ISO 8601 format. + * User type. */ - $updatedAt: string; + userType: string; /** - * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). + * User ID. */ - $permissions: string[]; + userId: string; /** - * File name. + * User Email. */ - name: string; + userEmail: string; /** - * File MD5 signature. + * User Name. */ - signature: string; + userName: string; /** - * File mime type. + * Resource parent. */ - mimeType: string; + resourceParent: string; /** - * File original size in bytes. + * Resource type. */ - sizeOriginal: number; + resourceType: string; /** - * File actual stored size in bytes after compression and/or encryption. + * Resource ID. */ - sizeActual: number; + resourceId: string; /** - * Total number of chunks available + * Resource. */ - chunksTotal: number; + resource: string; /** - * Total number of chunks uploaded + * Event name. */ - chunksUploaded: number; + event: string; /** - * Whether file contents are encrypted at rest. + * User agent. */ - encryption: boolean; + userAgent: string; /** - * 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). + * IP address. */ - compression: string; - } - - /** - * Team - */ - export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { + ip: string; /** - * Team ID. + * API mode when event triggered. */ - $id: string; + mode: string; /** - * Team creation date in ISO 8601 format. + * Location. */ - $createdAt: string; + country: string; /** - * Team update date in ISO 8601 format. + * Log creation date in ISO 8601 format. */ - $updatedAt: string; + time: string; /** - * Team name. + * Project ID. */ - name: string; + projectId: string; /** - * Total number of team members. + * Team ID. */ - total: number; + teamId: string; /** - * Team preferences as a key-value object + * Hostname. */ - prefs: Preferences; - } - - /** - * Membership - */ - export type Membership = { + hostname: string; /** - * Membership ID. + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). */ - $id: string; + osCode: string; /** - * Membership creation date in ISO 8601 format. + * Operating system name. */ - $createdAt: string; + osName: string; /** - * Membership update date in ISO 8601 format. + * Operating system version. */ - $updatedAt: string; + osVersion: string; /** - * User ID. + * Client type. */ - userId: string; + clientType: string; /** - * User name. Hide this attribute by toggling membership privacy in the Console. + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). */ - userName: string; + clientCode: string; /** - * User email address. Hide this attribute by toggling membership privacy in the Console. + * Client name. */ - userEmail: string; + clientName: string; /** - * User phone number. Hide this attribute by toggling membership privacy in the Console. + * Client version. */ - userPhone: string; + clientVersion: string; /** - * Team ID. + * Client engine name. */ - teamId: string; + clientEngine: string; /** - * Team name. + * Client engine name. */ - teamName: string; + clientEngineVersion: string; /** - * Date, the user has been invited to join the team in ISO 8601 format. + * Device name. */ - invited: string; + deviceName: string; /** - * Date, the user has accepted the invitation to join the team in ISO 8601 format. + * Device brand name. */ - joined: string; + deviceBrand: string; /** - * User confirmation status, true if the user has joined the team or false otherwise. + * Device model name. */ - confirm: boolean; + deviceModel: string; /** - * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. + * Country two-character ISO 3166-1 alpha code. */ - mfa: boolean; + countryCode: string; /** - * User list of roles + * Country name. */ - roles: string[]; + countryName: string; } /** - * Execution + * Archive */ - export type Execution = { + export type BackupArchive = { /** - * Execution ID. + * Archive ID. */ $id: string; /** - * Execution creation date in ISO 8601 format. + * Archive creation time in ISO 8601 format. */ $createdAt: string; /** - * Execution update date in ISO 8601 format. + * Archive update date in ISO 8601 format. */ $updatedAt: string; /** - * Execution roles. + * Archive policy ID. */ - $permissions: string[]; + policyId: string; /** - * Function ID. + * Archive size in bytes. */ - functionId: string; + size: number; /** - * Function's deployment ID used to create the execution. + * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. */ - deploymentId: string; + status: string; /** - * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. + * The backup start time. */ - trigger: ExecutionTrigger; + startedAt: string; /** - * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. + * Migration ID. */ - status: ExecutionStatus; + migrationId: string; /** - * HTTP request method type. + * The services that are backed up by this archive. */ - requestMethod: string; + services: string[]; /** - * HTTP request path and query. + * The resources that are backed up by this archive. */ - requestPath: string; + resources: 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. + * The resource ID to backup. Set only if this archive should backup a single resource. */ - requestHeaders: Headers[]; + resourceId?: string; /** - * HTTP response status code. + * The resource type to backup. Set only if this archive should backup a single resource. */ - responseStatusCode: number; + resourceType?: string; + } + + /** + * BillingLimits + */ + export type BillingLimits = { /** - * HTTP response body. This will return empty unless execution is created as synchronous. + * Bandwidth limit */ - responseBody: string; + bandwidth: number; /** - * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. + * Storage limit */ - responseHeaders: Headers[]; + storage: number; /** - * 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. + * Users limit */ - logs: string; + users: number; /** - * 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. + * Executions limit */ - errors: string; + executions: number; /** - * Resource(function/site) execution duration in seconds. + * GBHours limit */ - duration: number; + GBHours: number; /** - * The scheduled time for execution. If left empty, execution will be queued immediately. + * Image transformations limit */ - scheduledAt?: string; - } - - /** - * Country - */ - export type Country = { + imageTransformations: number; /** - * Country name. + * Auth phone limit */ - name: string; + authPhone: number; /** - * Country two-character ISO 3166-1 alpha code. + * Budget limit percentage */ - code: string; + budgetLimit: number; } /** - * Continent + * Block */ - export type Continent = { + export type Block = { /** - * Continent name. + * Block creation date in ISO 8601 format. */ - name: string; + $createdAt: string; /** - * Continent two letter code. + * Resource type that is blocked */ - code: string; - } - - /** - * Language - */ - export type Language = { + resourceType: string; /** - * Language name. + * Resource identifier that is blocked */ - name: string; + resourceId: string; /** - * Language two-character ISO 639-1 codes. + * Reason for the block. Can be null if no reason was provided. */ - code: string; + reason?: string; /** - * Language native name. + * Block expiration date in ISO 8601 format. Can be null if the block does not expire. */ - nativeName: string; + 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; } /** - * Currency + * backup */ - export type Currency = { + export type BackupPolicy = { /** - * Currency symbol. + * Backup policy ID. */ - symbol: string; + $id: string; /** - * Currency name. + * Backup policy name. */ name: string; /** - * Currency native symbol. - */ - symbolNative: string; - /** - * Number of decimal digits. + * Policy creation date in ISO 8601 format. */ - decimalDigits: number; + $createdAt: string; /** - * Currency digit rounding. + * Policy update date in ISO 8601 format. */ - rounding: number; + $updatedAt: string; /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. + * The services that are backed up by this policy. */ - code: string; + services: string[]; /** - * Currency plural name + * The resources that are backed up by this policy. */ - namePlural: string; - } - - /** - * Phone - */ - export type Phone = { + resources: string[]; /** - * Phone code. + * The resource ID to backup. Set only if this policy should backup a single resource. */ - code: string; + resourceId?: string; /** - * Country two-character ISO 3166-1 alpha code. + * The resource type to backup. Set only if this policy should backup a single resource. */ - countryCode: string; + resourceType?: string; /** - * Country name. + * How many days to keep the backup before it will be automatically deleted. */ - countryName: string; - } - - /** - * Headers - */ - export type Headers = { + retention: number; /** - * Header name. + * Policy backup schedule in CRON format. */ - name: string; + schedule: string; /** - * Header value. + * Is this policy enabled. */ - value: string; + enabled: boolean; } /** - * MFA Challenge + * Restoration */ - export type MfaChallenge = { + export type BackupRestoration = { /** - * Token ID. + * Restoration ID. */ $id: string; /** - * Token creation date in ISO 8601 format. + * Restoration creation time in ISO 8601 format. */ $createdAt: string; /** - * User ID. + * Restoration update date in ISO 8601 format. */ - userId: string; + $updatedAt: string; /** - * Token expiration date in ISO 8601 format. + * Backup archive ID. */ - expire: string; - } - - /** - * MFA Recovery Codes - */ - export type MfaRecoveryCodes = { + archiveId: string; /** - * Recovery codes. + * Backup policy ID. */ - recoveryCodes: string[]; - } - - /** - * MFAType - */ - export type MfaType = { + policyId: string; /** - * Secret token used for TOTP factor. + * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. */ - secret: string; + status: string; /** - * URI for authenticator apps. + * The backup start time. */ - uri: string; - } - - /** - * MFAFactors - */ - export type MfaFactors = { + startedAt: string; /** - * Can TOTP be used for MFA challenge for this account. + * Migration ID. */ - totp: boolean; + migrationId: string; /** - * Can phone (SMS) be used for MFA challenge for this account. + * The services that are backed up by this policy. */ - phone: boolean; + services: string[]; /** - * Can email be used for MFA challenge for this account. + * The resources that are backed up by this policy. */ - email: boolean; + resources: string[]; /** - * Can recovery code be used for MFA challenge for this account. + * Optional data in key-value object. */ - recoveryCode: boolean; + options: string; } /** - * Transaction + * usageEvent */ - export type Transaction = { + export type UsageEvent = { /** - * Transaction ID. + * The metric key. */ - $id: string; + metric: string; /** - * Transaction creation time in ISO 8601 format. + * The metric value. */ - $createdAt: string; + value: number; /** - * Transaction update date in ISO 8601 format. + * The event timestamp. */ - $updatedAt: string; + time: string; /** - * Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. + * The API endpoint path. */ - status: string; + path: string; /** - * Number of operations in the transaction. + * The HTTP method. */ - operations: number; + method: string; /** - * Expiration time in ISO 8601 format. + * HTTP status code. Stored as string to preserve unset state (empty string = not available). */ - expiresAt: string; - } - - /** - * Subscriber - */ - export type Subscriber = { + status: string; /** - * Subscriber ID. + * The resource type. */ - $id: string; + resourceType: string; /** - * Subscriber creation time in ISO 8601 format. + * The resource ID. */ - $createdAt: string; + resourceId: string; /** - * Subscriber update date in ISO 8601 format. + * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. */ - $updatedAt: string; + countryCode: string; /** - * Target ID. + * The user agent string. */ - targetId: string; + userAgent: string; + } + + /** + * Usage events list + */ + export type UsageEventList = { /** - * Target. + * Total number of events that matched your query. */ - target: Target; + total: number; /** - * Topic ID. + * List of events. */ - userId: string; + events: UsageEvent[]; + } + + /** + * usageGauge + */ + export type UsageGauge = { /** - * User Name. + * The metric key. */ - userName: string; + metric: string; /** - * Topic ID. + * The current snapshot value. */ - topicId: string; + value: number; /** - * The target provider type. Can be one of the following: `email`, `sms` or `push`. + * The snapshot timestamp. */ - providerType: string; + time: string; } /** - * Target + * Usage gauges list */ - export type Target = { + export type UsageGaugeList = { /** - * Target ID. + * Total number of gauges that matched your query. */ - $id: string; + total: number; /** - * Target creation time in ISO 8601 format. + * List of gauges. */ - $createdAt: string; + gauges: UsageGauge[]; + } + + /** + * Activity event list + */ + export type ActivityEventList = { /** - * Target update date in ISO 8601 format. + * Total number of events that matched your query. */ - $updatedAt: string; + total: number; /** - * Target Name. + * List of events. */ - name: string; + events: ActivityEvent[]; + } + + /** + * Backup archive list + */ + export type BackupArchiveList = { /** - * User ID. + * Total number of archives that matched your query. */ - userId: string; + total: number; /** - * Provider ID. + * List of archives. */ - providerId?: string; + archives: BackupArchive[]; + } + + /** + * Backup policy list + */ + export type BackupPolicyList = { /** - * The target provider type. Can be one of the following: `email`, `sms` or `push`. + * Total number of policies that matched your query. */ - providerType: string; + total: number; /** - * The target identifier. + * List of policies. */ - identifier: string; + policies: BackupPolicy[]; + } + + /** + * Backup restoration list + */ + export type BackupRestorationList = { /** - * Is the target expired. + * Total number of restorations that matched your query. */ - expired: boolean; + total: number; + /** + * List of restorations. + */ + restorations: BackupRestoration[]; } } diff --git a/src/services/account.ts b/src/services/account.ts index 5a3f7926..2ef0d393 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1,15 +1,25 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } 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; +type AccountServerOnlyMethod = never; +type AccountClientOnlyMethod = never; - constructor(client: Client) { +export type Account<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<AccountRuntime<TAuth>, 'client' | AccountServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<AccountRuntime<TAuth>, 'client' | AccountClientOnlyMethod> + : Omit<AccountRuntime<TAuth>, 'client'>; + +class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -519,58 +529,6 @@ export class Account { ); } - /** - * 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. * @@ -635,69 +593,6 @@ export class Account { ); } - /** - * 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. * @@ -751,58 +646,6 @@ export class Account { ); } - /** - * 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. * @@ -859,61 +702,6 @@ export class Account { ); } - /** - * 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. * @@ -981,72 +769,6 @@ export class Account { ); } - /** - * 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. * @@ -1071,29 +793,6 @@ export class Account { ); } - /** - * 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. * @@ -1118,29 +817,6 @@ export class Account { ); } - /** - * 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. * @@ -1166,30 +842,6 @@ export class Account { ); } - /** - * 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. * @@ -1215,30 +867,6 @@ export class Account { ); } - /** - * 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. * @@ -1930,7 +1558,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -2682,7 +2310,7 @@ export class Account { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -2827,68 +2455,6 @@ export class Account { ); } - /** - * 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. * @@ -2955,73 +2521,6 @@ export class Account { ); } - /** - * 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. * @@ -3112,3 +2611,9 @@ export class Account { ); } } + +const Account = AccountRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Account<TAuth>; +}; + +export { Account }; diff --git a/src/services/activities.ts b/src/services/activities.ts new file mode 100644 index 00000000..fa15e6dc --- /dev/null +++ b/src/services/activities.ts @@ -0,0 +1,123 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + + +export type Activities = Omit<ActivitiesRuntime, 'client'>; + +class ActivitiesRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Activities = ActivitiesRuntime as unknown as { + new (client: Client<ServerAuth>): Activities; +}; + +export { Activities }; diff --git a/src/services/advisor.ts b/src/services/advisor.ts new file mode 100644 index 00000000..ffba49d1 --- /dev/null +++ b/src/services/advisor.ts @@ -0,0 +1,316 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + + +export type Advisor = Omit<AdvisorRuntime, 'client'>; + +class AdvisorRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Advisor = AdvisorRuntime as unknown as { + new (client: Client<ServerAuth>): Advisor; +}; + +export { Advisor }; diff --git a/src/services/avatars.ts b/src/services/avatars.ts index eea5a0f8..5e91655e 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -1,5 +1,5 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; import { Browser } from '../enums/browser'; @@ -10,10 +10,20 @@ import { Timezone } from '../enums/timezone'; import { BrowserPermission } from '../enums/browser-permission'; import { ImageFormat } from '../enums/image-format'; -export class Avatars { - client: Client; +type AvatarsServerOnlyMethod = never; +type AvatarsClientOnlyMethod = never; - constructor(client: Client) { +export type Avatars<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsClientOnlyMethod> + : Omit<AvatarsRuntime<TAuth>, 'client'>; + +class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -86,7 +96,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -166,7 +176,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -225,7 +235,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -305,7 +315,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -383,7 +393,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -467,7 +477,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -546,7 +556,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -743,7 +753,7 @@ export class Avatars { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -752,3 +762,9 @@ export class Avatars { return uri.toString(); } } + +const Avatars = AvatarsRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Avatars<TAuth>; +}; + +export { Avatars }; diff --git a/src/services/backups.ts b/src/services/backups.ts new file mode 100644 index 00000000..29005f77 --- /dev/null +++ b/src/services/backups.ts @@ -0,0 +1,761 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + +import { BackupServices } from '../enums/backup-services'; + +export type Backups = Omit<BackupsRuntime, 'client'>; + +class BackupsRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Backups = BackupsRuntime as unknown as { + new (client: Client<ServerAuth>): Backups; +}; + +export { Backups }; diff --git a/src/services/databases.ts b/src/services/databases.ts index 51a58d81..e4c5ef0d 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1,15 +1,171 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } 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; +type DatabasesServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listCollections' | 'createCollection' | 'getCollection' | 'updateCollection' | 'deleteCollection' | 'listAttributes' | 'createBigIntAttribute' | 'updateBigIntAttribute' | 'createBooleanAttribute' | 'updateBooleanAttribute' | 'createDatetimeAttribute' | 'updateDatetimeAttribute' | 'createEmailAttribute' | 'updateEmailAttribute' | 'createEnumAttribute' | 'updateEnumAttribute' | 'createFloatAttribute' | 'updateFloatAttribute' | 'createIntegerAttribute' | 'updateIntegerAttribute' | 'createIpAttribute' | 'updateIpAttribute' | 'createLineAttribute' | 'updateLineAttribute' | 'createLongtextAttribute' | 'updateLongtextAttribute' | 'createMediumtextAttribute' | 'updateMediumtextAttribute' | 'createPointAttribute' | 'updatePointAttribute' | 'createPolygonAttribute' | 'updatePolygonAttribute' | 'createRelationshipAttribute' | 'updateRelationshipAttribute' | 'createStringAttribute' | 'updateStringAttribute' | 'createTextAttribute' | 'updateTextAttribute' | 'createUrlAttribute' | 'updateUrlAttribute' | 'createVarcharAttribute' | 'updateVarcharAttribute' | 'getAttribute' | 'deleteAttribute' | 'upsertDocuments' | 'updateDocuments' | 'deleteDocuments' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex'; +type DatabasesClientOnlyMethod = never; - constructor(client: Client) { +export type Databases<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesClientOnlyMethod> + : Omit<DatabasesRuntime<TAuth>, 'client'>; + +class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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. * @@ -344,80 +500,239 @@ export class Databases { } /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata. * * @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. + * @throws {AppwriteException} + * @returns {Promise<Models.Database>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead. + */ + get(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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. - * @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. + * @returns {Promise<Models.CollectionList>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` 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>>; + listCollections(this: Databases<ServerAuth>, params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; /** - * Get a list of all the user's documents in a given collection. You can use the query params to filter your results. + * 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} 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 {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. - * @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>>} + * @returns {Promise<Models.CollectionList>} * @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 }; + listCollections(this: Databases<ServerAuth>, 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, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; + params = (paramsOrFirst || {}) as { databaseId: string, queries?: string[], search?: string, total?: boolean }; } 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 + queries: rest[0] as string[], + search: rest[1] as string, + total: rest[2] as boolean }; } const databaseId = params.databaseId; - const collectionId = params.collectionId; const queries = params.queries; - const transactionId = params.transactionId; + const search = params.search; 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 apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + if (typeof search !== 'undefined') { + payload['search'] = search; } 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 } = { @@ -432,57 +747,4540 @@ export class Databases { } /** - * 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. + * 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 - 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.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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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 {object[]} params.documents - Array of documents data as JSON objects. + * @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[], documents?: object[], 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 {object[]} documents - Array of documents data as JSON objects. + * @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[], documents?: object[], 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[], documents?: object[], 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[])?, (object[])?, (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[], documents?: object[], 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[], documents?: object[], 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[], + documents: rest[4] as object[], + transactionId: rest[5] as string + }; + } + + const databaseId = params.databaseId; + const collectionId = params.collectionId; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; + 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"'); + } + + 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 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>(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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<Document>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.deleteRows` 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>; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, queries?: string[], transactionId?: string }): Promise<Models.DocumentList<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. + * 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). 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} 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<Document>} + * @returns {Promise<Models.DocumentList<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 }; + deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, 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, 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 }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: 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 + queries: rest[1] as string[], + transactionId: rest[2] as string }; } const databaseId = params.databaseId; const collectionId = params.collectionId; - const documentId = params.documentId; - const data = params.data; - const permissions = params.permissions; + const queries = params.queries; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -491,23 +5289,11 @@ export class Databases { 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 queries !== 'undefined') { + payload['queries'] = queries; } if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; @@ -519,7 +5305,7 @@ export class Databases { } return this.client.call( - 'post', + 'delete', uri, apiHeaders, payload @@ -1051,4 +5837,326 @@ export class Databases { 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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 + ); + } } + +const Databases = DatabasesRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Databases<TAuth>; +}; + +export { Databases }; diff --git a/src/services/functions.ts b/src/services/functions.ts index fc3f50ce..00e2e474 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1,41 +1,1686 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +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; +type FunctionsServerOnlyMethod = 'list' | 'create' | 'listRuntimes' | 'listSpecifications' | 'get' | 'update' | 'delete' | 'updateFunctionDeployment' | 'listDeployments' | 'createDeployment' | 'createDuplicateDeployment' | 'createTemplateDeployment' | 'createVcsDeployment' | 'getDeployment' | 'deleteDeployment' | 'getDeploymentDownload' | 'updateDeploymentStatus' | 'deleteExecution' | 'listVariables' | 'createVariable' | 'getVariable' | 'updateVariable' | 'deleteVariable'; +type FunctionsClientOnlyMethod = never; - constructor(client: Client) { +export type Functions<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsClientOnlyMethod> + : Omit<FunctionsRuntime<TAuth>, 'client'>; + +class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } /** - * Get a list of all the current user function execution logs. You can use the query params to filter your results. + * 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, ): 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(this: Functions<ServerAuth>, ): 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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} 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(this: Functions<ServerAuth>, params: { functionId: string, code: File, 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} 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(this: Functions<ServerAuth>, functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; + createDeployment( + paramsOrFirst: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] + ): Promise<Models.Deployment> { + let params: { functionId: string, code: File, 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, activate: boolean, entrypoint?: string, commands?: string }; + onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); + } else { + params = { + functionId: paramsOrFirst as string, + code: rest[0] as File, + 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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 {string} + */ + getDeploymentDownload(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): string; + /** + * 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 {string} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeploymentDownload(this: Functions<ServerAuth>, functionId: string, deploymentId: string, type?: DeploymentDownloadType): string; + getDeploymentDownload( + paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, + ...rest: [(string)?, (DeploymentDownloadType)?] + ): string { + 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 } = { + } + + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + + return uri.toString(); + } + + /** + * 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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.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. + * @param {string} params.executionId - Execution ID. * @throws {AppwriteException} - * @returns {Promise<Models.ExecutionList>} + * @returns {Promise<{}>} */ - listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; + deleteExecution(this: Functions<ServerAuth>, params: { functionId: string, executionId: string }): Promise<{}>; /** - * Get a list of all the current user function execution logs. You can use the query params to filter your results. + * Delete a function execution by its unique ID. * * @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 {string} executionId - Execution ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteExecution(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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.ExecutionList>} + * @returns {Promise<Models.VariableList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; - listExecutions( + listVariables(this: Functions<ServerAuth>, functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; + listVariables( paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] - ): Promise<Models.ExecutionList> { + ): Promise<Models.VariableList> { let params: { functionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -56,7 +1701,7 @@ export class Functions { throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -78,85 +1723,80 @@ export class Functions { } /** - * 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. + * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * - * @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. + * @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.Execution>} + * @returns {Promise<Models.Variable>} */ - createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; + createVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string, key: string, value: string, secret?: boolean }): Promise<Models.Variable>; /** - * 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. + * Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. * - * @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. + * @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.Execution>} + * @returns {Promise<Models.Variable>} * @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 }; + createVariable(this: Functions<ServerAuth>, 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, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + params = (paramsOrFirst || {}) as { functionId: string, variableId: string, key: string, value: string, secret?: boolean }; } 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 + 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 body = params.body; - const async = params.async; - const xpath = params.xpath; - const method = params.method; - const headers = params.headers; - const scheduledAt = params.scheduledAt; + 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"'); } - - const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); - const payload: Payload = {}; - if (typeof body !== 'undefined') { - payload['body'] = body; + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); } - if (typeof async !== 'undefined') { - payload['async'] = async; + if (typeof key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); } - if (typeof xpath !== 'undefined') { - payload['path'] = xpath; + if (typeof value === 'undefined') { + throw new AppwriteException('Missing required parameter: "value"'); } - if (typeof method !== 'undefined') { - payload['method'] = method; + + const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const payload: Payload = {}; + if (typeof variableId !== 'undefined') { + payload['variableId'] = variableId; } - if (typeof headers !== 'undefined') { - payload['headers'] = headers; + if (typeof key !== 'undefined') { + payload['key'] = key; } - if (typeof scheduledAt !== 'undefined') { - payload['scheduledAt'] = scheduledAt; + if (typeof value !== 'undefined') { + payload['value'] = value; + } + if (typeof secret !== 'undefined') { + payload['secret'] = secret; } const uri = new URL(this.client.config.endpoint + apiPath); @@ -173,50 +1813,50 @@ export class Functions { } /** - * Get a function execution log by its unique ID. + * Get a variable by its unique ID. * - * @param {string} params.functionId - Function ID. - * @param {string} params.executionId - Execution ID. + * @param {string} params.functionId - Function unique ID. + * @param {string} params.variableId - Variable unique ID. * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} + * @returns {Promise<Models.Variable>} */ - getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; + getVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string }): Promise<Models.Variable>; /** - * Get a function execution log by its unique ID. + * Get a variable by its unique ID. * - * @param {string} functionId - Function ID. - * @param {string} executionId - Execution ID. + * @param {string} functionId - Function unique ID. + * @param {string} variableId - Variable unique ID. * @throws {AppwriteException} - * @returns {Promise<Models.Execution>} + * @returns {Promise<Models.Variable>} * @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, + getVariable(this: Functions<ServerAuth>, functionId: string, variableId: string): Promise<Models.Variable>; + getVariable( + paramsOrFirst: { functionId: string, variableId: string } | string, ...rest: [(string)?] - ): Promise<Models.Execution> { - let params: { functionId: string, executionId: string }; + ): Promise<Models.Variable> { + let params: { functionId: string, variableId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; + params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; } else { params = { functionId: paramsOrFirst as string, - executionId: rest[0] as string + variableId: rest[0] as string }; } const functionId = params.functionId; - const executionId = params.executionId; + const variableId = params.variableId; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - if (typeof executionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "executionId"'); + if (typeof variableId === 'undefined') { + throw new AppwriteException('Missing required parameter: "variableId"'); } - const apiPath = '/functions/{functionId}/executions/{executionId}'.replace('{functionId}', functionId).replace('{executionId}', executionId); + const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); const payload: Payload = {}; const uri = new URL(this.client.config.endpoint + apiPath); @@ -230,4 +1870,151 @@ export class Functions { 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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 + ); + } } + +const Functions = FunctionsRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Functions<TAuth>; +}; + +export { Functions }; diff --git a/src/services/graphql.ts b/src/services/graphql.ts index e995f66e..5068c21d 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -1,12 +1,21 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Graphql { - client: Client; +type GraphqlServerOnlyMethod = never; +type GraphqlClientOnlyMethod = never; - constructor(client: Client) { +export type Graphql<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlClientOnlyMethod> + : Omit<GraphqlRuntime<TAuth>, 'client'>; + +class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -122,3 +131,9 @@ export class Graphql { ); } } + +const Graphql = GraphqlRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Graphql<TAuth>; +}; + +export { Graphql }; diff --git a/src/services/health.ts b/src/services/health.ts new file mode 100644 index 00000000..32578a39 --- /dev/null +++ b/src/services/health.ts @@ -0,0 +1,1050 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + +import { Name } from '../enums/name'; + +export type Health = Omit<HealthRuntime, 'client'>; + +class HealthRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Health = HealthRuntime as unknown as { + new (client: Client<ServerAuth>): Health; +}; + +export { Health }; diff --git a/src/services/locale.ts b/src/services/locale.ts index fe85eeb5..c9a0b95f 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -1,12 +1,21 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Locale { - client: Client; +type LocaleServerOnlyMethod = never; +type LocaleClientOnlyMethod = never; - constructor(client: Client) { +export type Locale<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleClientOnlyMethod> + : Omit<LocaleRuntime<TAuth>, 'client'>; + +class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -196,3 +205,9 @@ export class Locale { ); } } + +const Locale = LocaleRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Locale<TAuth>; +}; + +export { Locale }; diff --git a/src/services/messaging.ts b/src/services/messaging.ts index d6c45bcd..117be78a 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -1,15 +1,4153 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; +import { MessagePriority } from '../enums/message-priority'; +import { SmtpEncryption } from '../enums/smtp-encryption'; -export class Messaging { - client: Client; +type MessagingServerOnlyMethod = 'listMessages' | 'createEmail' | 'updateEmail' | 'createPush' | 'updatePush' | 'createSms' | 'updateSms' | 'getMessage' | 'delete' | 'listMessageLogs' | 'listTargets' | 'listProviders' | 'createApnsProvider' | 'updateApnsProvider' | 'createFcmProvider' | 'updateFcmProvider' | 'createMailgunProvider' | 'updateMailgunProvider' | 'createMsg91Provider' | 'updateMsg91Provider' | 'createResendProvider' | 'updateResendProvider' | 'createSendgridProvider' | 'updateSendgridProvider' | 'createSmtpProvider' | 'updateSmtpProvider' | 'createTelesignProvider' | 'updateTelesignProvider' | 'createTextmagicProvider' | 'updateTextmagicProvider' | 'createTwilioProvider' | 'updateTwilioProvider' | 'createVonageProvider' | 'updateVonageProvider' | 'getProvider' | 'deleteProvider' | 'listProviderLogs' | 'listSubscriberLogs' | 'listTopics' | 'createTopic' | 'getTopic' | 'updateTopic' | 'deleteTopic' | 'listTopicLogs' | 'listSubscribers' | 'getSubscriber'; +type MessagingClientOnlyMethod = never; - constructor(client: Client) { +export type Messaging<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingClientOnlyMethod> + : Omit<MessagingRuntime<TAuth>, 'client'>; + +class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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. * @@ -83,6 +4221,67 @@ export class Messaging { ); } + /** + * 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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. * @@ -143,3 +4342,9 @@ export class Messaging { ); } } + +const Messaging = MessagingRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Messaging<TAuth>; +}; + +export { Messaging }; diff --git a/src/services/presences.ts b/src/services/presences.ts index f9df9e18..fe696fc1 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -1,12 +1,21 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Presences { - client: Client; +type PresencesServerOnlyMethod = never; +type PresencesClientOnlyMethod = 'upsert' | 'update'; - constructor(client: Client) { +export type Presences<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<PresencesRuntime<TAuth>, 'client' | PresencesServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<PresencesRuntime<TAuth>, 'client' | PresencesClientOnlyMethod> + : Omit<PresencesRuntime<TAuth>, 'client'>; + +class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -137,19 +146,21 @@ export class Presences { * * @param {string} params.presenceId - Presence unique ID. * @param {string} params.status - Presence status. + * @param {string} params.userId - User ID. * @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, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Presence>; + upsert<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, params: { presenceId: string, status: string, userId?: 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} status - Presence status. + * @param {string} userId - User ID. * @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. @@ -157,27 +168,29 @@ export class Presences { * @returns {Promise<Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; + upsert<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, presenceId: string, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; upsert<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, - ...rest: [(string)?, (string[])?, (string)?, (object)?] + paramsOrFirst: { presenceId: string, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + ...rest: [(string)?, (string)?, (string[])?, (string)?, (object)?] ): Promise<Presence> { - let params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + let params: { presenceId: string, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + params = (paramsOrFirst || {}) as { presenceId: string, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object }; } else { params = { presenceId: paramsOrFirst as string, status: rest[0] as string, - permissions: rest[1] as string[], - expiresAt: rest[2] as string, - metadata: rest[3] as object + userId: rest[1] as string, + permissions: rest[2] as string[], + expiresAt: rest[3] as string, + metadata: rest[4] as object }; } const presenceId = params.presenceId; const status = params.status; + const userId = params.userId; const permissions = params.permissions; const expiresAt = params.expiresAt; const metadata = params.metadata; @@ -191,6 +204,9 @@ export class Presences { const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } if (typeof status !== 'undefined') { payload['status'] = status; } @@ -222,6 +238,7 @@ export class Presences { * * * @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. @@ -230,12 +247,13 @@ export class Presences { * @throws {AppwriteException} * @returns {Promise<Presence>} */ - update<Presence extends Models.Presence = Models.DefaultPresence>(params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Presence>; + update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, 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. @@ -245,27 +263,29 @@ export class Presences { * @returns {Promise<Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - update<Presence extends Models.Presence = Models.DefaultPresence>(presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; + update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; update<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, - ...rest: [(string)?, (string)?, (object)?, (string[])?, (boolean)?] + 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, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + 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, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + params = (paramsOrFirst || {}) as { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; } else { params = { presenceId: paramsOrFirst as string, - status: rest[0] as string, - expiresAt: rest[1] as string, - metadata: rest[2] as object, - permissions: rest[3] as string[], - purge: rest[4] as boolean + 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; @@ -278,6 +298,9 @@ export class Presences { const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); const payload: Payload = {}; + if (typeof userId !== 'undefined') { + payload['userId'] = userId; + } if (typeof status !== 'undefined') { payload['status'] = status; } @@ -361,3 +384,9 @@ export class Presences { ); } } + +const Presences = PresencesRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Presences<TAuth>; +}; + +export { Presences }; diff --git a/src/services/project.ts b/src/services/project.ts new file mode 100644 index 00000000..3f8bdd0e --- /dev/null +++ b/src/services/project.ts @@ -0,0 +1,6466 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } 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 type Project = Omit<ProjectRuntime, 'client'>; + +class ProjectRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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: GOCSPX-2k8gsR0000000000000000VNahJj + * @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: GOCSPX-2k8gsR0000000000000000VNahJj + * @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: WPL_AP1.2Bf0000000000000./HtlYw== + * @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: WPL_AP1.2Bf0000000000000./HtlYw== + * @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 + ); + } +} + +const Project = ProjectRuntime as unknown as { + new (client: Client<ServerAuth>): Project; +}; + +export { Project }; diff --git a/src/services/proxy.ts b/src/services/proxy.ts new file mode 100644 index 00000000..6e8e0919 --- /dev/null +++ b/src/services/proxy.ts @@ -0,0 +1,548 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + +import { StatusCode } from '../enums/status-code'; +import { ProxyResourceType } from '../enums/proxy-resource-type'; + +export type Proxy = Omit<ProxyRuntime, 'client'>; + +class ProxyRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Proxy = ProxyRuntime as unknown as { + new (client: Client<ServerAuth>): Proxy; +}; + +export { Proxy }; diff --git a/src/services/realtime.ts b/src/services/realtime.ts index 7aebdaa6..a5eb07ef 100644 --- a/src/services/realtime.ts +++ b/src/services/realtime.ts @@ -1,4 +1,4 @@ -import { AppwriteException, Client, JSONbig } from '../client'; +import { AppwriteException, Client, JSONbig, type ClientAuth } from '../client'; import { Channel, ActionableChannel, ResolvedChannel } from '../channel'; import { Query } from '../query'; import { ID } from '../id'; @@ -96,7 +96,7 @@ export class Realtime { private readonly DEBOUNCE_MS = 1; private readonly HEARTBEAT_INTERVAL = 20000; // 20 seconds in milliseconds - private client: Client; + private client: Client<ClientAuth>; private socket?: WebSocket; private activeSubscriptions = new Map<string, RealtimeCallback<any>>(); private pendingSubscribes = new Map<string, RealtimeRequestSubscribeRow>(); @@ -117,7 +117,7 @@ export class Realtime { private onCloseCallbacks: Array<() => void> = []; private onOpenCallbacks: Array<() => void> = []; - constructor(client: Client) { + constructor(client: Client<ClientAuth>) { this.client = client; } @@ -153,16 +153,26 @@ export class Realtime { private startHeartbeat(): void { this.stopHeartbeat(); - this.heartbeatTimer = window?.setInterval(() => { - if (this.socket && this.socket.readyState === WebSocket.OPEN) { - this.socket.send(JSONbig.stringify({ type: 'ping' })); - } - }, this.HEARTBEAT_INTERVAL); + this.heartbeatTimer = typeof window !== 'undefined' + ? window.setInterval(() => { + if (this.socket && this.socket.readyState === WebSocket.OPEN) { + this.socket.send(JSONbig.stringify({ type: 'ping' })); + } + }, this.HEARTBEAT_INTERVAL) + : setInterval(() => { + if (this.socket && this.socket.readyState === WebSocket.OPEN) { + this.socket.send(JSONbig.stringify({ type: 'ping' })); + } + }, this.HEARTBEAT_INTERVAL) as unknown as number; } private stopHeartbeat(): void { if (this.heartbeatTimer) { - window?.clearInterval(this.heartbeatTimer); + if (typeof window !== 'undefined') { + window.clearInterval(this.heartbeatTimer); + } else { + clearInterval(this.heartbeatTimer as any); + } this.heartbeatTimer = undefined; } } @@ -707,8 +717,10 @@ export class Realtime { let session = this.client.config.session; if (!session) { try { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.client.config.project}`]; + if (typeof window !== 'undefined' && window.localStorage) { + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.client.config.project}`]; + } } catch (error) { console.error('Failed to parse cookie fallback:', error); } diff --git a/src/services/sites.ts b/src/services/sites.ts new file mode 100644 index 00000000..1c2869e3 --- /dev/null +++ b/src/services/sites.ts @@ -0,0 +1,1924 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type ServerAuth, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + +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 type Sites = Omit<SitesRuntime, 'client'>; + +class SitesRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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} 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, 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} 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, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; + createDeployment( + paramsOrFirst: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(File)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] + ): Promise<Models.Deployment> { + let params: { siteId: string, code: File, 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, 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, + 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 {string} + */ + getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): string; + /** + * 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 {string} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): string; + getDeploymentDownload( + paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType } | string, + ...rest: [(string)?, (DeploymentDownloadType)?] + ): string { + 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 } = { + } + + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + + for (const [key, value] of Object.entries(Service.flatten(payload))) { + uri.searchParams.append(key, value); + } + + return uri.toString(); + } + + /** + * 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 + ); + } +} + +const Sites = SitesRuntime as unknown as { + new (client: Client<ServerAuth>): Sites; +}; + +export { Sites }; diff --git a/src/services/storage.ts b/src/services/storage.ts index 814b14b7..fe671549 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -1,17 +1,452 @@ import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; +import { Compression } from '../enums/compression'; import { ImageGravity } from '../enums/image-gravity'; import { ImageFormat } from '../enums/image-format'; -export class Storage { - client: Client; +type StorageServerOnlyMethod = 'listBuckets' | 'createBucket' | 'getBucket' | 'updateBucket' | 'deleteBucket'; +type StorageClientOnlyMethod = never; - constructor(client: Client) { +export type Storage<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<StorageRuntime<TAuth>, 'client' | StorageServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<StorageRuntime<TAuth>, 'client' | StorageClientOnlyMethod> + : Omit<StorageRuntime<TAuth>, 'client'>; + +class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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. * @@ -434,7 +869,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -578,7 +1013,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -645,7 +1080,7 @@ export class Storage { const apiHeaders: { [header: string]: string } = { } - payload['project'] = this.client.config.project; + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -654,3 +1089,9 @@ export class Storage { return uri.toString(); } } + +const Storage = StorageRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Storage<TAuth>; +}; + +export { Storage }; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index fa671f14..2aa9c974 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -1,15 +1,169 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } 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; +type TablesDBServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listTables' | 'createTable' | 'getTable' | 'updateTable' | 'deleteTable' | 'listColumns' | 'createBigIntColumn' | 'updateBigIntColumn' | 'createBooleanColumn' | 'updateBooleanColumn' | 'createDatetimeColumn' | 'updateDatetimeColumn' | 'createEmailColumn' | 'updateEmailColumn' | 'createEnumColumn' | 'updateEnumColumn' | 'createFloatColumn' | 'updateFloatColumn' | 'createIntegerColumn' | 'updateIntegerColumn' | 'createIpColumn' | 'updateIpColumn' | 'createLineColumn' | 'updateLineColumn' | 'createLongtextColumn' | 'updateLongtextColumn' | 'createMediumtextColumn' | 'updateMediumtextColumn' | 'createPointColumn' | 'updatePointColumn' | 'createPolygonColumn' | 'updatePolygonColumn' | 'createRelationshipColumn' | 'createStringColumn' | 'updateStringColumn' | 'createTextColumn' | 'updateTextColumn' | 'createUrlColumn' | 'updateUrlColumn' | 'createVarcharColumn' | 'updateVarcharColumn' | 'getColumn' | 'deleteColumn' | 'updateRelationshipColumn' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex' | 'upsertRows' | 'updateRows' | 'deleteRows'; +type TablesDBClientOnlyMethod = never; - constructor(client: Client) { +export type TablesDB<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBClientOnlyMethod> + : Omit<TablesDBRuntime<TAuth>, 'client'>; + +class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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. * @@ -260,23 +414,4681 @@ export class TablesDB { transactionId: paramsOrFirst as string }; } - - const transactionId = params.transactionId; - - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "transactionId"'); + + 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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/transactions/{transactionId}'.replace('{transactionId}', transactionId); + 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', + 'get', uri, apiHeaders, payload @@ -284,51 +5096,58 @@ export class TablesDB { } /** - * Create multiple operations in a single transaction. + * Delete an index. * - * @param {string} params.transactionId - Transaction ID. - * @param {object[]} params.operations - Array of staged operations. + * @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<Models.Transaction>} + * @returns {Promise<{}>} */ - createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; + deleteIndex(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, key: string }): Promise<{}>; /** - * Create multiple operations in a single transaction. + * Delete an index. * - * @param {string} transactionId - Transaction ID. - * @param {object[]} operations - Array of staged operations. + * @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<Models.Transaction>} + * @returns {Promise<{}>} * @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[] }; + deleteIndex(this: TablesDB<ServerAuth>, 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 { transactionId: string, operations?: object[] }; + params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, key: string }; } else { params = { - transactionId: paramsOrFirst as string, - operations: rest[0] as object[] + databaseId: paramsOrFirst as string, + tableId: rest[0] as string, + key: rest[1] as string }; } - const transactionId = params.transactionId; - const operations = params.operations; + const databaseId = params.databaseId; + const tableId = params.tableId; + const key = params.key; - if (typeof transactionId === 'undefined') { - throw new AppwriteException('Missing required parameter: "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 key === 'undefined') { + throw new AppwriteException('Missing required parameter: "key"'); } - const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); + const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{key}', key); const payload: Payload = {}; - if (typeof operations !== 'undefined') { - payload['operations'] = operations; - } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -336,7 +5155,7 @@ export class TablesDB { } return this.client.call( - 'post', + 'delete', uri, apiHeaders, payload @@ -438,11 +5257,12 @@ export class TablesDB { * @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 {object[]} params.rows - Array of rows data as JSON objects. * @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>; + 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[], rows?: object[], 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. * @@ -451,20 +5271,21 @@ export class TablesDB { * @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 {object[]} rows - Array of rows data as JSON objects. * @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>(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[], rows?: object[], 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)?] + 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[], rows?: object[], 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[])?, (object[])?, (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 }; + 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[], rows?: object[], 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 }; + 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[], rows?: object[], transactionId?: string }; } else { params = { databaseId: paramsOrFirst as string, @@ -472,7 +5293,8 @@ export class TablesDB { 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 + rows: rest[4] as object[], + transactionId: rest[5] as string }; } @@ -481,6 +5303,7 @@ export class TablesDB { const rowId = params.rowId; const data = params.data; const permissions = params.permissions; + const rows = params.rows; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -489,12 +5312,6 @@ export class TablesDB { 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 = {}; @@ -507,6 +5324,9 @@ export class TablesDB { if (typeof permissions !== 'undefined') { payload['permissions'] = permissions; } + if (typeof rows !== 'undefined') { + payload['rows'] = rows; + } if (typeof transactionId !== 'undefined') { payload['transactionId'] = transactionId; } @@ -524,6 +5344,240 @@ export class TablesDB { ); } + /** + * 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>(this: TablesDB<ServerAuth>, 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>(this: TablesDB<ServerAuth>, 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>(this: TablesDB<ServerAuth>, 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>(this: TablesDB<ServerAuth>, 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>(this: TablesDB<ServerAuth>, 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>(this: TablesDB<ServerAuth>, 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. * @@ -1044,3 +6098,9 @@ export class TablesDB { ); } } + +const TablesDB = TablesDBRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): TablesDB<TAuth>; +}; + +export { TablesDB }; diff --git a/src/services/teams.ts b/src/services/teams.ts index 870f8a5b..cdcf75ca 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -1,12 +1,21 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; import type { Models } from '../models'; -export class Teams { - client: Client; +type TeamsServerOnlyMethod = never; +type TeamsClientOnlyMethod = never; - constructor(client: Client) { +export type Teams<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = + TAuth extends ClientAuth + ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsServerOnlyMethod> + : TAuth extends ServerAuth + ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsClientOnlyMethod> + : Omit<TeamsRuntime<TAuth>, 'client'>; + +class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { + client: Client<TAuth>; + + constructor(client: Client<TAuth>) { this.client = client; } @@ -891,3 +900,9 @@ export class Teams { ); } } + +const Teams = TeamsRuntime as unknown as { + new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Teams<TAuth>; +}; + +export { Teams }; diff --git a/src/services/tokens.ts b/src/services/tokens.ts new file mode 100644 index 00000000..eb904d5c --- /dev/null +++ b/src/services/tokens.ts @@ -0,0 +1,322 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + + +export type Tokens = Omit<TokensRuntime, 'client'>; + +class TokensRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Tokens = TokensRuntime as unknown as { + new (client: Client<ServerAuth>): Tokens; +}; + +export { Tokens }; diff --git a/src/services/usage.ts b/src/services/usage.ts new file mode 100644 index 00000000..faadcdb5 --- /dev/null +++ b/src/services/usage.ts @@ -0,0 +1,137 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + + +export type Usage = Omit<UsageRuntime, 'client'>; + +class UsageRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Usage = UsageRuntime as unknown as { + new (client: Client<ServerAuth>): Usage; +}; + +export { Usage }; diff --git a/src/services/users.ts b/src/services/users.ts new file mode 100644 index 00000000..dc82ee16 --- /dev/null +++ b/src/services/users.ts @@ -0,0 +1,2948 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } 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 type Users = Omit<UsersRuntime, 'client'>; + +class UsersRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } + + /** + * 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 + ); + } + + /** + * 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 + ); + } + + /** + * 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 + ); + } + + /** + * 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 + ); + } + + /** + * 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 + ); + } + + /** + * 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 + ); + } +} + +const Users = UsersRuntime as unknown as { + new (client: Client<ServerAuth>): Users; +}; + +export { Users }; diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts new file mode 100644 index 00000000..4347018b --- /dev/null +++ b/src/services/webhooks.ts @@ -0,0 +1,473 @@ +import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; +import type { Models } from '../models'; + + +export type Webhooks = Omit<WebhooksRuntime, 'client'>; + +class WebhooksRuntime { + client: Client<ServerAuth>; + + constructor(client: Client<ServerAuth>) { + 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 + ); + } +} + +const Webhooks = WebhooksRuntime as unknown as { + new (client: Client<ServerAuth>): Webhooks; +}; + +export { Webhooks }; From be1797af99b203c56976a31f6b973afba079179e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Tue, 19 May 2026 14:53:06 +0530 Subject: [PATCH 02/12] chore: update Web SDK to 26.0.0 --- .../account/create-mfa-authenticator.md | 2 +- docs/examples/account/create-mfa-challenge.md | 2 +- .../account/create-mfa-recovery-codes.md | 2 +- docs/examples/account/create-verification.md | 15 + .../account/delete-mfa-authenticator.md | 2 +- .../account/get-mfa-recovery-codes.md | 2 +- docs/examples/account/list-mfa-factors.md | 2 +- .../account/update-mfa-authenticator.md | 2 +- docs/examples/account/update-mfa-challenge.md | 2 +- .../account/update-mfa-recovery-codes.md | 2 +- docs/examples/account/update-verification.md | 16 + docs/examples/databases/create-document.md | 5 +- docs/examples/databases/create-documents.md | 18 + .../messaging/create-apns-provider.md | 2 +- .../examples/messaging/create-fcm-provider.md | 2 +- docs/examples/messaging/create-sms.md | 2 +- .../messaging/create-smtp-provider.md | 2 +- .../messaging/update-apns-provider.md | 2 +- .../examples/messaging/update-fcm-provider.md | 2 +- docs/examples/messaging/update-sms.md | 2 +- .../messaging/update-smtp-provider.md | 2 +- docs/examples/presences/update-presence.md | 21 + docs/examples/presences/update.md | 1 - docs/examples/presences/upsert.md | 2 +- docs/examples/tablesdb/create-row.md | 5 +- docs/examples/tablesdb/create-rows.md | 18 + .../users/create-mfa-recovery-codes.md | 2 +- .../users/delete-mfa-authenticator.md | 2 +- docs/examples/users/get-mfa-recovery-codes.md | 2 +- docs/examples/users/list-mfa-factors.md | 2 +- .../users/update-mfa-recovery-codes.md | 2 +- docs/examples/users/update-mfa.md | 2 +- src/services/account.ts | 511 ++++++++ src/services/databases.ts | 99 +- src/services/messaging.ts | 1149 ++++++++++++++--- src/services/presences.ts | 214 ++- src/services/tables-db.ts | 98 +- src/services/users.ts | 329 +++++ 38 files changed, 2333 insertions(+), 214 deletions(-) create mode 100644 docs/examples/account/create-verification.md create mode 100644 docs/examples/account/update-verification.md create mode 100644 docs/examples/databases/create-documents.md create mode 100644 docs/examples/presences/update-presence.md create mode 100644 docs/examples/tablesdb/create-rows.md diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index df016baf..cf6a6098 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.createMfaAuthenticator({ +const result = await account.createMFAAuthenticator({ type: AuthenticatorType.Totp }); diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index 03c03be3..d9d9856d 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.createMfaChallenge({ +const result = await account.createMFAChallenge({ factor: AuthenticationFactor.Email }); diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 42aa7ac0..3c292f26 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.createMfaRecoveryCodes(); +const result = await account.createMFARecoveryCodes(); console.log(result); ``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md new file mode 100644 index 00000000..0795d0ac --- /dev/null +++ b/docs/examples/account/create-verification.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const result = await account.createVerification({ + url: 'https://example.com' +}); + +console.log(result); +``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 626b4172..079f0b95 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.deleteMfaAuthenticator({ +const result = await account.deleteMFAAuthenticator({ type: AuthenticatorType.Totp }); diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index a2bca114..1d102583 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.getMfaRecoveryCodes(); +const result = await account.getMFARecoveryCodes(); console.log(result); ``` diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 63148467..9950129b 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.listMfaFactors(); +const result = await account.listMFAFactors(); console.log(result); ``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index 7aa949c7..bf25c76b 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.updateMfaAuthenticator({ +const result = await account.updateMFAAuthenticator({ type: AuthenticatorType.Totp, otp: '<OTP>' }); diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index 34e5b267..a16ea43a 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.updateMfaChallenge({ +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 index 3d22c889..8bc8273c 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const account = new Account(client); -const result = await account.updateMfaRecoveryCodes(); +const result = await account.updateMFARecoveryCodes(); console.log(result); ``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md new file mode 100644 index 00000000..3b52a83c --- /dev/null +++ b/docs/examples/account/update-verification.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const result = await account.updateVerification({ + userId: '<USER_ID>', + secret: '<SECRET>' +}); + +console.log(result); +``` diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index eff84945..4d8d7f90 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -10,16 +10,15 @@ const databases = new Databases(client); const result = await databases.createDocument({ databaseId: '<DATABASE_ID>', collectionId: '<COLLECTION_ID>', - documentId: '<DOCUMENT_ID>', // optional + documentId: '<DOCUMENT_ID>', data: { "username": "walter.obrien", "email": "walter.obrien@example.com", "fullName": "Walter O'Brien", "age": 30, "isAdmin": false - }, // optional + }, permissions: [Permission.read(Role.any())], // optional - documents: [], // 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..cd94cc96 --- /dev/null +++ b/docs/examples/databases/create-documents.md @@ -0,0 +1,18 @@ +```javascript +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const databases = new Databases(client); + +const result = await databases.createDocuments({ + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documents: [], + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index 5859a952..eeb8f955 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.createApnsProvider({ +const result = await messaging.createAPNSProvider({ providerId: '<PROVIDER_ID>', name: '<NAME>', authKey: '<AUTH_KEY>', // optional diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index aba9af52..1b3a13a2 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.createFcmProvider({ +const result = await messaging.createFCMProvider({ providerId: '<PROVIDER_ID>', name: '<NAME>', serviceAccountJSON: {}, // optional diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index 152b0542..b5093eb4 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.createSms({ +const result = await messaging.createSMS({ messageId: '<MESSAGE_ID>', content: '<CONTENT>', topics: [], // optional diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index 5ce889c4..f94b8cd6 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.createSmtpProvider({ +const result = await messaging.createSMTPProvider({ providerId: '<PROVIDER_ID>', name: '<NAME>', host: '<HOST>', diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 33d44077..72a38c0f 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.updateApnsProvider({ +const result = await messaging.updateAPNSProvider({ providerId: '<PROVIDER_ID>', name: '<NAME>', // optional enabled: false, // optional diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index 860952e3..c941807c 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.updateFcmProvider({ +const result = await messaging.updateFCMProvider({ providerId: '<PROVIDER_ID>', name: '<NAME>', // optional enabled: false, // optional diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 40df7c77..07624dea 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.updateSms({ +const result = await messaging.updateSMS({ messageId: '<MESSAGE_ID>', topics: [], // optional users: [], // optional diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index aaeae762..f1f1531d 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -7,7 +7,7 @@ const client = new Client() const messaging = new Messaging(client); -const result = await messaging.updateSmtpProvider({ +const result = await messaging.updateSMTPProvider({ providerId: '<PROVIDER_ID>', name: '<NAME>', // optional host: '<HOST>', // optional diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md new file mode 100644 index 00000000..06dcfdbd --- /dev/null +++ b/docs/examples/presences/update-presence.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Presences, Permission, Role } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const presences = new 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: [Permission.read(Role.any())], // optional + purge: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/presences/update.md b/docs/examples/presences/update.md index 01cc3fc7..79e5aa91 100644 --- a/docs/examples/presences/update.md +++ b/docs/examples/presences/update.md @@ -9,7 +9,6 @@ const presences = new Presences(client); const result = await presences.update({ presenceId: '<PRESENCE_ID>', - userId: '<USER_ID>', // optional status: '<STATUS>', // optional expiresAt: '2020-10-15T06:38:00.000+00:00', // optional metadata: {}, // optional diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md index 3d13e32e..7c32bf10 100644 --- a/docs/examples/presences/upsert.md +++ b/docs/examples/presences/upsert.md @@ -9,8 +9,8 @@ const presences = new Presences(client); const result = await presences.upsert({ presenceId: '<PRESENCE_ID>', + userId: '<USER_ID>', status: '<STATUS>', - userId: '<USER_ID>', // optional permissions: [Permission.read(Role.any())], // optional expiresAt: '2020-10-15T06:38:00.000+00:00', // optional metadata: {} // optional diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 3ca869aa..105c4445 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -10,16 +10,15 @@ const tablesDB = new TablesDB(client); const result = await tablesDB.createRow({ databaseId: '<DATABASE_ID>', tableId: '<TABLE_ID>', - rowId: '<ROW_ID>', // optional + rowId: '<ROW_ID>', data: { "username": "walter.obrien", "email": "walter.obrien@example.com", "fullName": "Walter O'Brien", "age": 30, "isAdmin": false - }, // optional + }, permissions: [Permission.read(Role.any())], // optional - rows: [], // 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..fa838105 --- /dev/null +++ b/docs/examples/tablesdb/create-rows.md @@ -0,0 +1,18 @@ +```javascript +import { Client, TablesDB } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const tablesDB = new TablesDB(client); + +const result = await tablesDB.createRows({ + databaseId: '<DATABASE_ID>', + tableId: '<TABLE_ID>', + rows: [], + transactionId: '<TRANSACTION_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index a9cc4bd4..af94a61c 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const users = new Users(client); -const result = await users.createMfaRecoveryCodes({ +const result = await users.createMFARecoveryCodes({ userId: '<USER_ID>' }); diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index 81d5b18b..5cbc46e5 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -7,7 +7,7 @@ const client = new Client() const users = new Users(client); -const result = await users.deleteMfaAuthenticator({ +const result = await users.deleteMFAAuthenticator({ userId: '<USER_ID>', type: AuthenticatorType.Totp }); diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index c9c19e22..cdc0905b 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const users = new Users(client); -const result = await users.getMfaRecoveryCodes({ +const result = await users.getMFARecoveryCodes({ userId: '<USER_ID>' }); diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index b15be0c8..2e2e23ab 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -7,7 +7,7 @@ const client = new Client() const users = new Users(client); -const result = await users.listMfaFactors({ +const result = await users.listMFAFactors({ userId: '<USER_ID>' }); diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index c79714d6..480b73ab 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -7,7 +7,7 @@ const client = new Client() const users = new Users(client); -const result = await users.updateMfaRecoveryCodes({ +const result = await users.updateMFARecoveryCodes({ userId: '<USER_ID>' }); diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 9a4c579c..8bdcab01 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -7,7 +7,7 @@ const client = new Client() const users = new Users(client); -const result = await users.updateMfa({ +const result = await users.updateMFA({ userId: '<USER_ID>', mfa: false }); diff --git a/src/services/account.ts b/src/services/account.ts index 2ef0d393..0a9985fa 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -529,6 +529,58 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -593,6 +645,69 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -646,6 +761,58 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -702,6 +869,61 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -769,6 +991,72 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -793,6 +1081,29 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -817,6 +1128,29 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -842,6 +1176,30 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -867,6 +1225,30 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -2455,6 +2837,68 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * @@ -2521,6 +2965,73 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } + /** + * 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. * diff --git a/src/services/databases.ts b/src/services/databases.ts index e4c5ef0d..334f3204 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -4987,13 +4987,12 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @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 {object[]} params.documents - Array of documents data as JSON objects. * @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[], documents?: object[], transactionId?: string }): Promise<Document>; + 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. * @@ -5002,21 +5001,20 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @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 {object[]} documents - Array of documents data as JSON objects. * @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[], documents?: object[], transactionId?: string): Promise<Document>; + 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[], documents?: object[], 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[])?, (object[])?, (string)?] + 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[], documents?: object[], transactionId?: string }; + 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[], documents?: object[], transactionId?: string }; + 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, @@ -5024,8 +5022,7 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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[], - documents: rest[4] as object[], - transactionId: rest[5] as string + transactionId: rest[4] as string }; } @@ -5034,7 +5031,6 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const documentId = params.documentId; const data = params.data; const permissions = params.permissions; - const documents = params.documents; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -5043,6 +5039,12 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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 = {}; @@ -5055,6 +5057,81 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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; } diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 117be78a..35acc289 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -4,7 +4,7 @@ import type { Models } from '../models'; import { MessagePriority } from '../enums/message-priority'; import { SmtpEncryption } from '../enums/smtp-encryption'; -type MessagingServerOnlyMethod = 'listMessages' | 'createEmail' | 'updateEmail' | 'createPush' | 'updatePush' | 'createSms' | 'updateSms' | 'getMessage' | 'delete' | 'listMessageLogs' | 'listTargets' | 'listProviders' | 'createApnsProvider' | 'updateApnsProvider' | 'createFcmProvider' | 'updateFcmProvider' | 'createMailgunProvider' | 'updateMailgunProvider' | 'createMsg91Provider' | 'updateMsg91Provider' | 'createResendProvider' | 'updateResendProvider' | 'createSendgridProvider' | 'updateSendgridProvider' | 'createSmtpProvider' | 'updateSmtpProvider' | 'createTelesignProvider' | 'updateTelesignProvider' | 'createTextmagicProvider' | 'updateTextmagicProvider' | 'createTwilioProvider' | 'updateTwilioProvider' | 'createVonageProvider' | 'updateVonageProvider' | 'getProvider' | 'deleteProvider' | 'listProviderLogs' | 'listSubscriberLogs' | 'listTopics' | 'createTopic' | 'getTopic' | 'updateTopic' | 'deleteTopic' | 'listTopicLogs' | 'listSubscribers' | 'getSubscriber'; +type MessagingServerOnlyMethod = 'listMessages' | 'createEmail' | 'updateEmail' | 'createPush' | 'updatePush' | 'createSms' | 'createSMS' | 'updateSms' | 'updateSMS' | 'getMessage' | 'delete' | 'listMessageLogs' | 'listTargets' | 'listProviders' | 'createApnsProvider' | 'createAPNSProvider' | 'updateApnsProvider' | 'updateAPNSProvider' | 'createFcmProvider' | 'createFCMProvider' | 'updateFcmProvider' | 'updateFCMProvider' | 'createMailgunProvider' | 'updateMailgunProvider' | 'createMsg91Provider' | 'updateMsg91Provider' | 'createResendProvider' | 'updateResendProvider' | 'createSendgridProvider' | 'updateSendgridProvider' | 'createSmtpProvider' | 'createSMTPProvider' | 'updateSmtpProvider' | 'updateSMTPProvider' | 'createTelesignProvider' | 'updateTelesignProvider' | 'createTextmagicProvider' | 'updateTextmagicProvider' | 'createTwilioProvider' | 'updateTwilioProvider' | 'createVonageProvider' | 'updateVonageProvider' | 'getProvider' | 'deleteProvider' | 'listProviderLogs' | 'listSubscriberLogs' | 'listTopics' | 'createTopic' | 'getTopic' | 'updateTopic' | 'deleteTopic' | 'listTopicLogs' | 'listSubscribers' | 'getSubscriber'; type MessagingClientOnlyMethod = never; export type Messaging<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = @@ -823,6 +823,107 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } + /** + * 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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. * @@ -921,6 +1022,103 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } + /** + * 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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. * @@ -1334,79 +1532,81 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Update a Apple Push Notification service provider by its unique ID. + * Create a new Apple Push Notification service provider. * - * @param {string} params.providerId - Provider ID. + * @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 {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. + * @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.updateAPNSProvider` instead. */ - updateApnsProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }): Promise<Models.Provider>; + createAPNSProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean, enabled?: boolean }): Promise<Models.Provider>; /** - * Update a Apple Push Notification service provider by its unique ID. + * Create a new Apple Push Notification service provider. * - * @param {string} providerId - Provider ID. + * @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 {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. + * @param {boolean} enabled - Set as enabled. * @throws {AppwriteException} * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateApnsProvider(this: Messaging<ServerAuth>, 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)?] + createAPNSProvider(this: Messaging<ServerAuth>, 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, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + 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, enabled?: boolean, authKey?: string, authKeyId?: string, teamId?: string, bundleId?: string, sandbox?: boolean }; + 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, - 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 + 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 enabled = params.enabled; 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/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/apns'; const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } if (typeof name !== 'undefined') { payload['name'] = name; } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } if (typeof authKey !== 'undefined') { payload['authKey'] = authKey; } @@ -1422,6 +1622,9 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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 } = { @@ -1429,7 +1632,7 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } return this.client.call( - 'patch', + 'post', uri, apiHeaders, payload @@ -1437,72 +1640,432 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Create a new Firebase Cloud Messaging provider. + * Update a Apple Push Notification service provider by its unique ID. * - * @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.providerId - Provider ID. * @param {string} params.name - Provider name. - * @param {object} params.serviceAccountJSON - FCM service account JSON. + * @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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, params: { providerId: string, name: string, serviceAccountJSON?: object, enabled?: boolean }): Promise<Models.Provider>; + createFcmProvider(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; /** - * Create a new Firebase Cloud Messaging provider. + * Update a Firebase Cloud Messaging provider by its unique ID. * - * @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} providerId - Provider ID. * @param {string} name - Provider name. - * @param {object} serviceAccountJSON - FCM service account JSON. * @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. */ - createFcmProvider(this: Messaging<ServerAuth>, 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)?] + updateFcmProvider(this: Messaging<ServerAuth>, 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, serviceAccountJSON?: object, enabled?: boolean }; + 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, serviceAccountJSON?: object, enabled?: boolean }; + params = (paramsOrFirst || {}) as { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }; } else { params = { providerId: paramsOrFirst as string, name: rest[0] as string, - serviceAccountJSON: rest[1] as object, - enabled: rest[2] as boolean + enabled: rest[1] as boolean, + serviceAccountJSON: rest[2] as object }; } const providerId = params.providerId; const name = params.name; - const serviceAccountJSON = params.serviceAccountJSON; const enabled = params.enabled; + const serviceAccountJSON = params.serviceAccountJSON; 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 apiPath = '/messaging/providers/fcm/{providerId}'.replace('{providerId}', providerId); 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; } + if (typeof serviceAccountJSON !== 'undefined') { + payload['serviceAccountJSON'] = serviceAccountJSON; + } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { @@ -1510,7 +2073,7 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload @@ -1526,9 +2089,8 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @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(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; + updateFCMProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object }): Promise<Models.Provider>; /** * Update a Firebase Cloud Messaging provider by its unique ID. * @@ -1540,8 +2102,8 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateFcmProvider(this: Messaging<ServerAuth>, providerId: string, name?: string, enabled?: boolean, serviceAccountJSON?: object): Promise<Models.Provider>; - updateFcmProvider( + updateFCMProvider(this: Messaging<ServerAuth>, 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> { @@ -2227,7 +2789,223 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * * @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.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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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. @@ -2235,14 +3013,21 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @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. */ - createSendgridProvider(this: Messaging<ServerAuth>, params: { providerId: string, name: string, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }): Promise<Models.Provider>; + createSmtpProvider(this: Messaging<ServerAuth>, 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 Sendgrid 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} apiKey - Sendgrid API key. + * @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. @@ -2252,31 +3037,43 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - createSendgridProvider(this: Messaging<ServerAuth>, 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)?] + createSmtpProvider(this: Messaging<ServerAuth>, 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, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + 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, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string, enabled?: boolean }; + 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, - 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 + 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 apiKey = params.apiKey; + 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; @@ -2289,8 +3086,11 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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/sendgrid'; + const apiPath = '/messaging/providers/smtp'; const payload: Payload = {}; if (typeof providerId !== 'undefined') { payload['providerId'] = providerId; @@ -2298,8 +3098,26 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv if (typeof name !== 'undefined') { payload['name'] = name; } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + 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; @@ -2331,80 +3149,128 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Update a Sendgrid provider by its unique ID. + * Create a new SMTP provider. * - * @param {string} params.providerId - Provider ID. + * @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 {boolean} params.enabled - Set as enabled. - * @param {string} params.apiKey - Sendgrid API key. + * @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 {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>} */ - updateSendgridProvider(this: Messaging<ServerAuth>, params: { providerId: string, name?: string, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }): Promise<Models.Provider>; + createSMTPProvider(this: Messaging<ServerAuth>, 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 Sendgrid provider by its unique ID. + * Create a new SMTP provider. * - * @param {string} providerId - Provider ID. + * @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 {boolean} enabled - Set as enabled. - * @param {string} apiKey - Sendgrid API key. + * @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 {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. */ - updateSendgridProvider(this: Messaging<ServerAuth>, 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)?] + createSMTPProvider(this: Messaging<ServerAuth>, 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, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + 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, enabled?: boolean, apiKey?: string, fromName?: string, fromEmail?: string, replyToName?: string, replyToEmail?: string }; + 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, - 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 + 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 enabled = params.enabled; - const apiKey = params.apiKey; + 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/sendgrid/{providerId}'.replace('{providerId}', providerId); + const apiPath = '/messaging/providers/smtp'; const payload: Payload = {}; + if (typeof providerId !== 'undefined') { + payload['providerId'] = providerId; + } if (typeof name !== 'undefined') { payload['name'] = name; } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; + if (typeof host !== 'undefined') { + payload['host'] = host; } - if (typeof apiKey !== 'undefined') { - payload['apiKey'] = apiKey; + 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; @@ -2418,6 +3284,9 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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 } = { @@ -2425,7 +3294,7 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } return this.client.call( - 'patch', + 'post', uri, apiHeaders, payload @@ -2433,57 +3302,57 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Create a new SMTP provider. + * Update a SMTP provider by its unique ID. * - * @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.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 - The default SMTP server port. + * @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 omitted, 'ssl', or 'tls' + * @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 {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. + * @deprecated This API has been deprecated since 1.8.0. Please use `Messaging.updateSMTPProvider` instead. */ - createSmtpProvider(this: Messaging<ServerAuth>, 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>; + updateSmtpProvider(this: Messaging<ServerAuth>, 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. + * Update a SMTP provider by its unique ID. * - * @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} 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 - The default SMTP server port. + * @param {number} port - SMTP port. * @param {string} username - Authentication username. * @param {string} password - Authentication password. - * @param {SmtpEncryption} encryption - Encryption type. Can be omitted, 'ssl', or 'tls' + * @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 {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(this: Messaging<ServerAuth>, 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, + updateSmtpProvider(this: Messaging<ServerAuth>, 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 }; + 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 }; + 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, @@ -2521,18 +3390,9 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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 apiPath = '/messaging/providers/smtp/{providerId}'.replace('{providerId}', providerId); const payload: Payload = {}; - if (typeof providerId !== 'undefined') { - payload['providerId'] = providerId; - } if (typeof name !== 'undefined') { payload['name'] = name; } @@ -2579,7 +3439,7 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload @@ -2605,9 +3465,8 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @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(this: Messaging<ServerAuth>, 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>; + updateSMTPProvider(this: Messaging<ServerAuth>, 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. * @@ -2629,8 +3488,8 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @returns {Promise<Models.Provider>} * @deprecated Use the object parameter style method for a better developer experience. */ - updateSmtpProvider(this: Messaging<ServerAuth>, 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( + updateSMTPProvider(this: Messaging<ServerAuth>, 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> { diff --git a/src/services/presences.ts b/src/services/presences.ts index fe696fc1..6ea7b001 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -3,7 +3,7 @@ import type { Models } from '../models'; type PresencesServerOnlyMethod = never; -type PresencesClientOnlyMethod = 'upsert' | 'update'; +type PresencesClientOnlyMethod = 'upsert' | 'update' | 'updatePresence'; export type Presences<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = TAuth extends ClientAuth @@ -146,21 +146,107 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * * @param {string} params.presenceId - Presence unique ID. * @param {string} params.status - Presence status. - * @param {string} params.userId - User ID. * @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>(this: Presences<ClientAuth>, params: { presenceId: string, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Presence>; + upsert<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, params: { presenceId: 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} 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>(this: Presences<ClientAuth>, presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; + upsert<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + ...rest: [(string)?, (string[])?, (string)?, (object)?] + ): Promise<Presence> { + let params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; + } else { + params = { + presenceId: paramsOrFirst as string, + status: rest[0] as string, + permissions: rest[1] as string[], + expiresAt: rest[2] as string, + metadata: rest[3] as object + }; + } + + const presenceId = params.presenceId; + 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 status === 'undefined') { + throw new AppwriteException('Missing required parameter: "status"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + 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 + ); + } + + /** + * 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>(this: Presences<ClientAuth>, 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. @@ -168,20 +254,20 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @returns {Promise<Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, presenceId: string, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; + upsert<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; upsert<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + 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, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object }; + 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, status: string, userId?: string, permissions?: string[], expiresAt?: string, metadata?: object }; + params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; } else { params = { presenceId: paramsOrFirst as string, - status: rest[0] as string, - userId: rest[1] 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 @@ -189,8 +275,8 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } const presenceId = params.presenceId; - const status = params.status; const userId = params.userId; + const status = params.status; const permissions = params.permissions; const expiresAt = params.expiresAt; const metadata = params.metadata; @@ -198,6 +284,9 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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"'); } @@ -233,6 +322,96 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } + /** + * 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.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>} + */ + update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, params: { presenceId: 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} 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. + */ + update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; + update<Presence extends Models.Presence = Models.DefaultPresence>( + paramsOrFirst: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, + ...rest: [(string)?, (string)?, (object)?, (string[])?, (boolean)?] + ): Promise<Presence> { + let params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; + } else { + params = { + presenceId: paramsOrFirst as string, + status: rest[0] as string, + expiresAt: rest[1] as string, + metadata: rest[2] as object, + permissions: rest[3] as string[], + purge: rest[4] as boolean + }; + } + + const presenceId = params.presenceId; + 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"'); + } + + const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); + const payload: Payload = {}; + 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 + ); + } + /** * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. * @@ -247,7 +426,7 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @throws {AppwriteException} * @returns {Promise<Presence>} */ - update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, params: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Presence>; + updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, 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. * @@ -263,15 +442,15 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @returns {Promise<Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; - update<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, userId?: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, + updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, 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 }; + 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 }; + params = (paramsOrFirst || {}) as { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; } else { params = { presenceId: paramsOrFirst as string, @@ -295,6 +474,9 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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 = {}; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 2aa9c974..3e351951 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -5257,12 +5257,11 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve * @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 {object[]} params.rows - Array of rows data as JSON objects. * @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[], rows?: object[], transactionId?: string }): 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. * @@ -5271,21 +5270,20 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve * @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 {object[]} rows - Array of rows data as JSON objects. * @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[], rows?: object[], transactionId?: string): Promise<Row>; + 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[], rows?: object[], 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[])?, (object[])?, (string)?] + 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[], rows?: object[], transactionId?: string }; + 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[], rows?: object[], transactionId?: string }; + 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, @@ -5293,8 +5291,7 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve 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[], - rows: rest[4] as object[], - transactionId: rest[5] as string + transactionId: rest[4] as string }; } @@ -5303,7 +5300,6 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const rowId = params.rowId; const data = params.data; const permissions = params.permissions; - const rows = params.rows; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -5312,6 +5308,12 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve 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 = {}; @@ -5324,6 +5326,80 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve 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; } diff --git a/src/services/users.ts b/src/services/users.ts index dc82ee16..46e89596 100644 --- a/src/services/users.ts +++ b/src/services/users.ts @@ -1518,6 +1518,69 @@ class UsersRuntime { ); } + /** + * 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. * @@ -1579,6 +1642,66 @@ class UsersRuntime { ); } + /** + * 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. * @@ -1631,6 +1754,57 @@ class UsersRuntime { ); } + /** + * 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. * @@ -1683,6 +1857,57 @@ class UsersRuntime { ); } + /** + * 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. * @@ -1736,6 +1961,58 @@ class UsersRuntime { ); } + /** + * 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. * @@ -1789,6 +2066,58 @@ class UsersRuntime { ); } + /** + * 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. * From 1b0dddd593dc2b0bc86c79825176a83188930db8 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Wed, 20 May 2026 14:20:49 +0530 Subject: [PATCH 03/12] chore: update Web SDK to 26.0.0 --- CHANGELOG.md | 1 - .../account/create-anonymous-session.md | 10 +- .../account/create-email-password-session.md | 9 +- docs/examples/account/create-email-token.md | 9 +- .../account/create-email-verification.md | 9 +- docs/examples/account/create-jwt.md | 9 +- .../account/create-magic-url-token.md | 9 +- .../account/create-mfa-authenticator.md | 9 +- docs/examples/account/create-mfa-challenge.md | 9 +- .../account/create-mfa-recovery-codes.md | 10 +- .../account/create-o-auth-2-session.md | 10 +- .../examples/account/create-o-auth-2-token.md | 10 +- docs/examples/account/create-phone-token.md | 9 +- .../account/create-phone-verification.md | 10 +- docs/examples/account/create-push-target.md | 9 +- docs/examples/account/create-recovery.md | 9 +- docs/examples/account/create-session.md | 9 +- docs/examples/account/create-verification.md | 9 +- docs/examples/account/create.md | 9 +- docs/examples/account/delete-identity.md | 9 +- .../account/delete-mfa-authenticator.md | 9 +- docs/examples/account/delete-push-target.md | 9 +- docs/examples/account/delete-session.md | 9 +- docs/examples/account/delete-sessions.md | 10 +- .../account/get-mfa-recovery-codes.md | 10 +- docs/examples/account/get-prefs.md | 10 +- docs/examples/account/get-session.md | 9 +- docs/examples/account/get.md | 10 +- docs/examples/account/list-identities.md | 9 +- docs/examples/account/list-logs.md | 9 +- docs/examples/account/list-mfa-factors.md | 10 +- docs/examples/account/list-sessions.md | 10 +- .../account/update-email-verification.md | 9 +- docs/examples/account/update-email.md | 9 +- .../account/update-magic-url-session.md | 9 +- .../account/update-mfa-authenticator.md | 9 +- docs/examples/account/update-mfa-challenge.md | 9 +- .../account/update-mfa-recovery-codes.md | 10 +- docs/examples/account/update-mfa.md | 9 +- docs/examples/account/update-name.md | 9 +- docs/examples/account/update-password.md | 9 +- docs/examples/account/update-phone-session.md | 9 +- .../account/update-phone-verification.md | 9 +- docs/examples/account/update-phone.md | 9 +- docs/examples/account/update-prefs.md | 9 +- docs/examples/account/update-push-target.md | 9 +- docs/examples/account/update-recovery.md | 9 +- docs/examples/account/update-session.md | 9 +- docs/examples/account/update-status.md | 10 +- docs/examples/account/update-verification.md | 9 +- docs/examples/activities/get-event.md | 10 +- docs/examples/activities/list-events.md | 10 +- docs/examples/advisor/delete-report.md | 10 +- docs/examples/advisor/get-insight.md | 10 +- docs/examples/advisor/get-report.md | 10 +- docs/examples/advisor/list-insights.md | 10 +- docs/examples/advisor/list-reports.md | 10 +- docs/examples/avatars/get-browser.md | 9 +- docs/examples/avatars/get-credit-card.md | 9 +- docs/examples/avatars/get-favicon.md | 9 +- docs/examples/avatars/get-flag.md | 9 +- docs/examples/avatars/get-image.md | 9 +- docs/examples/avatars/get-initials.md | 9 +- docs/examples/avatars/get-qr.md | 9 +- docs/examples/avatars/get-screenshot.md | 9 +- docs/examples/backups/create-archive.md | 10 +- docs/examples/backups/create-policy.md | 10 +- docs/examples/backups/create-restoration.md | 10 +- docs/examples/backups/delete-archive.md | 10 +- docs/examples/backups/delete-policy.md | 10 +- docs/examples/backups/get-archive.md | 10 +- docs/examples/backups/get-policy.md | 10 +- docs/examples/backups/get-restoration.md | 10 +- docs/examples/backups/list-archives.md | 10 +- docs/examples/backups/list-policies.md | 10 +- docs/examples/backups/list-restorations.md | 10 +- docs/examples/backups/update-policy.md | 10 +- .../databases/create-big-int-attribute.md | 10 +- .../databases/create-boolean-attribute.md | 10 +- docs/examples/databases/create-collection.md | 10 +- .../databases/create-datetime-attribute.md | 10 +- docs/examples/databases/create-document.md | 9 +- docs/examples/databases/create-documents.md | 10 +- .../databases/create-email-attribute.md | 10 +- .../databases/create-enum-attribute.md | 10 +- .../databases/create-float-attribute.md | 10 +- docs/examples/databases/create-index.md | 10 +- .../databases/create-integer-attribute.md | 10 +- .../examples/databases/create-ip-attribute.md | 10 +- .../databases/create-line-attribute.md | 10 +- .../databases/create-longtext-attribute.md | 10 +- .../databases/create-mediumtext-attribute.md | 10 +- docs/examples/databases/create-operations.md | 10 +- .../databases/create-point-attribute.md | 10 +- .../databases/create-polygon-attribute.md | 10 +- .../create-relationship-attribute.md | 10 +- .../databases/create-string-attribute.md | 10 +- .../databases/create-text-attribute.md | 10 +- docs/examples/databases/create-transaction.md | 10 +- .../databases/create-url-attribute.md | 10 +- .../databases/create-varchar-attribute.md | 10 +- docs/examples/databases/create.md | 10 +- .../databases/decrement-document-attribute.md | 9 +- docs/examples/databases/delete-attribute.md | 10 +- docs/examples/databases/delete-collection.md | 10 +- docs/examples/databases/delete-document.md | 9 +- docs/examples/databases/delete-documents.md | 10 +- docs/examples/databases/delete-index.md | 10 +- docs/examples/databases/delete-transaction.md | 10 +- docs/examples/databases/delete.md | 10 +- docs/examples/databases/get-attribute.md | 10 +- docs/examples/databases/get-collection.md | 10 +- docs/examples/databases/get-document.md | 9 +- docs/examples/databases/get-index.md | 10 +- docs/examples/databases/get-transaction.md | 10 +- docs/examples/databases/get.md | 10 +- .../databases/increment-document-attribute.md | 9 +- docs/examples/databases/list-attributes.md | 10 +- docs/examples/databases/list-collections.md | 10 +- docs/examples/databases/list-documents.md | 9 +- docs/examples/databases/list-indexes.md | 10 +- docs/examples/databases/list-transactions.md | 10 +- docs/examples/databases/list.md | 10 +- .../databases/update-big-int-attribute.md | 10 +- .../databases/update-boolean-attribute.md | 10 +- docs/examples/databases/update-collection.md | 10 +- .../databases/update-datetime-attribute.md | 10 +- docs/examples/databases/update-document.md | 9 +- docs/examples/databases/update-documents.md | 10 +- .../databases/update-email-attribute.md | 10 +- .../databases/update-enum-attribute.md | 10 +- .../databases/update-float-attribute.md | 10 +- .../databases/update-integer-attribute.md | 10 +- .../examples/databases/update-ip-attribute.md | 10 +- .../databases/update-line-attribute.md | 10 +- .../databases/update-longtext-attribute.md | 10 +- .../databases/update-mediumtext-attribute.md | 10 +- .../databases/update-point-attribute.md | 10 +- .../databases/update-polygon-attribute.md | 10 +- .../update-relationship-attribute.md | 10 +- .../databases/update-string-attribute.md | 10 +- .../databases/update-text-attribute.md | 10 +- docs/examples/databases/update-transaction.md | 10 +- .../databases/update-url-attribute.md | 10 +- .../databases/update-varchar-attribute.md | 10 +- docs/examples/databases/update.md | 10 +- docs/examples/databases/upsert-document.md | 9 +- docs/examples/databases/upsert-documents.md | 10 +- docs/examples/functions/create-deployment.md | 10 +- .../functions/create-duplicate-deployment.md | 10 +- docs/examples/functions/create-execution.md | 9 +- .../functions/create-template-deployment.md | 10 +- docs/examples/functions/create-variable.md | 10 +- .../functions/create-vcs-deployment.md | 10 +- docs/examples/functions/create.md | 10 +- docs/examples/functions/delete-deployment.md | 10 +- docs/examples/functions/delete-execution.md | 10 +- docs/examples/functions/delete-variable.md | 10 +- docs/examples/functions/delete.md | 10 +- .../functions/get-deployment-download.md | 10 +- docs/examples/functions/get-deployment.md | 10 +- docs/examples/functions/get-execution.md | 9 +- docs/examples/functions/get-variable.md | 10 +- docs/examples/functions/get.md | 10 +- docs/examples/functions/list-deployments.md | 10 +- docs/examples/functions/list-executions.md | 9 +- docs/examples/functions/list-runtimes.md | 11 +- .../examples/functions/list-specifications.md | 11 +- docs/examples/functions/list-variables.md | 10 +- docs/examples/functions/list.md | 10 +- .../functions/update-deployment-status.md | 10 +- .../functions/update-function-deployment.md | 10 +- docs/examples/functions/update-variable.md | 10 +- docs/examples/functions/update.md | 10 +- docs/examples/graphql/mutation.md | 10 +- docs/examples/graphql/query.md | 10 +- docs/examples/health/get-antivirus.md | 11 +- docs/examples/health/get-cache.md | 11 +- docs/examples/health/get-certificate.md | 10 +- docs/examples/health/get-console-pausing.md | 10 +- docs/examples/health/get-db.md | 11 +- docs/examples/health/get-failed-jobs.md | 10 +- docs/examples/health/get-pub-sub.md | 11 +- docs/examples/health/get-queue-audits.md | 10 +- docs/examples/health/get-queue-builds.md | 10 +- .../examples/health/get-queue-certificates.md | 10 +- docs/examples/health/get-queue-databases.md | 10 +- docs/examples/health/get-queue-deletes.md | 10 +- docs/examples/health/get-queue-functions.md | 10 +- docs/examples/health/get-queue-logs.md | 10 +- docs/examples/health/get-queue-mails.md | 10 +- docs/examples/health/get-queue-messaging.md | 10 +- docs/examples/health/get-queue-migrations.md | 10 +- .../health/get-queue-stats-resources.md | 10 +- docs/examples/health/get-queue-usage.md | 10 +- docs/examples/health/get-queue-webhooks.md | 10 +- docs/examples/health/get-storage-local.md | 11 +- docs/examples/health/get-storage.md | 11 +- docs/examples/health/get-time.md | 11 +- docs/examples/health/get.md | 11 +- docs/examples/locale/get.md | 10 +- docs/examples/locale/list-codes.md | 10 +- docs/examples/locale/list-continents.md | 10 +- docs/examples/locale/list-countries-eu.md | 10 +- docs/examples/locale/list-countries-phones.md | 10 +- docs/examples/locale/list-countries.md | 10 +- docs/examples/locale/list-currencies.md | 10 +- docs/examples/locale/list-languages.md | 10 +- .../messaging/create-apns-provider.md | 10 +- docs/examples/messaging/create-email.md | 10 +- .../examples/messaging/create-fcm-provider.md | 10 +- .../messaging/create-mailgun-provider.md | 10 +- .../messaging/create-msg-91-provider.md | 10 +- docs/examples/messaging/create-push.md | 10 +- .../messaging/create-resend-provider.md | 10 +- .../messaging/create-sendgrid-provider.md | 10 +- docs/examples/messaging/create-sms.md | 10 +- .../messaging/create-smtp-provider.md | 10 +- docs/examples/messaging/create-subscriber.md | 10 +- .../messaging/create-telesign-provider.md | 10 +- .../messaging/create-textmagic-provider.md | 10 +- docs/examples/messaging/create-topic.md | 10 +- .../messaging/create-twilio-provider.md | 10 +- .../messaging/create-vonage-provider.md | 10 +- docs/examples/messaging/delete-provider.md | 10 +- docs/examples/messaging/delete-subscriber.md | 10 +- docs/examples/messaging/delete-topic.md | 10 +- docs/examples/messaging/delete.md | 10 +- docs/examples/messaging/get-message.md | 10 +- docs/examples/messaging/get-provider.md | 10 +- docs/examples/messaging/get-subscriber.md | 10 +- docs/examples/messaging/get-topic.md | 10 +- docs/examples/messaging/list-message-logs.md | 10 +- docs/examples/messaging/list-messages.md | 10 +- docs/examples/messaging/list-provider-logs.md | 10 +- docs/examples/messaging/list-providers.md | 10 +- .../messaging/list-subscriber-logs.md | 10 +- docs/examples/messaging/list-subscribers.md | 10 +- docs/examples/messaging/list-targets.md | 10 +- docs/examples/messaging/list-topic-logs.md | 10 +- docs/examples/messaging/list-topics.md | 10 +- .../messaging/update-apns-provider.md | 10 +- docs/examples/messaging/update-email.md | 10 +- .../examples/messaging/update-fcm-provider.md | 10 +- .../messaging/update-mailgun-provider.md | 10 +- .../messaging/update-msg-91-provider.md | 10 +- docs/examples/messaging/update-push.md | 10 +- .../messaging/update-resend-provider.md | 10 +- .../messaging/update-sendgrid-provider.md | 10 +- docs/examples/messaging/update-sms.md | 10 +- .../messaging/update-smtp-provider.md | 10 +- .../messaging/update-telesign-provider.md | 10 +- .../messaging/update-textmagic-provider.md | 10 +- docs/examples/messaging/update-topic.md | 10 +- .../messaging/update-twilio-provider.md | 10 +- .../messaging/update-vonage-provider.md | 10 +- docs/examples/presences/delete.md | 10 +- docs/examples/presences/get.md | 10 +- docs/examples/presences/list.md | 10 +- docs/examples/presences/update-presence.md | 10 +- docs/examples/presences/update.md | 20 -- docs/examples/presences/upsert.md | 10 +- .../project/create-android-platform.md | 10 +- .../examples/project/create-apple-platform.md | 10 +- docs/examples/project/create-ephemeral-key.md | 10 +- docs/examples/project/create-key.md | 10 +- .../examples/project/create-linux-platform.md | 10 +- docs/examples/project/create-mock-phone.md | 10 +- docs/examples/project/create-smtp-test.md | 10 +- docs/examples/project/create-variable.md | 10 +- docs/examples/project/create-web-platform.md | 10 +- .../project/create-windows-platform.md | 10 +- docs/examples/project/delete-key.md | 10 +- docs/examples/project/delete-mock-phone.md | 10 +- docs/examples/project/delete-platform.md | 10 +- docs/examples/project/delete-variable.md | 10 +- docs/examples/project/delete.md | 11 +- docs/examples/project/get-email-template.md | 10 +- docs/examples/project/get-key.md | 10 +- docs/examples/project/get-mock-phone.md | 10 +- .../examples/project/get-o-auth-2-provider.md | 10 +- docs/examples/project/get-platform.md | 10 +- docs/examples/project/get-policy.md | 10 +- docs/examples/project/get-variable.md | 10 +- docs/examples/project/get.md | 11 +- docs/examples/project/list-email-templates.md | 10 +- docs/examples/project/list-keys.md | 10 +- docs/examples/project/list-mock-phones.md | 10 +- .../project/list-o-auth-2-providers.md | 10 +- docs/examples/project/list-platforms.md | 10 +- docs/examples/project/list-policies.md | 10 +- docs/examples/project/list-variables.md | 10 +- .../project/update-android-platform.md | 10 +- .../examples/project/update-apple-platform.md | 10 +- docs/examples/project/update-auth-method.md | 10 +- .../update-deny-aliased-email-policy.md | 10 +- .../update-deny-disposable-email-policy.md | 10 +- .../project/update-deny-free-email-policy.md | 10 +- .../examples/project/update-email-template.md | 10 +- docs/examples/project/update-key.md | 10 +- docs/examples/project/update-labels.md | 10 +- .../examples/project/update-linux-platform.md | 10 +- .../update-membership-privacy-policy.md | 10 +- docs/examples/project/update-mock-phone.md | 10 +- .../project/update-o-auth-2-amazon.md | 10 +- .../examples/project/update-o-auth-2-apple.md | 10 +- .../project/update-o-auth-2-auth-0.md | 10 +- .../project/update-o-auth-2-authentik.md | 10 +- .../project/update-o-auth-2-autodesk.md | 10 +- .../project/update-o-auth-2-bitbucket.md | 10 +- .../examples/project/update-o-auth-2-bitly.md | 10 +- docs/examples/project/update-o-auth-2-box.md | 10 +- .../project/update-o-auth-2-dailymotion.md | 10 +- .../project/update-o-auth-2-discord.md | 10 +- .../project/update-o-auth-2-disqus.md | 10 +- .../project/update-o-auth-2-dropbox.md | 10 +- docs/examples/project/update-o-auth-2-etsy.md | 10 +- .../project/update-o-auth-2-facebook.md | 10 +- .../examples/project/update-o-auth-2-figma.md | 10 +- .../project/update-o-auth-2-fusion-auth.md | 10 +- .../project/update-o-auth-2-git-hub.md | 10 +- .../project/update-o-auth-2-gitlab.md | 10 +- .../project/update-o-auth-2-google.md | 10 +- .../project/update-o-auth-2-keycloak.md | 10 +- docs/examples/project/update-o-auth-2-kick.md | 10 +- .../project/update-o-auth-2-linkedin.md | 10 +- .../project/update-o-auth-2-microsoft.md | 10 +- .../project/update-o-auth-2-notion.md | 10 +- docs/examples/project/update-o-auth-2-oidc.md | 10 +- docs/examples/project/update-o-auth-2-okta.md | 10 +- .../project/update-o-auth-2-paypal-sandbox.md | 10 +- .../project/update-o-auth-2-paypal.md | 10 +- .../examples/project/update-o-auth-2-podio.md | 10 +- .../project/update-o-auth-2-salesforce.md | 10 +- .../examples/project/update-o-auth-2-slack.md | 10 +- .../project/update-o-auth-2-spotify.md | 10 +- .../project/update-o-auth-2-stripe.md | 10 +- .../update-o-auth-2-tradeshift-sandbox.md | 10 +- .../project/update-o-auth-2-tradeshift.md | 10 +- .../project/update-o-auth-2-twitch.md | 10 +- .../project/update-o-auth-2-word-press.md | 10 +- .../examples/project/update-o-auth-2-yahoo.md | 10 +- .../project/update-o-auth-2-yandex.md | 10 +- docs/examples/project/update-o-auth-2-zoho.md | 10 +- docs/examples/project/update-o-auth-2-zoom.md | 10 +- docs/examples/project/update-o-auth-2x.md | 10 +- .../update-password-dictionary-policy.md | 10 +- .../project/update-password-history-policy.md | 10 +- .../update-password-personal-data-policy.md | 10 +- docs/examples/project/update-protocol.md | 10 +- docs/examples/project/update-service.md | 10 +- .../project/update-session-alert-policy.md | 10 +- .../project/update-session-duration-policy.md | 10 +- .../update-session-invalidation-policy.md | 10 +- .../project/update-session-limit-policy.md | 10 +- docs/examples/project/update-smtp.md | 10 +- .../project/update-user-limit-policy.md | 10 +- docs/examples/project/update-variable.md | 10 +- docs/examples/project/update-web-platform.md | 10 +- .../project/update-windows-platform.md | 10 +- docs/examples/proxy/create-api-rule.md | 10 +- docs/examples/proxy/create-function-rule.md | 10 +- docs/examples/proxy/create-redirect-rule.md | 10 +- docs/examples/proxy/create-site-rule.md | 10 +- docs/examples/proxy/delete-rule.md | 10 +- docs/examples/proxy/get-rule.md | 10 +- docs/examples/proxy/list-rules.md | 10 +- docs/examples/proxy/update-rule-status.md | 10 +- docs/examples/sites/create-deployment.md | 10 +- .../sites/create-duplicate-deployment.md | 10 +- .../sites/create-template-deployment.md | 10 +- docs/examples/sites/create-variable.md | 10 +- docs/examples/sites/create-vcs-deployment.md | 10 +- docs/examples/sites/create.md | 10 +- docs/examples/sites/delete-deployment.md | 10 +- docs/examples/sites/delete-log.md | 10 +- docs/examples/sites/delete-variable.md | 10 +- docs/examples/sites/delete.md | 10 +- .../examples/sites/get-deployment-download.md | 10 +- docs/examples/sites/get-deployment.md | 10 +- docs/examples/sites/get-log.md | 10 +- docs/examples/sites/get-variable.md | 10 +- docs/examples/sites/get.md | 10 +- docs/examples/sites/list-deployments.md | 10 +- docs/examples/sites/list-frameworks.md | 11 +- docs/examples/sites/list-logs.md | 10 +- docs/examples/sites/list-specifications.md | 11 +- docs/examples/sites/list-variables.md | 10 +- docs/examples/sites/list.md | 10 +- .../sites/update-deployment-status.md | 10 +- docs/examples/sites/update-site-deployment.md | 10 +- docs/examples/sites/update-variable.md | 10 +- docs/examples/sites/update.md | 10 +- docs/examples/storage/create-bucket.md | 10 +- docs/examples/storage/create-file.md | 9 +- docs/examples/storage/delete-bucket.md | 10 +- docs/examples/storage/delete-file.md | 9 +- docs/examples/storage/get-bucket.md | 10 +- docs/examples/storage/get-file-download.md | 9 +- docs/examples/storage/get-file-preview.md | 9 +- docs/examples/storage/get-file-view.md | 9 +- docs/examples/storage/get-file.md | 9 +- docs/examples/storage/list-buckets.md | 10 +- docs/examples/storage/list-files.md | 9 +- docs/examples/storage/update-bucket.md | 10 +- docs/examples/storage/update-file.md | 9 +- .../tablesdb/create-big-int-column.md | 10 +- .../tablesdb/create-boolean-column.md | 10 +- .../tablesdb/create-datetime-column.md | 10 +- docs/examples/tablesdb/create-email-column.md | 10 +- docs/examples/tablesdb/create-enum-column.md | 10 +- docs/examples/tablesdb/create-float-column.md | 10 +- docs/examples/tablesdb/create-index.md | 10 +- .../tablesdb/create-integer-column.md | 10 +- docs/examples/tablesdb/create-ip-column.md | 10 +- docs/examples/tablesdb/create-line-column.md | 10 +- .../tablesdb/create-longtext-column.md | 10 +- .../tablesdb/create-mediumtext-column.md | 10 +- docs/examples/tablesdb/create-operations.md | 10 +- docs/examples/tablesdb/create-point-column.md | 10 +- .../tablesdb/create-polygon-column.md | 10 +- .../tablesdb/create-relationship-column.md | 10 +- docs/examples/tablesdb/create-row.md | 9 +- docs/examples/tablesdb/create-rows.md | 10 +- .../examples/tablesdb/create-string-column.md | 10 +- docs/examples/tablesdb/create-table.md | 10 +- docs/examples/tablesdb/create-text-column.md | 10 +- docs/examples/tablesdb/create-transaction.md | 10 +- docs/examples/tablesdb/create-url-column.md | 10 +- .../tablesdb/create-varchar-column.md | 10 +- docs/examples/tablesdb/create.md | 10 +- .../examples/tablesdb/decrement-row-column.md | 9 +- docs/examples/tablesdb/delete-column.md | 10 +- docs/examples/tablesdb/delete-index.md | 10 +- docs/examples/tablesdb/delete-row.md | 9 +- docs/examples/tablesdb/delete-rows.md | 10 +- docs/examples/tablesdb/delete-table.md | 10 +- docs/examples/tablesdb/delete-transaction.md | 10 +- docs/examples/tablesdb/delete.md | 10 +- docs/examples/tablesdb/get-column.md | 10 +- docs/examples/tablesdb/get-index.md | 10 +- docs/examples/tablesdb/get-row.md | 9 +- docs/examples/tablesdb/get-table.md | 10 +- docs/examples/tablesdb/get-transaction.md | 10 +- docs/examples/tablesdb/get.md | 10 +- .../examples/tablesdb/increment-row-column.md | 9 +- docs/examples/tablesdb/list-columns.md | 10 +- docs/examples/tablesdb/list-indexes.md | 10 +- docs/examples/tablesdb/list-rows.md | 9 +- docs/examples/tablesdb/list-tables.md | 10 +- docs/examples/tablesdb/list-transactions.md | 10 +- docs/examples/tablesdb/list.md | 10 +- .../tablesdb/update-big-int-column.md | 10 +- .../tablesdb/update-boolean-column.md | 10 +- .../tablesdb/update-datetime-column.md | 10 +- docs/examples/tablesdb/update-email-column.md | 10 +- docs/examples/tablesdb/update-enum-column.md | 10 +- docs/examples/tablesdb/update-float-column.md | 10 +- .../tablesdb/update-integer-column.md | 10 +- docs/examples/tablesdb/update-ip-column.md | 10 +- docs/examples/tablesdb/update-line-column.md | 10 +- .../tablesdb/update-longtext-column.md | 10 +- .../tablesdb/update-mediumtext-column.md | 10 +- docs/examples/tablesdb/update-point-column.md | 10 +- .../tablesdb/update-polygon-column.md | 10 +- .../tablesdb/update-relationship-column.md | 10 +- docs/examples/tablesdb/update-row.md | 9 +- docs/examples/tablesdb/update-rows.md | 10 +- .../examples/tablesdb/update-string-column.md | 10 +- docs/examples/tablesdb/update-table.md | 10 +- docs/examples/tablesdb/update-text-column.md | 10 +- docs/examples/tablesdb/update-transaction.md | 10 +- docs/examples/tablesdb/update-url-column.md | 10 +- .../tablesdb/update-varchar-column.md | 10 +- docs/examples/tablesdb/update.md | 10 +- docs/examples/tablesdb/upsert-row.md | 9 +- docs/examples/tablesdb/upsert-rows.md | 10 +- docs/examples/teams/create-membership.md | 9 +- docs/examples/teams/create.md | 9 +- docs/examples/teams/delete-membership.md | 9 +- docs/examples/teams/delete.md | 9 +- docs/examples/teams/get-membership.md | 9 +- docs/examples/teams/get-prefs.md | 9 +- docs/examples/teams/get.md | 9 +- docs/examples/teams/list-memberships.md | 9 +- docs/examples/teams/list.md | 9 +- .../teams/update-membership-status.md | 9 +- docs/examples/teams/update-membership.md | 9 +- docs/examples/teams/update-name.md | 9 +- docs/examples/teams/update-prefs.md | 9 +- docs/examples/tokens/create-file-token.md | 10 +- docs/examples/tokens/delete.md | 10 +- docs/examples/tokens/get.md | 10 +- docs/examples/tokens/list.md | 10 +- docs/examples/tokens/update.md | 10 +- docs/examples/usage/list-events.md | 10 +- docs/examples/usage/list-gauges.md | 10 +- docs/examples/users/create-argon-2-user.md | 10 +- docs/examples/users/create-bcrypt-user.md | 10 +- docs/examples/users/create-jwt.md | 10 +- docs/examples/users/create-md-5-user.md | 10 +- .../users/create-mfa-recovery-codes.md | 10 +- docs/examples/users/create-ph-pass-user.md | 10 +- .../users/create-scrypt-modified-user.md | 10 +- docs/examples/users/create-scrypt-user.md | 10 +- docs/examples/users/create-session.md | 10 +- docs/examples/users/create-sha-user.md | 10 +- docs/examples/users/create-target.md | 10 +- docs/examples/users/create-token.md | 10 +- docs/examples/users/create.md | 10 +- docs/examples/users/delete-identity.md | 10 +- .../users/delete-mfa-authenticator.md | 10 +- docs/examples/users/delete-session.md | 10 +- docs/examples/users/delete-sessions.md | 10 +- docs/examples/users/delete-target.md | 10 +- docs/examples/users/delete.md | 10 +- docs/examples/users/get-mfa-recovery-codes.md | 10 +- docs/examples/users/get-prefs.md | 10 +- docs/examples/users/get-target.md | 10 +- docs/examples/users/get.md | 10 +- docs/examples/users/list-identities.md | 10 +- docs/examples/users/list-logs.md | 10 +- docs/examples/users/list-memberships.md | 10 +- docs/examples/users/list-mfa-factors.md | 10 +- docs/examples/users/list-sessions.md | 10 +- docs/examples/users/list-targets.md | 10 +- docs/examples/users/list.md | 10 +- .../users/update-email-verification.md | 10 +- docs/examples/users/update-email.md | 10 +- docs/examples/users/update-impersonator.md | 10 +- docs/examples/users/update-labels.md | 10 +- .../users/update-mfa-recovery-codes.md | 10 +- docs/examples/users/update-mfa.md | 10 +- docs/examples/users/update-name.md | 10 +- docs/examples/users/update-password.md | 10 +- .../users/update-phone-verification.md | 10 +- docs/examples/users/update-phone.md | 10 +- docs/examples/users/update-prefs.md | 10 +- docs/examples/users/update-status.md | 10 +- docs/examples/users/update-target.md | 10 +- docs/examples/webhooks/create.md | 10 +- docs/examples/webhooks/delete.md | 10 +- docs/examples/webhooks/get.md | 10 +- docs/examples/webhooks/list.md | 10 +- docs/examples/webhooks/update-secret.md | 10 +- docs/examples/webhooks/update.md | 10 +- src/client.ts | 44 ++--- src/models.ts | 18 +- src/services/account.ts | 2 + src/services/avatars.ts | 8 + src/services/functions.ts | 1 + src/services/presences.ts | 178 +----------------- src/services/sites.ts | 1 + src/services/storage.ts | 3 + 554 files changed, 3239 insertions(+), 2407 deletions(-) delete mode 100644 docs/examples/presences/update.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e8c9dfb..2cc95c9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ * Added: Server-side auth via `apiKey`, `cookie`, and `jwt` factories * Added: Admin and server-only endpoints (`Users`, `Projects`, function and site deployments, storage buckets, and more) * Deprecated: `new Client()` constructor and `setEndpoint`/`setProject`/setter pattern remain for backwards compatibility but are now marked deprecated -* Updated: `x-sdk-platform` header now reflects browser or server runtime ## 25.1.1 diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index 818f50a4..ecc96bd4 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.createAnonymousSession(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index 4010b91f..f047703a 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.createEmailPasswordSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 940a7f70..0c8e00f6 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -14,4 +15,4 @@ const result = await account.createEmailToken({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md index a3e378d2..91e34e24 100644 --- a/docs/examples/account/create-email-verification.md +++ b/docs/examples/account/create-email-verification.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.createEmailVerification({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 0ba2d266..6a0b3205 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.createJWT({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index 59d1aaf0..db3d0e64 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -15,4 +16,4 @@ const result = await account.createMagicURLToken({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index cf6a6098..5afe9a2c 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account, AuthenticatorType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.createMFAAuthenticator({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index d9d9856d..d5ed988b 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account, AuthenticationFactor } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.createMFAChallenge({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index 3c292f26..e73f5a81 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.createMFARecoveryCodes(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-o-auth-2-session.md b/docs/examples/account/create-o-auth-2-session.md index 734b6972..46b4988d 100644 --- a/docs/examples/account/create-o-auth-2-session.md +++ b/docs/examples/account/create-o-auth-2-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account, OAuthProvider } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,5 +14,4 @@ account.createOAuth2Session({ failure: 'https://example.com', // optional scopes: [] // optional }); - -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index f6187249..d9865c6d 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account, OAuthProvider } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,5 +14,4 @@ account.createOAuth2Token({ failure: 'https://example.com', // optional scopes: [] // optional }); - -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index 78812e33..c27d585b 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.createPhoneToken({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 9c0ea143..49fd657c 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.createPhoneVerification(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-push-target.md b/docs/examples/account/create-push-target.md index 39f4d48a..a253d338 100644 --- a/docs/examples/account/create-push-target.md +++ b/docs/examples/account/create-push-target.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -14,4 +15,4 @@ const result = await account.createPushTarget({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index 0f4e7a91..b8ad516d 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.createRecovery({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 1639c12c..63dfd40b 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.createSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 0795d0ac..08596147 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.createVerification({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index a78197cd..438d6d3d 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -15,4 +16,4 @@ const result = await account.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index d63addb7..f0c3b6b0 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.deleteIdentity({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 079f0b95..6824a56b 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account, AuthenticatorType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.deleteMFAAuthenticator({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/delete-push-target.md b/docs/examples/account/delete-push-target.md index 38d0ed5a..6eaf5be9 100644 --- a/docs/examples/account/delete-push-target.md +++ b/docs/examples/account/delete-push-target.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.deletePushTarget({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 9d2b8f3e..30058f40 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.deleteSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index d7df883e..475e4e7a 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.deleteSessions(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index 1d102583..22527912 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.getMFARecoveryCodes(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 9e2d5e25..0a7cf6ed 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.getPrefs(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index 83ac4b0a..f3e7b14a 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.getSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 0b6c59e3..551b62c6 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.get(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 8dee4b39..59a9f600 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.listIdentities({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index 91be728f..d6ff44fd 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.listLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 9950129b..5d78f5c0 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.listMFAFactors(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index 2dae7488..fd96eef6 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.listSessions(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md index f3e8b619..929f469f 100644 --- a/docs/examples/account/update-email-verification.md +++ b/docs/examples/account/update-email-verification.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updateEmailVerification({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 0bd7d36c..5bd523d0 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updateEmail({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index d0598719..e6d65eb1 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updateMagicURLSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index bf25c76b..da6e953b 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account, AuthenticatorType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updateMFAAuthenticator({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index a16ea43a..c8c33a43 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updateMFAChallenge({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index 8bc8273c..b93b22af 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.updateMFARecoveryCodes(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md index f17ca2b1..79eb2084 100644 --- a/docs/examples/account/update-mfa.md +++ b/docs/examples/account/update-mfa.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.updateMFA({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index 3e184d75..c380d92d 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.updateName({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index 360c577f..efbfbdf4 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updatePassword({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 5352cf0a..82846fdc 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updatePhoneSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 2ddd0f13..9d652b58 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updatePhoneVerification({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 9f640a12..94b13d58 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updatePhone({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index ca2841b7..be633038 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -16,4 +17,4 @@ const result = await account.updatePrefs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-push-target.md b/docs/examples/account/update-push-target.md index 7c14aa3b..89c779c3 100644 --- a/docs/examples/account/update-push-target.md +++ b/docs/examples/account/update-push-target.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updatePushTarget({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index e08d48cb..4e4f5ed6 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -14,4 +15,4 @@ const result = await account.updateRecovery({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 9159580f..5d630e41 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -12,4 +13,4 @@ const result = await account.updateSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index ac2aa48e..76b46596 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,13 +1,15 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); const result = await account.updateStatus(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 3b52a83c..2c760c20 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,9 +1,10 @@ ```javascript import { Client, Account } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const account = new Account(client); @@ -13,4 +14,4 @@ const result = await account.updateVerification({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/activities/get-event.md b/docs/examples/activities/get-event.md index b3259ff8..675681d9 100644 --- a/docs/examples/activities/get-event.md +++ b/docs/examples/activities/get-event.md @@ -1,9 +1,11 @@ ```javascript import { Client, Activities } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const activities = new Activities(client); @@ -12,4 +14,4 @@ const result = await activities.getEvent({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md index 883371e3..53307864 100644 --- a/docs/examples/activities/list-events.md +++ b/docs/examples/activities/list-events.md @@ -1,9 +1,11 @@ ```javascript import { Client, Activities } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const activities = new Activities(client); @@ -12,4 +14,4 @@ const result = await activities.listEvents({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md index 3237bea0..8c99eac9 100644 --- a/docs/examples/advisor/delete-report.md +++ b/docs/examples/advisor/delete-report.md @@ -1,9 +1,11 @@ ```javascript import { Client, Advisor } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const advisor = new Advisor(client); @@ -12,4 +14,4 @@ const result = await advisor.deleteReport({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md index 28661f98..cb50fa74 100644 --- a/docs/examples/advisor/get-insight.md +++ b/docs/examples/advisor/get-insight.md @@ -1,9 +1,11 @@ ```javascript import { Client, Advisor } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const advisor = new Advisor(client); @@ -13,4 +15,4 @@ const result = await advisor.getInsight({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md index 79736784..ecf4cd44 100644 --- a/docs/examples/advisor/get-report.md +++ b/docs/examples/advisor/get-report.md @@ -1,9 +1,11 @@ ```javascript import { Client, Advisor } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const advisor = new Advisor(client); @@ -12,4 +14,4 @@ const result = await advisor.getReport({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md index c9b8f2ea..57c30ad5 100644 --- a/docs/examples/advisor/list-insights.md +++ b/docs/examples/advisor/list-insights.md @@ -1,9 +1,11 @@ ```javascript import { Client, Advisor } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const advisor = new Advisor(client); @@ -14,4 +16,4 @@ const result = await advisor.listInsights({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md index 9480e970..86f677eb 100644 --- a/docs/examples/advisor/list-reports.md +++ b/docs/examples/advisor/list-reports.md @@ -1,9 +1,11 @@ ```javascript import { Client, Advisor } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const advisor = new Advisor(client); @@ -13,4 +15,4 @@ const result = await advisor.listReports({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index d4c1a40f..3649b924 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars, Browser } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -15,4 +16,4 @@ const result = avatars.getBrowser({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 57758501..fc340b24 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars, CreditCard } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -15,4 +16,4 @@ const result = avatars.getCreditCard({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 8b09f65f..11343a93 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -12,4 +13,4 @@ const result = avatars.getFavicon({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index d24b9b40..eea92243 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars, Flag } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -15,4 +16,4 @@ const result = avatars.getFlag({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index f8f33731..e03338ca 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -14,4 +15,4 @@ const result = avatars.getImage({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 0722a72d..0434bcb5 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -15,4 +16,4 @@ const result = avatars.getInitials({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md index 829c7121..8cf61e99 100644 --- a/docs/examples/avatars/get-qr.md +++ b/docs/examples/avatars/get-qr.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -15,4 +16,4 @@ const result = avatars.getQR({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 8804b1e8..258984d4 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -1,9 +1,10 @@ ```javascript import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const avatars = new Avatars(client); @@ -34,4 +35,4 @@ const result = avatars.getScreenshot({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md index 5a0c1d32..38db2e9b 100644 --- a/docs/examples/backups/create-archive.md +++ b/docs/examples/backups/create-archive.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups, BackupServices } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -13,4 +15,4 @@ const result = await backups.createArchive({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md index 183a19c8..631f97a7 100644 --- a/docs/examples/backups/create-policy.md +++ b/docs/examples/backups/create-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups, BackupServices } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -18,4 +20,4 @@ const result = await backups.createPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md index 19e40470..d0c68ae8 100644 --- a/docs/examples/backups/create-restoration.md +++ b/docs/examples/backups/create-restoration.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups, BackupServices } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -15,4 +17,4 @@ const result = await backups.createRestoration({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md index 95722eb3..731367cd 100644 --- a/docs/examples/backups/delete-archive.md +++ b/docs/examples/backups/delete-archive.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.deleteArchive({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md index 07499bb6..0d51d644 100644 --- a/docs/examples/backups/delete-policy.md +++ b/docs/examples/backups/delete-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.deletePolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md index 2ab79ac7..989fdad4 100644 --- a/docs/examples/backups/get-archive.md +++ b/docs/examples/backups/get-archive.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.getArchive({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md index aed31bf7..6a3bf33b 100644 --- a/docs/examples/backups/get-policy.md +++ b/docs/examples/backups/get-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.getPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md index c0deac84..b48d1dc6 100644 --- a/docs/examples/backups/get-restoration.md +++ b/docs/examples/backups/get-restoration.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.getRestoration({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md index 33a1dd26..63f64796 100644 --- a/docs/examples/backups/list-archives.md +++ b/docs/examples/backups/list-archives.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.listArchives({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md index 4a7fa7bd..45a74d9b 100644 --- a/docs/examples/backups/list-policies.md +++ b/docs/examples/backups/list-policies.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.listPolicies({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md index 04c3a373..e0548a91 100644 --- a/docs/examples/backups/list-restorations.md +++ b/docs/examples/backups/list-restorations.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -12,4 +14,4 @@ const result = await backups.listRestorations({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md index 69a5503c..805a753f 100644 --- a/docs/examples/backups/update-policy.md +++ b/docs/examples/backups/update-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Backups } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const backups = new Backups(client); @@ -16,4 +18,4 @@ const result = await backups.updatePolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-big-int-attribute.md b/docs/examples/databases/create-big-int-attribute.md index e0e4541f..3b58d773 100644 --- a/docs/examples/databases/create-big-int-attribute.md +++ b/docs/examples/databases/create-big-int-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.createBigIntAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md index d41f60bb..dbaa56dd 100644 --- a/docs/examples/databases/create-boolean-attribute.md +++ b/docs/examples/databases/create-boolean-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.createBooleanAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md index 0da70c48..ab6ef901 100644 --- a/docs/examples/databases/create-collection.md +++ b/docs/examples/databases/create-collection.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.createCollection({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md index b59332b8..289a3b82 100644 --- a/docs/examples/databases/create-datetime-attribute.md +++ b/docs/examples/databases/create-datetime-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.createDatetimeAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 4d8d7f90..81828da5 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -23,4 +24,4 @@ const result = await databases.createDocument({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md index cd94cc96..1361dd01 100644 --- a/docs/examples/databases/create-documents.md +++ b/docs/examples/databases/create-documents.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -15,4 +17,4 @@ const result = await databases.createDocuments({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md index 87444399..52a86854 100644 --- a/docs/examples/databases/create-email-attribute.md +++ b/docs/examples/databases/create-email-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.createEmailAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md index 0787923a..287370f1 100644 --- a/docs/examples/databases/create-enum-attribute.md +++ b/docs/examples/databases/create-enum-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.createEnumAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md index 3d46dc43..a13e3356 100644 --- a/docs/examples/databases/create-float-attribute.md +++ b/docs/examples/databases/create-float-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.createFloatAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md index 7f77071a..e2e9f681 100644 --- a/docs/examples/databases/create-index.md +++ b/docs/examples/databases/create-index.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases, DatabasesIndexType, OrderBy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.createIndex({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md index 4c700cbb..c7787f96 100644 --- a/docs/examples/databases/create-integer-attribute.md +++ b/docs/examples/databases/create-integer-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.createIntegerAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md index 3bd98af5..c5051ba8 100644 --- a/docs/examples/databases/create-ip-attribute.md +++ b/docs/examples/databases/create-ip-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.createIpAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md index 659af6e0..83d0c20f 100644 --- a/docs/examples/databases/create-line-attribute.md +++ b/docs/examples/databases/create-line-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -16,4 +18,4 @@ const result = await databases.createLineAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md index a1352102..8b72342d 100644 --- a/docs/examples/databases/create-longtext-attribute.md +++ b/docs/examples/databases/create-longtext-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.createLongtextAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md index f2035f29..a04ab8c5 100644 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ b/docs/examples/databases/create-mediumtext-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.createMediumtextAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index 48c74718..34ee30a8 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -23,4 +25,4 @@ const result = await databases.createOperations({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md index 46dbb28d..a62d8dee 100644 --- a/docs/examples/databases/create-point-attribute.md +++ b/docs/examples/databases/create-point-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -16,4 +18,4 @@ const result = await databases.createPointAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md index d57f1e25..1f3d33e3 100644 --- a/docs/examples/databases/create-polygon-attribute.md +++ b/docs/examples/databases/create-polygon-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -16,4 +18,4 @@ const result = await databases.createPolygonAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md index d11019bd..1f332983 100644 --- a/docs/examples/databases/create-relationship-attribute.md +++ b/docs/examples/databases/create-relationship-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases, RelationshipType, RelationMutate } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.createRelationshipAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md index 6e284ce2..b745b066 100644 --- a/docs/examples/databases/create-string-attribute.md +++ b/docs/examples/databases/create-string-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.createStringAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md index c0cb5c3d..3c848a44 100644 --- a/docs/examples/databases/create-text-attribute.md +++ b/docs/examples/databases/create-text-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.createTextAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md index eab2aa52..3d92a03c 100644 --- a/docs/examples/databases/create-transaction.md +++ b/docs/examples/databases/create-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -12,4 +14,4 @@ const result = await databases.createTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md index 31c85599..fe65eb10 100644 --- a/docs/examples/databases/create-url-attribute.md +++ b/docs/examples/databases/create-url-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.createUrlAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md index 111ae5fd..1c59217e 100644 --- a/docs/examples/databases/create-varchar-attribute.md +++ b/docs/examples/databases/create-varchar-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.createVarcharAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md index d9ec0129..9669d1b9 100644 --- a/docs/examples/databases/create.md +++ b/docs/examples/databases/create.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index c657bd49..87812337 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -18,4 +19,4 @@ const result = await databases.decrementDocumentAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md index 5a6f68e7..9d7c5ca6 100644 --- a/docs/examples/databases/delete-attribute.md +++ b/docs/examples/databases/delete-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.deleteAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md index 2f9d0e23..fbc73376 100644 --- a/docs/examples/databases/delete-collection.md +++ b/docs/examples/databases/delete-collection.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -13,4 +15,4 @@ const result = await databases.deleteCollection({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 95665088..3a8b3f37 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -15,4 +16,4 @@ const result = await databases.deleteDocument({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md index 21e5725e..392547b5 100644 --- a/docs/examples/databases/delete-documents.md +++ b/docs/examples/databases/delete-documents.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -15,4 +17,4 @@ const result = await databases.deleteDocuments({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md index 5a47e2db..605cfaf7 100644 --- a/docs/examples/databases/delete-index.md +++ b/docs/examples/databases/delete-index.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.deleteIndex({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md index 2e41d9be..9a46ece0 100644 --- a/docs/examples/databases/delete-transaction.md +++ b/docs/examples/databases/delete-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -12,4 +14,4 @@ const result = await databases.deleteTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md index b0de2e3f..096dbb99 100644 --- a/docs/examples/databases/delete.md +++ b/docs/examples/databases/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -12,4 +14,4 @@ const result = await databases.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md index 315e3766..a150bf5a 100644 --- a/docs/examples/databases/get-attribute.md +++ b/docs/examples/databases/get-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.getAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md index b3341d61..ccf0a4a9 100644 --- a/docs/examples/databases/get-collection.md +++ b/docs/examples/databases/get-collection.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -13,4 +15,4 @@ const result = await databases.getCollection({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index ad11eb8d..6385c6bb 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -16,4 +17,4 @@ const result = await databases.getDocument({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md index 2347e48e..1011e293 100644 --- a/docs/examples/databases/get-index.md +++ b/docs/examples/databases/get-index.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.getIndex({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md index 2419a8c0..68b42eb3 100644 --- a/docs/examples/databases/get-transaction.md +++ b/docs/examples/databases/get-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -12,4 +14,4 @@ const result = await databases.getTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md index 3ecc657a..4a84961f 100644 --- a/docs/examples/databases/get.md +++ b/docs/examples/databases/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -12,4 +14,4 @@ const result = await databases.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index 51eec6d5..ae91f08a 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -18,4 +19,4 @@ const result = await databases.incrementDocumentAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md index 3ea4e27e..6c491c69 100644 --- a/docs/examples/databases/list-attributes.md +++ b/docs/examples/databases/list-attributes.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -15,4 +17,4 @@ const result = await databases.listAttributes({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md index 915c58a7..e3cfb645 100644 --- a/docs/examples/databases/list-collections.md +++ b/docs/examples/databases/list-collections.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -15,4 +17,4 @@ const result = await databases.listCollections({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index 5444dffb..ff7dc7bf 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -17,4 +18,4 @@ const result = await databases.listDocuments({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md index b7bbd5e9..3a35f618 100644 --- a/docs/examples/databases/list-indexes.md +++ b/docs/examples/databases/list-indexes.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -15,4 +17,4 @@ const result = await databases.listIndexes({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index 6a74afc0..c0e40ca4 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -12,4 +14,4 @@ const result = await databases.listTransactions({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md index bdb054c4..106511cf 100644 --- a/docs/examples/databases/list.md +++ b/docs/examples/databases/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-big-int-attribute.md b/docs/examples/databases/update-big-int-attribute.md index df732291..73581c5d 100644 --- a/docs/examples/databases/update-big-int-attribute.md +++ b/docs/examples/databases/update-big-int-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.updateBigIntAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 46f589bc..8b74501d 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateBooleanAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md index 8ae672fd..61ce04f4 100644 --- a/docs/examples/databases/update-collection.md +++ b/docs/examples/databases/update-collection.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.updateCollection({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 3b0ab4eb..6858bec2 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateDatetimeAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index df5651d8..604ca741 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -23,4 +24,4 @@ const result = await databases.updateDocument({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md index ed953513..2a25921f 100644 --- a/docs/examples/databases/update-documents.md +++ b/docs/examples/databases/update-documents.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -22,4 +24,4 @@ const result = await databases.updateDocuments({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index 3da6e229..90102cf2 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateEmailAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index a6d700e7..1725e206 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.updateEnumAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index 2502c75f..7b1bd28b 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.updateFloatAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index 4b8b26b9..ca2bb467 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -19,4 +21,4 @@ const result = await databases.updateIntegerAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index e467a4dc..35a11447 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateIpAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md index cb963988..2b690dbf 100644 --- a/docs/examples/databases/update-line-attribute.md +++ b/docs/examples/databases/update-line-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateLineAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md index ef74a098..1468025f 100644 --- a/docs/examples/databases/update-longtext-attribute.md +++ b/docs/examples/databases/update-longtext-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateLongtextAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md index c3e34af0..12ba2807 100644 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateMediumtextAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md index de0391b1..ae819fc9 100644 --- a/docs/examples/databases/update-point-attribute.md +++ b/docs/examples/databases/update-point-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updatePointAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md index 7d13baee..814178af 100644 --- a/docs/examples/databases/update-polygon-attribute.md +++ b/docs/examples/databases/update-polygon-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updatePolygonAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md index 51dbfd69..b8e543e3 100644 --- a/docs/examples/databases/update-relationship-attribute.md +++ b/docs/examples/databases/update-relationship-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases, RelationMutate } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -16,4 +18,4 @@ const result = await databases.updateRelationshipAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 891d851b..4c575dbb 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.updateStringAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md index b954a492..cbc8afde 100644 --- a/docs/examples/databases/update-text-attribute.md +++ b/docs/examples/databases/update-text-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateTextAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md index 5a50ef67..620dae1d 100644 --- a/docs/examples/databases/update-transaction.md +++ b/docs/examples/databases/update-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.updateTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 040eafe9..d9db1973 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -17,4 +19,4 @@ const result = await databases.updateUrlAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md index 67b82ae6..09f5816c 100644 --- a/docs/examples/databases/update-varchar-attribute.md +++ b/docs/examples/databases/update-varchar-attribute.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -18,4 +20,4 @@ const result = await databases.updateVarcharAttribute({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md index aa15b64a..a1001fab 100644 --- a/docs/examples/databases/update.md +++ b/docs/examples/databases/update.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -14,4 +16,4 @@ const result = await databases.update({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 212964a6..6edb42f6 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -1,9 +1,10 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const databases = new Databases(client); @@ -23,4 +24,4 @@ const result = await databases.upsertDocument({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md index ade173ca..b642efaf 100644 --- a/docs/examples/databases/upsert-documents.md +++ b/docs/examples/databases/upsert-documents.md @@ -1,9 +1,11 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const databases = new Databases(client); @@ -15,4 +17,4 @@ const result = await databases.upsertDocuments({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md index 048e8de5..448c00da 100644 --- a/docs/examples/functions/create-deployment.md +++ b/docs/examples/functions/create-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -16,4 +18,4 @@ const result = await functions.createDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md index d3cbb752..ee9e11ad 100644 --- a/docs/examples/functions/create-duplicate-deployment.md +++ b/docs/examples/functions/create-duplicate-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -14,4 +16,4 @@ const result = await functions.createDuplicateDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 71dd8cc3..7538c329 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,9 +1,10 @@ ```javascript import { Client, Functions, ExecutionMethod } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const functions = new Functions(client); @@ -18,4 +19,4 @@ const result = await functions.createExecution({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md index e1f5a1c5..04e5830a 100644 --- a/docs/examples/functions/create-template-deployment.md +++ b/docs/examples/functions/create-template-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions, TemplateReferenceType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -18,4 +20,4 @@ const result = await functions.createTemplateDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md index 351967ae..76f9a315 100644 --- a/docs/examples/functions/create-variable.md +++ b/docs/examples/functions/create-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -16,4 +18,4 @@ const result = await functions.createVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md index ecf7b679..ac83b178 100644 --- a/docs/examples/functions/create-vcs-deployment.md +++ b/docs/examples/functions/create-vcs-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions, VCSReferenceType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -15,4 +17,4 @@ const result = await functions.createVcsDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 35a6b33f..9db1b3e1 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions, Runtime, Scopes } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -31,4 +33,4 @@ const result = await functions.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md index ea60b025..de513094 100644 --- a/docs/examples/functions/delete-deployment.md +++ b/docs/examples/functions/delete-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -13,4 +15,4 @@ const result = await functions.deleteDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md index bfef2df9..4351cc8c 100644 --- a/docs/examples/functions/delete-execution.md +++ b/docs/examples/functions/delete-execution.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -13,4 +15,4 @@ const result = await functions.deleteExecution({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md index d5a28b13..c3133db1 100644 --- a/docs/examples/functions/delete-variable.md +++ b/docs/examples/functions/delete-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -13,4 +15,4 @@ const result = await functions.deleteVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md index 6211af35..f297b6f8 100644 --- a/docs/examples/functions/delete.md +++ b/docs/examples/functions/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -12,4 +14,4 @@ const result = await functions.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md index eb098d89..eb8c7bee 100644 --- a/docs/examples/functions/get-deployment-download.md +++ b/docs/examples/functions/get-deployment-download.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions, DeploymentDownloadType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -14,4 +16,4 @@ const result = functions.getDeploymentDownload({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md index 09227179..f12ac97e 100644 --- a/docs/examples/functions/get-deployment.md +++ b/docs/examples/functions/get-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -13,4 +15,4 @@ const result = await functions.getDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index a9b22e29..978fa2ec 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,9 +1,10 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const functions = new Functions(client); @@ -13,4 +14,4 @@ const result = await functions.getExecution({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md index dec53083..4db7a86c 100644 --- a/docs/examples/functions/get-variable.md +++ b/docs/examples/functions/get-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -13,4 +15,4 @@ const result = await functions.getVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md index fa5bf658..bfb693a2 100644 --- a/docs/examples/functions/get.md +++ b/docs/examples/functions/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -12,4 +14,4 @@ const result = await functions.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md index 9f15b95e..bc6291b1 100644 --- a/docs/examples/functions/list-deployments.md +++ b/docs/examples/functions/list-deployments.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -15,4 +17,4 @@ const result = await functions.listDeployments({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index 55aa3cb7..c73e944a 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,9 +1,10 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const functions = new Functions(client); @@ -14,4 +15,4 @@ const result = await functions.listExecutions({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md index 6d879f03..189a1fe3 100644 --- a/docs/examples/functions/list-runtimes.md +++ b/docs/examples/functions/list-runtimes.md @@ -1,13 +1,16 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); const result = await functions.listRuntimes(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md index 19e9a4c5..d777a8f5 100644 --- a/docs/examples/functions/list-specifications.md +++ b/docs/examples/functions/list-specifications.md @@ -1,13 +1,16 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); const result = await functions.listSpecifications(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md index fded4882..7a070c32 100644 --- a/docs/examples/functions/list-variables.md +++ b/docs/examples/functions/list-variables.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -14,4 +16,4 @@ const result = await functions.listVariables({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md index 14ec102a..af3daf03 100644 --- a/docs/examples/functions/list.md +++ b/docs/examples/functions/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -14,4 +16,4 @@ const result = await functions.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md index 1368d478..58e75b59 100644 --- a/docs/examples/functions/update-deployment-status.md +++ b/docs/examples/functions/update-deployment-status.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -13,4 +15,4 @@ const result = await functions.updateDeploymentStatus({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md index b5918fd2..5d1641bb 100644 --- a/docs/examples/functions/update-function-deployment.md +++ b/docs/examples/functions/update-function-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -13,4 +15,4 @@ const result = await functions.updateFunctionDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md index 58f549fe..570ada49 100644 --- a/docs/examples/functions/update-variable.md +++ b/docs/examples/functions/update-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -16,4 +18,4 @@ const result = await functions.updateVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 56394751..f69c9d75 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -1,9 +1,11 @@ ```javascript import { Client, Functions, Runtime, Scopes } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const functions = new Functions(client); @@ -31,4 +33,4 @@ const result = await functions.update({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index a0230ef6..148cc83b 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,9 +1,11 @@ ```javascript import { Client, Graphql } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const graphql = new Graphql(client); @@ -12,4 +14,4 @@ const result = await graphql.mutation({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index bef786ab..cd9acbbc 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,9 +1,11 @@ ```javascript import { Client, Graphql } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const graphql = new Graphql(client); @@ -12,4 +14,4 @@ const result = await graphql.query({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md index 05c6502f..ece01fce 100644 --- a/docs/examples/health/get-antivirus.md +++ b/docs/examples/health/get-antivirus.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.getAntivirus(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md index 1b71eee9..df446b93 100644 --- a/docs/examples/health/get-cache.md +++ b/docs/examples/health/get-cache.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.getCache(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md index 0f20e19e..326f2c59 100644 --- a/docs/examples/health/get-certificate.md +++ b/docs/examples/health/get-certificate.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getCertificate({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md index bca1b45a..40875cf4 100644 --- a/docs/examples/health/get-console-pausing.md +++ b/docs/examples/health/get-console-pausing.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -13,4 +15,4 @@ const result = await health.getConsolePausing({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md index 561b6ab7..81a65c77 100644 --- a/docs/examples/health/get-db.md +++ b/docs/examples/health/get-db.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.getDB(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md index 737c8d8b..263f3a38 100644 --- a/docs/examples/health/get-failed-jobs.md +++ b/docs/examples/health/get-failed-jobs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health, Name } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -13,4 +15,4 @@ const result = await health.getFailedJobs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md index e8244436..7892d241 100644 --- a/docs/examples/health/get-pub-sub.md +++ b/docs/examples/health/get-pub-sub.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.getPubSub(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md index 301446b0..5c56db40 100644 --- a/docs/examples/health/get-queue-audits.md +++ b/docs/examples/health/get-queue-audits.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueAudits({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md index a6b37dd4..7fc7d687 100644 --- a/docs/examples/health/get-queue-builds.md +++ b/docs/examples/health/get-queue-builds.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueBuilds({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md index 60e91f5f..0aa0291a 100644 --- a/docs/examples/health/get-queue-certificates.md +++ b/docs/examples/health/get-queue-certificates.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueCertificates({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md index 23eb2561..ea4c16c9 100644 --- a/docs/examples/health/get-queue-databases.md +++ b/docs/examples/health/get-queue-databases.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -13,4 +15,4 @@ const result = await health.getQueueDatabases({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md index 77d514f2..823a8164 100644 --- a/docs/examples/health/get-queue-deletes.md +++ b/docs/examples/health/get-queue-deletes.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueDeletes({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md index 72a18645..4cf297cd 100644 --- a/docs/examples/health/get-queue-functions.md +++ b/docs/examples/health/get-queue-functions.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueFunctions({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md index 0086f86b..f9d4b76c 100644 --- a/docs/examples/health/get-queue-logs.md +++ b/docs/examples/health/get-queue-logs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md index 7800f23b..daf6643c 100644 --- a/docs/examples/health/get-queue-mails.md +++ b/docs/examples/health/get-queue-mails.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueMails({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md index 408e4016..81435a16 100644 --- a/docs/examples/health/get-queue-messaging.md +++ b/docs/examples/health/get-queue-messaging.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueMessaging({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md index 5bfaf659..e536351e 100644 --- a/docs/examples/health/get-queue-migrations.md +++ b/docs/examples/health/get-queue-migrations.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueMigrations({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-stats-resources.md b/docs/examples/health/get-queue-stats-resources.md index 45999f02..18ff25fb 100644 --- a/docs/examples/health/get-queue-stats-resources.md +++ b/docs/examples/health/get-queue-stats-resources.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueStatsResources({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md index ae90ba51..f19c738f 100644 --- a/docs/examples/health/get-queue-usage.md +++ b/docs/examples/health/get-queue-usage.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueUsage({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md index 461ae283..00b98b99 100644 --- a/docs/examples/health/get-queue-webhooks.md +++ b/docs/examples/health/get-queue-webhooks.md @@ -1,9 +1,11 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); @@ -12,4 +14,4 @@ const result = await health.getQueueWebhooks({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md index 6acb21e2..7c69dd9f 100644 --- a/docs/examples/health/get-storage-local.md +++ b/docs/examples/health/get-storage-local.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.getStorageLocal(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md index 27391b51..d396b75b 100644 --- a/docs/examples/health/get-storage.md +++ b/docs/examples/health/get-storage.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.getStorage(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md index 2727c0b9..1b3a044b 100644 --- a/docs/examples/health/get-time.md +++ b/docs/examples/health/get-time.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.getTime(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md index 5dce8db6..040bd454 100644 --- a/docs/examples/health/get.md +++ b/docs/examples/health/get.md @@ -1,13 +1,16 @@ ```javascript import { Client, Health } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const health = new Health(client); const result = await health.get(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 95e92c4c..3f5672cf 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.get(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index d6e9d33b..fb8d7108 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.listCodes(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index 6af2b7f4..e28b7886 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.listContinents(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index 92b3fa08..972e887a 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.listCountriesEU(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 517a19a3..9104141c 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.listCountriesPhones(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index f92f9985..f0b2e810 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.listCountries(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 50c0f222..6782410d 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.listCurrencies(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index a3afe001..2c118e09 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,13 +1,15 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const locale = new Locale(client); const result = await locale.listLanguages(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md index eeb8f955..f3a9ee79 100644 --- a/docs/examples/messaging/create-apns-provider.md +++ b/docs/examples/messaging/create-apns-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -19,4 +21,4 @@ const result = await messaging.createAPNSProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md index 08b5b0ed..7e3ed5b9 100644 --- a/docs/examples/messaging/create-email.md +++ b/docs/examples/messaging/create-email.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -23,4 +25,4 @@ const result = await messaging.createEmail({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md index 1b3a13a2..4266a02c 100644 --- a/docs/examples/messaging/create-fcm-provider.md +++ b/docs/examples/messaging/create-fcm-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -15,4 +17,4 @@ const result = await messaging.createFCMProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md index 8e231f4b..b531f8ba 100644 --- a/docs/examples/messaging/create-mailgun-provider.md +++ b/docs/examples/messaging/create-mailgun-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -21,4 +23,4 @@ const result = await messaging.createMailgunProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-msg-91-provider.md b/docs/examples/messaging/create-msg-91-provider.md index 65b4493f..ce64f78b 100644 --- a/docs/examples/messaging/create-msg-91-provider.md +++ b/docs/examples/messaging/create-msg-91-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.createMsg91Provider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md index 1daf07b5..6bbbad98 100644 --- a/docs/examples/messaging/create-push.md +++ b/docs/examples/messaging/create-push.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging, MessagePriority } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -30,4 +32,4 @@ const result = await messaging.createPush({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md index 947a9e2c..3c22546a 100644 --- a/docs/examples/messaging/create-resend-provider.md +++ b/docs/examples/messaging/create-resend-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -19,4 +21,4 @@ const result = await messaging.createResendProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md index 05d8eac1..757abe3f 100644 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ b/docs/examples/messaging/create-sendgrid-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -19,4 +21,4 @@ const result = await messaging.createSendgridProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md index b5093eb4..6f8884db 100644 --- a/docs/examples/messaging/create-sms.md +++ b/docs/examples/messaging/create-sms.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -18,4 +20,4 @@ const result = await messaging.createSMS({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md index f94b8cd6..1db9e186 100644 --- a/docs/examples/messaging/create-smtp-provider.md +++ b/docs/examples/messaging/create-smtp-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging, SmtpEncryption } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -25,4 +27,4 @@ const result = await messaging.createSMTPProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index c29c2f71..dafae8dd 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromJWT({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + jwt: '<YOUR_JWT>' // Your secret JSON Web Token +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.createSubscriber({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md index a1ebd717..725dbd73 100644 --- a/docs/examples/messaging/create-telesign-provider.md +++ b/docs/examples/messaging/create-telesign-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.createTelesignProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md index 9f81c7e6..3f6d6fd4 100644 --- a/docs/examples/messaging/create-textmagic-provider.md +++ b/docs/examples/messaging/create-textmagic-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.createTextmagicProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md index fa8b1dad..abcd1729 100644 --- a/docs/examples/messaging/create-topic.md +++ b/docs/examples/messaging/create-topic.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.createTopic({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md index 186cff00..4b67a61e 100644 --- a/docs/examples/messaging/create-twilio-provider.md +++ b/docs/examples/messaging/create-twilio-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.createTwilioProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md index 74fb12d9..f41b1ce7 100644 --- a/docs/examples/messaging/create-vonage-provider.md +++ b/docs/examples/messaging/create-vonage-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.createVonageProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md index 8a371422..77e1c003 100644 --- a/docs/examples/messaging/delete-provider.md +++ b/docs/examples/messaging/delete-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -12,4 +14,4 @@ const result = await messaging.deleteProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index acd0be51..8cac30c1 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromJWT({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + jwt: '<YOUR_JWT>' // Your secret JSON Web Token +}); const messaging = new Messaging(client); @@ -13,4 +15,4 @@ const result = await messaging.deleteSubscriber({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md index 3ef42894..3dc0c076 100644 --- a/docs/examples/messaging/delete-topic.md +++ b/docs/examples/messaging/delete-topic.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -12,4 +14,4 @@ const result = await messaging.deleteTopic({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md index a4f42e5e..d0345472 100644 --- a/docs/examples/messaging/delete.md +++ b/docs/examples/messaging/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -12,4 +14,4 @@ const result = await messaging.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md index 7b10f853..1e216294 100644 --- a/docs/examples/messaging/get-message.md +++ b/docs/examples/messaging/get-message.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -12,4 +14,4 @@ const result = await messaging.getMessage({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md index 54c28480..cbc20a70 100644 --- a/docs/examples/messaging/get-provider.md +++ b/docs/examples/messaging/get-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -12,4 +14,4 @@ const result = await messaging.getProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md index 8363067b..142e9fe3 100644 --- a/docs/examples/messaging/get-subscriber.md +++ b/docs/examples/messaging/get-subscriber.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -13,4 +15,4 @@ const result = await messaging.getSubscriber({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md index 6d6ea170..5eeb2b1c 100644 --- a/docs/examples/messaging/get-topic.md +++ b/docs/examples/messaging/get-topic.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -12,4 +14,4 @@ const result = await messaging.getTopic({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md index cc90cf0b..d0204e6a 100644 --- a/docs/examples/messaging/list-message-logs.md +++ b/docs/examples/messaging/list-message-logs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listMessageLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md index dd451294..ca77d1b2 100644 --- a/docs/examples/messaging/list-messages.md +++ b/docs/examples/messaging/list-messages.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listMessages({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md index cf599a86..41c2a6ff 100644 --- a/docs/examples/messaging/list-provider-logs.md +++ b/docs/examples/messaging/list-provider-logs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listProviderLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md index 243f83fa..13816a92 100644 --- a/docs/examples/messaging/list-providers.md +++ b/docs/examples/messaging/list-providers.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listProviders({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md index eea608b3..0835310b 100644 --- a/docs/examples/messaging/list-subscriber-logs.md +++ b/docs/examples/messaging/list-subscriber-logs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listSubscriberLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md index 2c888eff..0b7c023c 100644 --- a/docs/examples/messaging/list-subscribers.md +++ b/docs/examples/messaging/list-subscribers.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -15,4 +17,4 @@ const result = await messaging.listSubscribers({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md index e99f37a6..572eb068 100644 --- a/docs/examples/messaging/list-targets.md +++ b/docs/examples/messaging/list-targets.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listTargets({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md index 7a057dd0..5a8f97ec 100644 --- a/docs/examples/messaging/list-topic-logs.md +++ b/docs/examples/messaging/list-topic-logs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listTopicLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md index 9b7114e0..608a7421 100644 --- a/docs/examples/messaging/list-topics.md +++ b/docs/examples/messaging/list-topics.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.listTopics({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md index 72a38c0f..2b51ff50 100644 --- a/docs/examples/messaging/update-apns-provider.md +++ b/docs/examples/messaging/update-apns-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -19,4 +21,4 @@ const result = await messaging.updateAPNSProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md index e7ef6af9..909e461d 100644 --- a/docs/examples/messaging/update-email.md +++ b/docs/examples/messaging/update-email.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -23,4 +25,4 @@ const result = await messaging.updateEmail({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md index c941807c..23866d26 100644 --- a/docs/examples/messaging/update-fcm-provider.md +++ b/docs/examples/messaging/update-fcm-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -15,4 +17,4 @@ const result = await messaging.updateFCMProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md index 64b1ef5a..c4284655 100644 --- a/docs/examples/messaging/update-mailgun-provider.md +++ b/docs/examples/messaging/update-mailgun-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -21,4 +23,4 @@ const result = await messaging.updateMailgunProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-msg-91-provider.md b/docs/examples/messaging/update-msg-91-provider.md index 8adf6c85..7910b102 100644 --- a/docs/examples/messaging/update-msg-91-provider.md +++ b/docs/examples/messaging/update-msg-91-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.updateMsg91Provider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md index bb399fdd..c4640c72 100644 --- a/docs/examples/messaging/update-push.md +++ b/docs/examples/messaging/update-push.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging, MessagePriority } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -30,4 +32,4 @@ const result = await messaging.updatePush({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md index 6fe46a37..fd929164 100644 --- a/docs/examples/messaging/update-resend-provider.md +++ b/docs/examples/messaging/update-resend-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -19,4 +21,4 @@ const result = await messaging.updateResendProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md index 67ae148e..6ee6a304 100644 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ b/docs/examples/messaging/update-sendgrid-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -19,4 +21,4 @@ const result = await messaging.updateSendgridProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md index 07624dea..7a0552e7 100644 --- a/docs/examples/messaging/update-sms.md +++ b/docs/examples/messaging/update-sms.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -18,4 +20,4 @@ const result = await messaging.updateSMS({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md index f1f1531d..7158f1cc 100644 --- a/docs/examples/messaging/update-smtp-provider.md +++ b/docs/examples/messaging/update-smtp-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging, SmtpEncryption } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -25,4 +27,4 @@ const result = await messaging.updateSMTPProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md index 03519b79..d5afee0f 100644 --- a/docs/examples/messaging/update-telesign-provider.md +++ b/docs/examples/messaging/update-telesign-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.updateTelesignProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md index 9d29c079..fb320cfc 100644 --- a/docs/examples/messaging/update-textmagic-provider.md +++ b/docs/examples/messaging/update-textmagic-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.updateTextmagicProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md index 307bc143..42634f12 100644 --- a/docs/examples/messaging/update-topic.md +++ b/docs/examples/messaging/update-topic.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -14,4 +16,4 @@ const result = await messaging.updateTopic({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md index 8aebdc79..6d535d2c 100644 --- a/docs/examples/messaging/update-twilio-provider.md +++ b/docs/examples/messaging/update-twilio-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.updateTwilioProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md index 506d29d0..4f9e50cf 100644 --- a/docs/examples/messaging/update-vonage-provider.md +++ b/docs/examples/messaging/update-vonage-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const messaging = new Messaging(client); @@ -17,4 +19,4 @@ const result = await messaging.updateVonageProvider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md index 05d740bb..d9c8f08b 100644 --- a/docs/examples/presences/delete.md +++ b/docs/examples/presences/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Presences } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const presences = new Presences(client); @@ -12,4 +14,4 @@ const result = await presences.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md index dc4f2438..8cf32140 100644 --- a/docs/examples/presences/get.md +++ b/docs/examples/presences/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, Presences } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const presences = new Presences(client); @@ -12,4 +14,4 @@ const result = await presences.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md index 4e7c8762..e299d0bf 100644 --- a/docs/examples/presences/list.md +++ b/docs/examples/presences/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, Presences } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const presences = new Presences(client); @@ -14,4 +16,4 @@ const result = await presences.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update-presence.md index 06dcfdbd..414b1605 100644 --- a/docs/examples/presences/update-presence.md +++ b/docs/examples/presences/update-presence.md @@ -1,9 +1,11 @@ ```javascript import { Client, Presences, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const presences = new Presences(client); @@ -18,4 +20,4 @@ const result = await presences.updatePresence({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/presences/update.md b/docs/examples/presences/update.md deleted file mode 100644 index 79e5aa91..00000000 --- a/docs/examples/presences/update.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Presences, Permission, Role } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const presences = new Presences(client); - -const result = await presences.update({ - presenceId: '<PRESENCE_ID>', - status: '<STATUS>', // optional - expiresAt: '2020-10-15T06:38:00.000+00:00', // optional - metadata: {}, // optional - permissions: [Permission.read(Role.any())], // optional - purge: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md index 7c32bf10..f46a1b81 100644 --- a/docs/examples/presences/upsert.md +++ b/docs/examples/presences/upsert.md @@ -1,9 +1,11 @@ ```javascript import { Client, Presences, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const presences = new Presences(client); @@ -17,4 +19,4 @@ const result = await presences.upsert({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md index 7ea0aef8..3f096cad 100644 --- a/docs/examples/project/create-android-platform.md +++ b/docs/examples/project/create-android-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.createAndroidPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md index a83fc859..de93e850 100644 --- a/docs/examples/project/create-apple-platform.md +++ b/docs/examples/project/create-apple-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.createApplePlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md index 377ac851..b8202643 100644 --- a/docs/examples/project/create-ephemeral-key.md +++ b/docs/examples/project/create-ephemeral-key.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectKeyScopes } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.createEphemeralKey({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md index 0c4dd820..4a54e2ec 100644 --- a/docs/examples/project/create-key.md +++ b/docs/examples/project/create-key.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectKeyScopes } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.createKey({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md index 93103d34..6774a326 100644 --- a/docs/examples/project/create-linux-platform.md +++ b/docs/examples/project/create-linux-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.createLinuxPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md index 918d5853..df5b6bb0 100644 --- a/docs/examples/project/create-mock-phone.md +++ b/docs/examples/project/create-mock-phone.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.createMockPhone({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md index cd0f8ed4..afa6e9b8 100644 --- a/docs/examples/project/create-smtp-test.md +++ b/docs/examples/project/create-smtp-test.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.createSMTPTest({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md index 98a4f66f..e870104a 100644 --- a/docs/examples/project/create-variable.md +++ b/docs/examples/project/create-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.createVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md index d0ddc06a..e92270c8 100644 --- a/docs/examples/project/create-web-platform.md +++ b/docs/examples/project/create-web-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.createWebPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md index c6c220e1..ff1102b3 100644 --- a/docs/examples/project/create-windows-platform.md +++ b/docs/examples/project/create-windows-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.createWindowsPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md index fa9681e1..0a8ab977 100644 --- a/docs/examples/project/delete-key.md +++ b/docs/examples/project/delete-key.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.deleteKey({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md index 5a59358f..76cc6134 100644 --- a/docs/examples/project/delete-mock-phone.md +++ b/docs/examples/project/delete-mock-phone.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.deleteMockPhone({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md index 70562379..898ce212 100644 --- a/docs/examples/project/delete-platform.md +++ b/docs/examples/project/delete-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.deletePlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md index a50b5ae4..36d0d471 100644 --- a/docs/examples/project/delete-variable.md +++ b/docs/examples/project/delete-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.deleteVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md index 757763cc..bf9a5509 100644 --- a/docs/examples/project/delete.md +++ b/docs/examples/project/delete.md @@ -1,13 +1,16 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); const result = await project.delete(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md index 2d1c9e3e..e3797cc4 100644 --- a/docs/examples/project/get-email-template.md +++ b/docs/examples/project/get-email-template.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectEmailTemplateId, ProjectEmailTemplateLocale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.getEmailTemplate({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md index 655569e9..d5dce229 100644 --- a/docs/examples/project/get-key.md +++ b/docs/examples/project/get-key.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.getKey({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md index 6f0b3154..508800b2 100644 --- a/docs/examples/project/get-mock-phone.md +++ b/docs/examples/project/get-mock-phone.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.getMockPhone({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get-o-auth-2-provider.md b/docs/examples/project/get-o-auth-2-provider.md index 4447791a..5484e087 100644 --- a/docs/examples/project/get-o-auth-2-provider.md +++ b/docs/examples/project/get-o-auth-2-provider.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectOAuthProviderId } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.getOAuth2Provider({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md index 908cad46..a49dbd42 100644 --- a/docs/examples/project/get-platform.md +++ b/docs/examples/project/get-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.getPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md index a6a74aef..b8a4e0d8 100644 --- a/docs/examples/project/get-policy.md +++ b/docs/examples/project/get-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectPolicyId } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.getPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md index 53b059c0..111aeee4 100644 --- a/docs/examples/project/get-variable.md +++ b/docs/examples/project/get-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.getVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md index 96bc8614..b84cf264 100644 --- a/docs/examples/project/get.md +++ b/docs/examples/project/get.md @@ -1,13 +1,16 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); const result = await project.get(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md index 6ae1f3c1..fa062e32 100644 --- a/docs/examples/project/list-email-templates.md +++ b/docs/examples/project/list-email-templates.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.listEmailTemplates({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md index c5f521a8..2ba5d8b4 100644 --- a/docs/examples/project/list-keys.md +++ b/docs/examples/project/list-keys.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.listKeys({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md index 3e5d66e7..d4a810ad 100644 --- a/docs/examples/project/list-mock-phones.md +++ b/docs/examples/project/list-mock-phones.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.listMockPhones({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/list-o-auth-2-providers.md b/docs/examples/project/list-o-auth-2-providers.md index 8d8fcc75..112ce8b0 100644 --- a/docs/examples/project/list-o-auth-2-providers.md +++ b/docs/examples/project/list-o-auth-2-providers.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.listOAuth2Providers({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md index b6303317..186a78e7 100644 --- a/docs/examples/project/list-platforms.md +++ b/docs/examples/project/list-platforms.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.listPlatforms({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md index a06943da..14ba8275 100644 --- a/docs/examples/project/list-policies.md +++ b/docs/examples/project/list-policies.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.listPolicies({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md index 6fec55b5..dab8b0f2 100644 --- a/docs/examples/project/list-variables.md +++ b/docs/examples/project/list-variables.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.listVariables({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md index 3fa7dcf8..4085db68 100644 --- a/docs/examples/project/update-android-platform.md +++ b/docs/examples/project/update-android-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateAndroidPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md index e6bf227a..a0d34da0 100644 --- a/docs/examples/project/update-apple-platform.md +++ b/docs/examples/project/update-apple-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateApplePlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md index 68da4b94..bbf06cb6 100644 --- a/docs/examples/project/update-auth-method.md +++ b/docs/examples/project/update-auth-method.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectAuthMethodId } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.updateAuthMethod({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-deny-aliased-email-policy.md b/docs/examples/project/update-deny-aliased-email-policy.md index 0c19b5f9..d84bb4b5 100644 --- a/docs/examples/project/update-deny-aliased-email-policy.md +++ b/docs/examples/project/update-deny-aliased-email-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateDenyAliasedEmailPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-deny-disposable-email-policy.md b/docs/examples/project/update-deny-disposable-email-policy.md index 12706609..dac38b74 100644 --- a/docs/examples/project/update-deny-disposable-email-policy.md +++ b/docs/examples/project/update-deny-disposable-email-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateDenyDisposableEmailPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-deny-free-email-policy.md b/docs/examples/project/update-deny-free-email-policy.md index 19297d98..83325373 100644 --- a/docs/examples/project/update-deny-free-email-policy.md +++ b/docs/examples/project/update-deny-free-email-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateDenyFreeEmailPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md index ae06c888..9c682103 100644 --- a/docs/examples/project/update-email-template.md +++ b/docs/examples/project/update-email-template.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectEmailTemplateId, ProjectEmailTemplateLocale } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -19,4 +21,4 @@ const result = await project.updateEmailTemplate({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md index e926daeb..4b380796 100644 --- a/docs/examples/project/update-key.md +++ b/docs/examples/project/update-key.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectKeyScopes } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateKey({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md index 47a133e8..6cce7088 100644 --- a/docs/examples/project/update-labels.md +++ b/docs/examples/project/update-labels.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateLabels({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md index 2744862e..2f4211f0 100644 --- a/docs/examples/project/update-linux-platform.md +++ b/docs/examples/project/update-linux-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateLinuxPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md index 06ebae70..d3cdb301 100644 --- a/docs/examples/project/update-membership-privacy-policy.md +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -16,4 +18,4 @@ const result = await project.updateMembershipPrivacyPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md index 971173c2..33514c3f 100644 --- a/docs/examples/project/update-mock-phone.md +++ b/docs/examples/project/update-mock-phone.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.updateMockPhone({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-amazon.md b/docs/examples/project/update-o-auth-2-amazon.md index dab2d701..09daa37a 100644 --- a/docs/examples/project/update-o-auth-2-amazon.md +++ b/docs/examples/project/update-o-auth-2-amazon.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Amazon({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-apple.md b/docs/examples/project/update-o-auth-2-apple.md index 948c9a59..d6ea058d 100644 --- a/docs/examples/project/update-o-auth-2-apple.md +++ b/docs/examples/project/update-o-auth-2-apple.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -16,4 +18,4 @@ const result = await project.updateOAuth2Apple({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-auth-0.md b/docs/examples/project/update-o-auth-2-auth-0.md index abde7451..94074de1 100644 --- a/docs/examples/project/update-o-auth-2-auth-0.md +++ b/docs/examples/project/update-o-auth-2-auth-0.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateOAuth2Auth0({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-authentik.md b/docs/examples/project/update-o-auth-2-authentik.md index 41c118bf..ae6e98a2 100644 --- a/docs/examples/project/update-o-auth-2-authentik.md +++ b/docs/examples/project/update-o-auth-2-authentik.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateOAuth2Authentik({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-autodesk.md b/docs/examples/project/update-o-auth-2-autodesk.md index febb558a..20ffa7eb 100644 --- a/docs/examples/project/update-o-auth-2-autodesk.md +++ b/docs/examples/project/update-o-auth-2-autodesk.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Autodesk({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-bitbucket.md b/docs/examples/project/update-o-auth-2-bitbucket.md index f96ea278..f18ee60f 100644 --- a/docs/examples/project/update-o-auth-2-bitbucket.md +++ b/docs/examples/project/update-o-auth-2-bitbucket.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Bitbucket({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-bitly.md b/docs/examples/project/update-o-auth-2-bitly.md index 08cafcd0..a2b5ab43 100644 --- a/docs/examples/project/update-o-auth-2-bitly.md +++ b/docs/examples/project/update-o-auth-2-bitly.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Bitly({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-box.md b/docs/examples/project/update-o-auth-2-box.md index 08221d3d..faa90ebb 100644 --- a/docs/examples/project/update-o-auth-2-box.md +++ b/docs/examples/project/update-o-auth-2-box.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Box({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-dailymotion.md b/docs/examples/project/update-o-auth-2-dailymotion.md index 8a520b29..7761c777 100644 --- a/docs/examples/project/update-o-auth-2-dailymotion.md +++ b/docs/examples/project/update-o-auth-2-dailymotion.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Dailymotion({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-discord.md b/docs/examples/project/update-o-auth-2-discord.md index 5c921ceb..b57537f6 100644 --- a/docs/examples/project/update-o-auth-2-discord.md +++ b/docs/examples/project/update-o-auth-2-discord.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Discord({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-disqus.md b/docs/examples/project/update-o-auth-2-disqus.md index c091a6d0..f6c09048 100644 --- a/docs/examples/project/update-o-auth-2-disqus.md +++ b/docs/examples/project/update-o-auth-2-disqus.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Disqus({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-dropbox.md b/docs/examples/project/update-o-auth-2-dropbox.md index c804af9f..eed52e7a 100644 --- a/docs/examples/project/update-o-auth-2-dropbox.md +++ b/docs/examples/project/update-o-auth-2-dropbox.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Dropbox({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-etsy.md b/docs/examples/project/update-o-auth-2-etsy.md index 8deff628..f5f7e08a 100644 --- a/docs/examples/project/update-o-auth-2-etsy.md +++ b/docs/examples/project/update-o-auth-2-etsy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Etsy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-facebook.md b/docs/examples/project/update-o-auth-2-facebook.md index 74d1534f..de3de217 100644 --- a/docs/examples/project/update-o-auth-2-facebook.md +++ b/docs/examples/project/update-o-auth-2-facebook.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Facebook({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-figma.md b/docs/examples/project/update-o-auth-2-figma.md index 81038e28..a189bb37 100644 --- a/docs/examples/project/update-o-auth-2-figma.md +++ b/docs/examples/project/update-o-auth-2-figma.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Figma({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-fusion-auth.md b/docs/examples/project/update-o-auth-2-fusion-auth.md index 1cb70651..c3791f56 100644 --- a/docs/examples/project/update-o-auth-2-fusion-auth.md +++ b/docs/examples/project/update-o-auth-2-fusion-auth.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateOAuth2FusionAuth({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-git-hub.md b/docs/examples/project/update-o-auth-2-git-hub.md index 16bb06c8..ca91eba7 100644 --- a/docs/examples/project/update-o-auth-2-git-hub.md +++ b/docs/examples/project/update-o-auth-2-git-hub.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2GitHub({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-gitlab.md b/docs/examples/project/update-o-auth-2-gitlab.md index d0c9806b..c10e2440 100644 --- a/docs/examples/project/update-o-auth-2-gitlab.md +++ b/docs/examples/project/update-o-auth-2-gitlab.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateOAuth2Gitlab({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-google.md b/docs/examples/project/update-o-auth-2-google.md index d13a8a45..b271f054 100644 --- a/docs/examples/project/update-o-auth-2-google.md +++ b/docs/examples/project/update-o-auth-2-google.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectOAuth2GooglePrompt } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateOAuth2Google({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-keycloak.md b/docs/examples/project/update-o-auth-2-keycloak.md index 644c8e2e..fc1b49b1 100644 --- a/docs/examples/project/update-o-auth-2-keycloak.md +++ b/docs/examples/project/update-o-auth-2-keycloak.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -16,4 +18,4 @@ const result = await project.updateOAuth2Keycloak({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-kick.md b/docs/examples/project/update-o-auth-2-kick.md index e5e2f559..cf436fd0 100644 --- a/docs/examples/project/update-o-auth-2-kick.md +++ b/docs/examples/project/update-o-auth-2-kick.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Kick({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-linkedin.md b/docs/examples/project/update-o-auth-2-linkedin.md index 884e7110..671fb18d 100644 --- a/docs/examples/project/update-o-auth-2-linkedin.md +++ b/docs/examples/project/update-o-auth-2-linkedin.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Linkedin({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-microsoft.md b/docs/examples/project/update-o-auth-2-microsoft.md index 7cb0676a..52e60174 100644 --- a/docs/examples/project/update-o-auth-2-microsoft.md +++ b/docs/examples/project/update-o-auth-2-microsoft.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateOAuth2Microsoft({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-notion.md b/docs/examples/project/update-o-auth-2-notion.md index fa46c71c..73bd5298 100644 --- a/docs/examples/project/update-o-auth-2-notion.md +++ b/docs/examples/project/update-o-auth-2-notion.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Notion({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-oidc.md b/docs/examples/project/update-o-auth-2-oidc.md index 557c27b9..74f4dae2 100644 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ b/docs/examples/project/update-o-auth-2-oidc.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -18,4 +20,4 @@ const result = await project.updateOAuth2Oidc({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-okta.md b/docs/examples/project/update-o-auth-2-okta.md index b0d3b94f..347ec234 100644 --- a/docs/examples/project/update-o-auth-2-okta.md +++ b/docs/examples/project/update-o-auth-2-okta.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -16,4 +18,4 @@ const result = await project.updateOAuth2Okta({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-paypal-sandbox.md b/docs/examples/project/update-o-auth-2-paypal-sandbox.md index 45e6a7b1..d0578f60 100644 --- a/docs/examples/project/update-o-auth-2-paypal-sandbox.md +++ b/docs/examples/project/update-o-auth-2-paypal-sandbox.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2PaypalSandbox({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-paypal.md b/docs/examples/project/update-o-auth-2-paypal.md index 2a732863..35cd37c2 100644 --- a/docs/examples/project/update-o-auth-2-paypal.md +++ b/docs/examples/project/update-o-auth-2-paypal.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Paypal({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-podio.md b/docs/examples/project/update-o-auth-2-podio.md index 3c0497d9..586ee22c 100644 --- a/docs/examples/project/update-o-auth-2-podio.md +++ b/docs/examples/project/update-o-auth-2-podio.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Podio({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-salesforce.md b/docs/examples/project/update-o-auth-2-salesforce.md index 532733d5..48745326 100644 --- a/docs/examples/project/update-o-auth-2-salesforce.md +++ b/docs/examples/project/update-o-auth-2-salesforce.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Salesforce({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-slack.md b/docs/examples/project/update-o-auth-2-slack.md index 325b644c..a967080b 100644 --- a/docs/examples/project/update-o-auth-2-slack.md +++ b/docs/examples/project/update-o-auth-2-slack.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Slack({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-spotify.md b/docs/examples/project/update-o-auth-2-spotify.md index d1f186b1..8a3bef76 100644 --- a/docs/examples/project/update-o-auth-2-spotify.md +++ b/docs/examples/project/update-o-auth-2-spotify.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Spotify({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-stripe.md b/docs/examples/project/update-o-auth-2-stripe.md index 01413997..5e9b7ae5 100644 --- a/docs/examples/project/update-o-auth-2-stripe.md +++ b/docs/examples/project/update-o-auth-2-stripe.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Stripe({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md index 62a7a899..e8cd802d 100644 --- a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md +++ b/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2TradeshiftSandbox({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-tradeshift.md b/docs/examples/project/update-o-auth-2-tradeshift.md index 646ca091..621dfe57 100644 --- a/docs/examples/project/update-o-auth-2-tradeshift.md +++ b/docs/examples/project/update-o-auth-2-tradeshift.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Tradeshift({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-twitch.md b/docs/examples/project/update-o-auth-2-twitch.md index d641bd65..e8a03d7c 100644 --- a/docs/examples/project/update-o-auth-2-twitch.md +++ b/docs/examples/project/update-o-auth-2-twitch.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Twitch({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-word-press.md b/docs/examples/project/update-o-auth-2-word-press.md index f865a5fc..a0288ba0 100644 --- a/docs/examples/project/update-o-auth-2-word-press.md +++ b/docs/examples/project/update-o-auth-2-word-press.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2WordPress({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-yahoo.md b/docs/examples/project/update-o-auth-2-yahoo.md index 7e9d5279..278effd7 100644 --- a/docs/examples/project/update-o-auth-2-yahoo.md +++ b/docs/examples/project/update-o-auth-2-yahoo.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Yahoo({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-yandex.md b/docs/examples/project/update-o-auth-2-yandex.md index 9e551cf8..7e71873b 100644 --- a/docs/examples/project/update-o-auth-2-yandex.md +++ b/docs/examples/project/update-o-auth-2-yandex.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Yandex({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-zoho.md b/docs/examples/project/update-o-auth-2-zoho.md index ab2cfcd0..681f3286 100644 --- a/docs/examples/project/update-o-auth-2-zoho.md +++ b/docs/examples/project/update-o-auth-2-zoho.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Zoho({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2-zoom.md b/docs/examples/project/update-o-auth-2-zoom.md index fbefecd3..f5741cb6 100644 --- a/docs/examples/project/update-o-auth-2-zoom.md +++ b/docs/examples/project/update-o-auth-2-zoom.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2Zoom({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-o-auth-2x.md b/docs/examples/project/update-o-auth-2x.md index 144b4a8c..10ba341d 100644 --- a/docs/examples/project/update-o-auth-2x.md +++ b/docs/examples/project/update-o-auth-2x.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateOAuth2X({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md index d1083d12..4583f9b5 100644 --- a/docs/examples/project/update-password-dictionary-policy.md +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updatePasswordDictionaryPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md index 22c26817..6fcad2a3 100644 --- a/docs/examples/project/update-password-history-policy.md +++ b/docs/examples/project/update-password-history-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updatePasswordHistoryPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md index e8984f4b..e68fb90d 100644 --- a/docs/examples/project/update-password-personal-data-policy.md +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updatePasswordPersonalDataPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md index 2c278772..132335b7 100644 --- a/docs/examples/project/update-protocol.md +++ b/docs/examples/project/update-protocol.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectProtocolId } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.updateProtocol({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md index d2daa084..283dbc5f 100644 --- a/docs/examples/project/update-service.md +++ b/docs/examples/project/update-service.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectServiceId } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -13,4 +15,4 @@ const result = await project.updateService({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md index 3f04b2c5..fbab3646 100644 --- a/docs/examples/project/update-session-alert-policy.md +++ b/docs/examples/project/update-session-alert-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateSessionAlertPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md index 5a63205e..5e9ce0e1 100644 --- a/docs/examples/project/update-session-duration-policy.md +++ b/docs/examples/project/update-session-duration-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateSessionDurationPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md index 8e5e01ca..62cfd725 100644 --- a/docs/examples/project/update-session-invalidation-policy.md +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateSessionInvalidationPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md index 8b245e29..6dfbf407 100644 --- a/docs/examples/project/update-session-limit-policy.md +++ b/docs/examples/project/update-session-limit-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateSessionLimitPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md index ac68fa13..06811547 100644 --- a/docs/examples/project/update-smtp.md +++ b/docs/examples/project/update-smtp.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project, ProjectSMTPSecure } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -21,4 +23,4 @@ const result = await project.updateSMTP({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md index 89f16441..b35ea1b0 100644 --- a/docs/examples/project/update-user-limit-policy.md +++ b/docs/examples/project/update-user-limit-policy.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -12,4 +14,4 @@ const result = await project.updateUserLimitPolicy({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md index ba9e4391..e82a1cff 100644 --- a/docs/examples/project/update-variable.md +++ b/docs/examples/project/update-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -15,4 +17,4 @@ const result = await project.updateVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md index 832dbfbd..313af63f 100644 --- a/docs/examples/project/update-web-platform.md +++ b/docs/examples/project/update-web-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateWebPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md index 3d0f26b1..bffd26ad 100644 --- a/docs/examples/project/update-windows-platform.md +++ b/docs/examples/project/update-windows-platform.md @@ -1,9 +1,11 @@ ```javascript import { Client, Project } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const project = new Project(client); @@ -14,4 +16,4 @@ const result = await project.updateWindowsPlatform({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md index e7455452..46311715 100644 --- a/docs/examples/proxy/create-api-rule.md +++ b/docs/examples/proxy/create-api-rule.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -12,4 +14,4 @@ const result = await proxy.createAPIRule({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md index 44a93995..0b3bceeb 100644 --- a/docs/examples/proxy/create-function-rule.md +++ b/docs/examples/proxy/create-function-rule.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -14,4 +16,4 @@ const result = await proxy.createFunctionRule({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md index 7caa9c8e..897c377a 100644 --- a/docs/examples/proxy/create-redirect-rule.md +++ b/docs/examples/proxy/create-redirect-rule.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy, StatusCode, ProxyResourceType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -16,4 +18,4 @@ const result = await proxy.createRedirectRule({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md index 02db6911..1b763b07 100644 --- a/docs/examples/proxy/create-site-rule.md +++ b/docs/examples/proxy/create-site-rule.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -14,4 +16,4 @@ const result = await proxy.createSiteRule({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md index 115d78b9..6f6574ae 100644 --- a/docs/examples/proxy/delete-rule.md +++ b/docs/examples/proxy/delete-rule.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -12,4 +14,4 @@ const result = await proxy.deleteRule({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md index 6f52a062..2c82d619 100644 --- a/docs/examples/proxy/get-rule.md +++ b/docs/examples/proxy/get-rule.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -12,4 +14,4 @@ const result = await proxy.getRule({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md index fb993b0d..9bde6f35 100644 --- a/docs/examples/proxy/list-rules.md +++ b/docs/examples/proxy/list-rules.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -13,4 +15,4 @@ const result = await proxy.listRules({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md index 46e579e4..691da2e6 100644 --- a/docs/examples/proxy/update-rule-status.md +++ b/docs/examples/proxy/update-rule-status.md @@ -1,9 +1,11 @@ ```javascript import { Client, Proxy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const proxy = new Proxy(client); @@ -12,4 +14,4 @@ const result = await proxy.updateRuleStatus({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md index cf7ffe9c..e7b110e9 100644 --- a/docs/examples/sites/create-deployment.md +++ b/docs/examples/sites/create-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -17,4 +19,4 @@ const result = await sites.createDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md index d9172798..eb0634c6 100644 --- a/docs/examples/sites/create-duplicate-deployment.md +++ b/docs/examples/sites/create-duplicate-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.createDuplicateDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md index e1ebe775..f0dfcd5e 100644 --- a/docs/examples/sites/create-template-deployment.md +++ b/docs/examples/sites/create-template-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites, TemplateReferenceType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -18,4 +20,4 @@ const result = await sites.createTemplateDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md index 0b7a3fef..5e6171c1 100644 --- a/docs/examples/sites/create-variable.md +++ b/docs/examples/sites/create-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -16,4 +18,4 @@ const result = await sites.createVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md index d58947e9..1411d04d 100644 --- a/docs/examples/sites/create-vcs-deployment.md +++ b/docs/examples/sites/create-vcs-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites, VCSReferenceType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -15,4 +17,4 @@ const result = await sites.createVcsDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md index 85e35285..9996b465 100644 --- a/docs/examples/sites/create.md +++ b/docs/examples/sites/create.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -32,4 +34,4 @@ const result = await sites.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md index a344accd..5b7d9022 100644 --- a/docs/examples/sites/delete-deployment.md +++ b/docs/examples/sites/delete-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.deleteDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md index 65eb61b1..ec504437 100644 --- a/docs/examples/sites/delete-log.md +++ b/docs/examples/sites/delete-log.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.deleteLog({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md index e2297008..e24ab209 100644 --- a/docs/examples/sites/delete-variable.md +++ b/docs/examples/sites/delete-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.deleteVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md index cb6756e2..3a150d44 100644 --- a/docs/examples/sites/delete.md +++ b/docs/examples/sites/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -12,4 +14,4 @@ const result = await sites.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md index badf3a7c..5cb096a8 100644 --- a/docs/examples/sites/get-deployment-download.md +++ b/docs/examples/sites/get-deployment-download.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites, DeploymentDownloadType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -14,4 +16,4 @@ const result = sites.getDeploymentDownload({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md index 6986b429..de537487 100644 --- a/docs/examples/sites/get-deployment.md +++ b/docs/examples/sites/get-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.getDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md index 5a2c590e..044b57a4 100644 --- a/docs/examples/sites/get-log.md +++ b/docs/examples/sites/get-log.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.getLog({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md index e0fbe48e..4f39272d 100644 --- a/docs/examples/sites/get-variable.md +++ b/docs/examples/sites/get-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.getVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md index 012ab9d6..1fd1a3ae 100644 --- a/docs/examples/sites/get.md +++ b/docs/examples/sites/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -12,4 +14,4 @@ const result = await sites.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md index b141b7f7..048faf06 100644 --- a/docs/examples/sites/list-deployments.md +++ b/docs/examples/sites/list-deployments.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -15,4 +17,4 @@ const result = await sites.listDeployments({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md index 13d10fc1..ee21063e 100644 --- a/docs/examples/sites/list-frameworks.md +++ b/docs/examples/sites/list-frameworks.md @@ -1,13 +1,16 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); const result = await sites.listFrameworks(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md index 106aef04..86197692 100644 --- a/docs/examples/sites/list-logs.md +++ b/docs/examples/sites/list-logs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -14,4 +16,4 @@ const result = await sites.listLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md index 26faef89..61c12020 100644 --- a/docs/examples/sites/list-specifications.md +++ b/docs/examples/sites/list-specifications.md @@ -1,13 +1,16 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); const result = await sites.listSpecifications(); + console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md index 31b80257..de936229 100644 --- a/docs/examples/sites/list-variables.md +++ b/docs/examples/sites/list-variables.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -14,4 +16,4 @@ const result = await sites.listVariables({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md index 34f07a29..acdc4c65 100644 --- a/docs/examples/sites/list.md +++ b/docs/examples/sites/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -14,4 +16,4 @@ const result = await sites.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md index 358c4dbb..f9213666 100644 --- a/docs/examples/sites/update-deployment-status.md +++ b/docs/examples/sites/update-deployment-status.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.updateDeploymentStatus({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md index 7388a96b..d70d5693 100644 --- a/docs/examples/sites/update-site-deployment.md +++ b/docs/examples/sites/update-site-deployment.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -13,4 +15,4 @@ const result = await sites.updateSiteDeployment({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md index 62e63991..0ad62555 100644 --- a/docs/examples/sites/update-variable.md +++ b/docs/examples/sites/update-variable.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -16,4 +18,4 @@ const result = await sites.updateVariable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md index 0e925ec1..b47af13c 100644 --- a/docs/examples/sites/update.md +++ b/docs/examples/sites/update.md @@ -1,9 +1,11 @@ ```javascript import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const sites = new Sites(client); @@ -32,4 +34,4 @@ const result = await sites.update({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md index 8908249d..1acc6ea8 100644 --- a/docs/examples/storage/create-bucket.md +++ b/docs/examples/storage/create-bucket.md @@ -1,9 +1,11 @@ ```javascript import { Client, Storage, Compression, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const storage = new Storage(client); @@ -22,4 +24,4 @@ const result = await storage.createBucket({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index b70885b2..def01e51 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -15,4 +16,4 @@ const result = await storage.createFile({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md index 3e87249d..a6ecc7bc 100644 --- a/docs/examples/storage/delete-bucket.md +++ b/docs/examples/storage/delete-bucket.md @@ -1,9 +1,11 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const storage = new Storage(client); @@ -12,4 +14,4 @@ const result = await storage.deleteBucket({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 950003b8..04dd2ea0 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -13,4 +14,4 @@ const result = await storage.deleteFile({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md index 804d20af..fb9dd244 100644 --- a/docs/examples/storage/get-bucket.md +++ b/docs/examples/storage/get-bucket.md @@ -1,9 +1,11 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const storage = new Storage(client); @@ -12,4 +14,4 @@ const result = await storage.getBucket({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 7758c7b4..e6a9666b 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -14,4 +15,4 @@ const result = storage.getFileDownload({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 4d01ef0c..765b771e 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage, ImageGravity, ImageFormat } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -25,4 +26,4 @@ const result = storage.getFilePreview({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 682e947c..f7324027 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -14,4 +15,4 @@ const result = storage.getFileView({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index 82607140..f4a9684c 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -13,4 +14,4 @@ const result = await storage.getFile({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md index a2313243..359c1488 100644 --- a/docs/examples/storage/list-buckets.md +++ b/docs/examples/storage/list-buckets.md @@ -1,9 +1,11 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const storage = new Storage(client); @@ -14,4 +16,4 @@ const result = await storage.listBuckets({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index f2dd2f44..3f12d7a7 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -15,4 +16,4 @@ const result = await storage.listFiles({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md index 974561f4..0c8a35e6 100644 --- a/docs/examples/storage/update-bucket.md +++ b/docs/examples/storage/update-bucket.md @@ -1,9 +1,11 @@ ```javascript import { Client, Storage, Compression, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const storage = new Storage(client); @@ -22,4 +24,4 @@ const result = await storage.updateBucket({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index eef78a1d..e6746ac6 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,9 +1,10 @@ ```javascript import { Client, Storage, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const storage = new Storage(client); @@ -15,4 +16,4 @@ const result = await storage.updateFile({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-big-int-column.md b/docs/examples/tablesdb/create-big-int-column.md index b3c0bd77..3c83ed38 100644 --- a/docs/examples/tablesdb/create-big-int-column.md +++ b/docs/examples/tablesdb/create-big-int-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.createBigIntColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md index 0774f1d1..59c4aff1 100644 --- a/docs/examples/tablesdb/create-boolean-column.md +++ b/docs/examples/tablesdb/create-boolean-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.createBooleanColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md index 6357ae46..293ee77a 100644 --- a/docs/examples/tablesdb/create-datetime-column.md +++ b/docs/examples/tablesdb/create-datetime-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.createDatetimeColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md index 5d83cee6..a3a4b785 100644 --- a/docs/examples/tablesdb/create-email-column.md +++ b/docs/examples/tablesdb/create-email-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.createEmailColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md index 1a3f013b..a5ae2688 100644 --- a/docs/examples/tablesdb/create-enum-column.md +++ b/docs/examples/tablesdb/create-enum-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.createEnumColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md index efc0553d..4d4069e4 100644 --- a/docs/examples/tablesdb/create-float-column.md +++ b/docs/examples/tablesdb/create-float-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.createFloatColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md index ae53bf23..bed2db8a 100644 --- a/docs/examples/tablesdb/create-index.md +++ b/docs/examples/tablesdb/create-index.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB, TablesDBIndexType, OrderBy } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.createIndex({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md index 1bf07163..713fc0c8 100644 --- a/docs/examples/tablesdb/create-integer-column.md +++ b/docs/examples/tablesdb/create-integer-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.createIntegerColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md index 91c877ce..d24e984a 100644 --- a/docs/examples/tablesdb/create-ip-column.md +++ b/docs/examples/tablesdb/create-ip-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.createIpColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md index 0239130e..96d8d2e5 100644 --- a/docs/examples/tablesdb/create-line-column.md +++ b/docs/examples/tablesdb/create-line-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -16,4 +18,4 @@ const result = await tablesDB.createLineColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md index dda9dae5..b6ed98e9 100644 --- a/docs/examples/tablesdb/create-longtext-column.md +++ b/docs/examples/tablesdb/create-longtext-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.createLongtextColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md index c5be8a15..5aa8a8e9 100644 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ b/docs/examples/tablesdb/create-mediumtext-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.createMediumtextColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index 739b4e62..2bcadecc 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -23,4 +25,4 @@ const result = await tablesDB.createOperations({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md index 7a61823c..c3410b4d 100644 --- a/docs/examples/tablesdb/create-point-column.md +++ b/docs/examples/tablesdb/create-point-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -16,4 +18,4 @@ const result = await tablesDB.createPointColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md index fdf5c476..f7a2176d 100644 --- a/docs/examples/tablesdb/create-polygon-column.md +++ b/docs/examples/tablesdb/create-polygon-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -16,4 +18,4 @@ const result = await tablesDB.createPolygonColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md index 412f020d..7fcb22e0 100644 --- a/docs/examples/tablesdb/create-relationship-column.md +++ b/docs/examples/tablesdb/create-relationship-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB, RelationshipType, RelationMutate } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.createRelationshipColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 105c4445..5a1e9648 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -23,4 +24,4 @@ const result = await tablesDB.createRow({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md index fa838105..e859e408 100644 --- a/docs/examples/tablesdb/create-rows.md +++ b/docs/examples/tablesdb/create-rows.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -15,4 +17,4 @@ const result = await tablesDB.createRows({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md index 0032c72a..8cb7260c 100644 --- a/docs/examples/tablesdb/create-string-column.md +++ b/docs/examples/tablesdb/create-string-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.createStringColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md index 064719d4..d914c250 100644 --- a/docs/examples/tablesdb/create-table.md +++ b/docs/examples/tablesdb/create-table.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.createTable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md index 07c96773..8e3ca29e 100644 --- a/docs/examples/tablesdb/create-text-column.md +++ b/docs/examples/tablesdb/create-text-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.createTextColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md index 333eb80e..9e583780 100644 --- a/docs/examples/tablesdb/create-transaction.md +++ b/docs/examples/tablesdb/create-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -12,4 +14,4 @@ const result = await tablesDB.createTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md index 1a619f2c..a1bf60a8 100644 --- a/docs/examples/tablesdb/create-url-column.md +++ b/docs/examples/tablesdb/create-url-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.createUrlColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md index 9d5dbd68..b289ffcb 100644 --- a/docs/examples/tablesdb/create-varchar-column.md +++ b/docs/examples/tablesdb/create-varchar-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.createVarcharColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md index 458d1f6d..f9e738b9 100644 --- a/docs/examples/tablesdb/create.md +++ b/docs/examples/tablesdb/create.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index bad89263..e01bfab2 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -18,4 +19,4 @@ const result = await tablesDB.decrementRowColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md index d61e885b..e669272a 100644 --- a/docs/examples/tablesdb/delete-column.md +++ b/docs/examples/tablesdb/delete-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.deleteColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md index 33229588..6dfe0ae7 100644 --- a/docs/examples/tablesdb/delete-index.md +++ b/docs/examples/tablesdb/delete-index.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.deleteIndex({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index 12663286..ed2d2e15 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -15,4 +16,4 @@ const result = await tablesDB.deleteRow({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md index fe1867cb..4ebcfd7c 100644 --- a/docs/examples/tablesdb/delete-rows.md +++ b/docs/examples/tablesdb/delete-rows.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -15,4 +17,4 @@ const result = await tablesDB.deleteRows({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md index 701ccbb6..465c095f 100644 --- a/docs/examples/tablesdb/delete-table.md +++ b/docs/examples/tablesdb/delete-table.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -13,4 +15,4 @@ const result = await tablesDB.deleteTable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md index 0c98481c..48c71ace 100644 --- a/docs/examples/tablesdb/delete-transaction.md +++ b/docs/examples/tablesdb/delete-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -12,4 +14,4 @@ const result = await tablesDB.deleteTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md index 73a9ec80..7afe4e21 100644 --- a/docs/examples/tablesdb/delete.md +++ b/docs/examples/tablesdb/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -12,4 +14,4 @@ const result = await tablesDB.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md index e3a6c982..b82e1c53 100644 --- a/docs/examples/tablesdb/get-column.md +++ b/docs/examples/tablesdb/get-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.getColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md index d3629791..4e07bd6a 100644 --- a/docs/examples/tablesdb/get-index.md +++ b/docs/examples/tablesdb/get-index.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.getIndex({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 14316385..857ac103 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -16,4 +17,4 @@ const result = await tablesDB.getRow({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md index 828b8f1a..c1b952f7 100644 --- a/docs/examples/tablesdb/get-table.md +++ b/docs/examples/tablesdb/get-table.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -13,4 +15,4 @@ const result = await tablesDB.getTable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md index 00e72497..31ea0081 100644 --- a/docs/examples/tablesdb/get-transaction.md +++ b/docs/examples/tablesdb/get-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -12,4 +14,4 @@ const result = await tablesDB.getTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md index f1623964..68440bef 100644 --- a/docs/examples/tablesdb/get.md +++ b/docs/examples/tablesdb/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -12,4 +14,4 @@ const result = await tablesDB.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index 2fa3354b..b99a3467 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -18,4 +19,4 @@ const result = await tablesDB.incrementRowColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md index 68aa5218..d86132b8 100644 --- a/docs/examples/tablesdb/list-columns.md +++ b/docs/examples/tablesdb/list-columns.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -15,4 +17,4 @@ const result = await tablesDB.listColumns({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md index 41430a18..502c45b4 100644 --- a/docs/examples/tablesdb/list-indexes.md +++ b/docs/examples/tablesdb/list-indexes.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -15,4 +17,4 @@ const result = await tablesDB.listIndexes({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index 455ec6fe..ea8b3285 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -17,4 +18,4 @@ const result = await tablesDB.listRows({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md index f224cecc..837210b7 100644 --- a/docs/examples/tablesdb/list-tables.md +++ b/docs/examples/tablesdb/list-tables.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -15,4 +17,4 @@ const result = await tablesDB.listTables({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index b6448518..d03ca38a 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -12,4 +14,4 @@ const result = await tablesDB.listTransactions({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md index 86908f75..eb207449 100644 --- a/docs/examples/tablesdb/list.md +++ b/docs/examples/tablesdb/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-big-int-column.md b/docs/examples/tablesdb/update-big-int-column.md index 25cdbba3..5616f1ce 100644 --- a/docs/examples/tablesdb/update-big-int-column.md +++ b/docs/examples/tablesdb/update-big-int-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.updateBigIntColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index a5c66a01..eb7fd44c 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateBooleanColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index af608bbc..08519fba 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateDatetimeColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 2a53e577..c1bbb80d 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateEmailColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index 873d7e03..f65b2d01 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.updateEnumColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index 97d1ac7c..55f7591c 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.updateFloatColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 377b1c8c..6a383878 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -19,4 +21,4 @@ const result = await tablesDB.updateIntegerColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index c45e95fb..5c9b780b 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateIpColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md index 1d6e7a46..e1a9c156 100644 --- a/docs/examples/tablesdb/update-line-column.md +++ b/docs/examples/tablesdb/update-line-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateLineColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md index 61b1ae88..241f9c6f 100644 --- a/docs/examples/tablesdb/update-longtext-column.md +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateLongtextColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md index 99174099..d991e312 100644 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateMediumtextColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md index 186b6ff0..73a3ca39 100644 --- a/docs/examples/tablesdb/update-point-column.md +++ b/docs/examples/tablesdb/update-point-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updatePointColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md index 18f1aabb..c9ca14df 100644 --- a/docs/examples/tablesdb/update-polygon-column.md +++ b/docs/examples/tablesdb/update-polygon-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updatePolygonColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md index fde78015..f6161a32 100644 --- a/docs/examples/tablesdb/update-relationship-column.md +++ b/docs/examples/tablesdb/update-relationship-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB, RelationMutate } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -16,4 +18,4 @@ const result = await tablesDB.updateRelationshipColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 77a775b3..1e3bfc99 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -23,4 +24,4 @@ const result = await tablesDB.updateRow({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md index 8e2bca2d..f8aed083 100644 --- a/docs/examples/tablesdb/update-rows.md +++ b/docs/examples/tablesdb/update-rows.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -22,4 +24,4 @@ const result = await tablesDB.updateRows({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index f2d493b6..19862ca3 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.updateStringColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md index af4068d8..85f2d597 100644 --- a/docs/examples/tablesdb/update-table.md +++ b/docs/examples/tablesdb/update-table.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.updateTable({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md index 208c044e..5b967ad5 100644 --- a/docs/examples/tablesdb/update-text-column.md +++ b/docs/examples/tablesdb/update-text-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateTextColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md index 80a8b89d..1f6458f4 100644 --- a/docs/examples/tablesdb/update-transaction.md +++ b/docs/examples/tablesdb/update-transaction.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.updateTransaction({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index 1af088c8..2b41777c 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -17,4 +19,4 @@ const result = await tablesDB.updateUrlColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md index d387b934..8260666d 100644 --- a/docs/examples/tablesdb/update-varchar-column.md +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -18,4 +20,4 @@ const result = await tablesDB.updateVarcharColumn({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md index f0a8a2f7..dd960cea 100644 --- a/docs/examples/tablesdb/update.md +++ b/docs/examples/tablesdb/update.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -14,4 +16,4 @@ const result = await tablesDB.update({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index fb971043..089c159c 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -1,9 +1,10 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const tablesDB = new TablesDB(client); @@ -23,4 +24,4 @@ const result = await tablesDB.upsertRow({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md index a01aca2e..5a16ecf5 100644 --- a/docs/examples/tablesdb/upsert-rows.md +++ b/docs/examples/tablesdb/upsert-rows.md @@ -1,9 +1,11 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tablesDB = new TablesDB(client); @@ -15,4 +17,4 @@ const result = await tablesDB.upsertRows({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 5a23e078..54ccc60c 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -18,4 +19,4 @@ const result = await teams.createMembership({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index 2c72bcdf..cc4e6a09 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -14,4 +15,4 @@ const result = await teams.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index 2fe13278..ea863645 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -13,4 +14,4 @@ const result = await teams.deleteMembership({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 054e34ef..1ab84f9b 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -12,4 +13,4 @@ const result = await teams.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index bdd6c784..f5268722 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -13,4 +14,4 @@ const result = await teams.getMembership({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index bf20ed47..1615a560 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -12,4 +13,4 @@ const result = await teams.getPrefs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 836a8e08..0c59f33c 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -12,4 +13,4 @@ const result = await teams.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index fd3fcd30..5f43a8f0 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -15,4 +16,4 @@ const result = await teams.listMemberships({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index 3406925f..ed733995 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -14,4 +15,4 @@ const result = await teams.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 2ca1c62d..95ac2e27 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -15,4 +16,4 @@ const result = await teams.updateMembershipStatus({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index ecfd1bc8..86f7ac57 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -14,4 +15,4 @@ const result = await teams.updateMembership({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index dce11078..dfe7d489 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -13,4 +14,4 @@ const result = await teams.updateName({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index 2c8a15a1..b04e4c18 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,9 +1,10 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.from({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>' // Your project ID +}); const teams = new Teams(client); @@ -13,4 +14,4 @@ const result = await teams.updatePrefs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md index 40061e71..dd4b2a76 100644 --- a/docs/examples/tokens/create-file-token.md +++ b/docs/examples/tokens/create-file-token.md @@ -1,9 +1,11 @@ ```javascript import { Client, Tokens } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tokens = new Tokens(client); @@ -14,4 +16,4 @@ const result = await tokens.createFileToken({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md index 448d2aa7..351badd0 100644 --- a/docs/examples/tokens/delete.md +++ b/docs/examples/tokens/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Tokens } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tokens = new Tokens(client); @@ -12,4 +14,4 @@ const result = await tokens.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md index 257f81f9..e538874a 100644 --- a/docs/examples/tokens/get.md +++ b/docs/examples/tokens/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, Tokens } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tokens = new Tokens(client); @@ -12,4 +14,4 @@ const result = await tokens.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md index ac836baa..e9002f8b 100644 --- a/docs/examples/tokens/list.md +++ b/docs/examples/tokens/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, Tokens } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tokens = new Tokens(client); @@ -15,4 +17,4 @@ const result = await tokens.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md index b2284219..49e6955a 100644 --- a/docs/examples/tokens/update.md +++ b/docs/examples/tokens/update.md @@ -1,9 +1,11 @@ ```javascript import { Client, Tokens } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const tokens = new Tokens(client); @@ -13,4 +15,4 @@ const result = await tokens.update({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md index 8b3b8559..bc6c2726 100644 --- a/docs/examples/usage/list-events.md +++ b/docs/examples/usage/list-events.md @@ -1,9 +1,11 @@ ```javascript import { Client, Usage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const usage = new Usage(client); @@ -13,4 +15,4 @@ const result = await usage.listEvents({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md index 9a2e97f4..0d3c8a2c 100644 --- a/docs/examples/usage/list-gauges.md +++ b/docs/examples/usage/list-gauges.md @@ -1,9 +1,11 @@ ```javascript import { Client, Usage } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const usage = new Usage(client); @@ -13,4 +15,4 @@ const result = await usage.listGauges({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-argon-2-user.md b/docs/examples/users/create-argon-2-user.md index fd77c87d..9268586d 100644 --- a/docs/examples/users/create-argon-2-user.md +++ b/docs/examples/users/create-argon-2-user.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -15,4 +17,4 @@ const result = await users.createArgon2User({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md index 4f283be0..ef733636 100644 --- a/docs/examples/users/create-bcrypt-user.md +++ b/docs/examples/users/create-bcrypt-user.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -15,4 +17,4 @@ const result = await users.createBcryptUser({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md index 07a17be6..94104431 100644 --- a/docs/examples/users/create-jwt.md +++ b/docs/examples/users/create-jwt.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -14,4 +16,4 @@ const result = await users.createJWT({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-md-5-user.md b/docs/examples/users/create-md-5-user.md index 851d9fc9..36b691af 100644 --- a/docs/examples/users/create-md-5-user.md +++ b/docs/examples/users/create-md-5-user.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -15,4 +17,4 @@ const result = await users.createMD5User({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-mfa-recovery-codes.md b/docs/examples/users/create-mfa-recovery-codes.md index af94a61c..f6c02914 100644 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ b/docs/examples/users/create-mfa-recovery-codes.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.createMFARecoveryCodes({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-ph-pass-user.md b/docs/examples/users/create-ph-pass-user.md index f7464853..747194e1 100644 --- a/docs/examples/users/create-ph-pass-user.md +++ b/docs/examples/users/create-ph-pass-user.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -15,4 +17,4 @@ const result = await users.createPHPassUser({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-modified-user.md b/docs/examples/users/create-scrypt-modified-user.md index 2a783bab..ecf9c6b7 100644 --- a/docs/examples/users/create-scrypt-modified-user.md +++ b/docs/examples/users/create-scrypt-modified-user.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -18,4 +20,4 @@ const result = await users.createScryptModifiedUser({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md index 808539b0..4a2545b1 100644 --- a/docs/examples/users/create-scrypt-user.md +++ b/docs/examples/users/create-scrypt-user.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -20,4 +22,4 @@ const result = await users.createScryptUser({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md index db9f0202..b55a5ef9 100644 --- a/docs/examples/users/create-session.md +++ b/docs/examples/users/create-session.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.createSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md index c3d7fbbd..e1053617 100644 --- a/docs/examples/users/create-sha-user.md +++ b/docs/examples/users/create-sha-user.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users, PasswordHash } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -16,4 +18,4 @@ const result = await users.createSHAUser({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md index b62723ce..944ffaba 100644 --- a/docs/examples/users/create-target.md +++ b/docs/examples/users/create-target.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users, MessagingProviderType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -17,4 +19,4 @@ const result = await users.createTarget({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md index 39d85e57..0a7ab988 100644 --- a/docs/examples/users/create-token.md +++ b/docs/examples/users/create-token.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -14,4 +16,4 @@ const result = await users.createToken({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md index ae89fb9f..713af3a8 100644 --- a/docs/examples/users/create.md +++ b/docs/examples/users/create.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -16,4 +18,4 @@ const result = await users.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md index 595d3d9b..25af7d8e 100644 --- a/docs/examples/users/delete-identity.md +++ b/docs/examples/users/delete-identity.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.deleteIdentity({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md index 5cbc46e5..559bb51d 100644 --- a/docs/examples/users/delete-mfa-authenticator.md +++ b/docs/examples/users/delete-mfa-authenticator.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users, AuthenticatorType } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.deleteMFAAuthenticator({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md index 49ccaf42..ffe52dcf 100644 --- a/docs/examples/users/delete-session.md +++ b/docs/examples/users/delete-session.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.deleteSession({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md index 7ba6f4fd..8b6fc849 100644 --- a/docs/examples/users/delete-sessions.md +++ b/docs/examples/users/delete-sessions.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.deleteSessions({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md index 3e0eb547..f5ddb2d2 100644 --- a/docs/examples/users/delete-target.md +++ b/docs/examples/users/delete-target.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.deleteTarget({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md index 82974a00..b18920b2 100644 --- a/docs/examples/users/delete.md +++ b/docs/examples/users/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/get-mfa-recovery-codes.md b/docs/examples/users/get-mfa-recovery-codes.md index cdc0905b..109eb94e 100644 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ b/docs/examples/users/get-mfa-recovery-codes.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.getMFARecoveryCodes({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md index f5f8df30..6f186ea3 100644 --- a/docs/examples/users/get-prefs.md +++ b/docs/examples/users/get-prefs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.getPrefs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md index 4426de45..a39832fb 100644 --- a/docs/examples/users/get-target.md +++ b/docs/examples/users/get-target.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.getTarget({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md index a3aa0246..03ef3552 100644 --- a/docs/examples/users/get.md +++ b/docs/examples/users/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md index f3500c6e..3c938d41 100644 --- a/docs/examples/users/list-identities.md +++ b/docs/examples/users/list-identities.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -14,4 +16,4 @@ const result = await users.listIdentities({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md index 58516305..3ae2a3ea 100644 --- a/docs/examples/users/list-logs.md +++ b/docs/examples/users/list-logs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -14,4 +16,4 @@ const result = await users.listLogs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md index 07d7e782..4ff9564e 100644 --- a/docs/examples/users/list-memberships.md +++ b/docs/examples/users/list-memberships.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -15,4 +17,4 @@ const result = await users.listMemberships({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md index 2e2e23ab..76a63f84 100644 --- a/docs/examples/users/list-mfa-factors.md +++ b/docs/examples/users/list-mfa-factors.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.listMFAFactors({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md index f5f1d7df..21b6cbd7 100644 --- a/docs/examples/users/list-sessions.md +++ b/docs/examples/users/list-sessions.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.listSessions({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md index 38276a41..c3422d06 100644 --- a/docs/examples/users/list-targets.md +++ b/docs/examples/users/list-targets.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -14,4 +16,4 @@ const result = await users.listTargets({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md index 10f14129..7cec3874 100644 --- a/docs/examples/users/list.md +++ b/docs/examples/users/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -14,4 +16,4 @@ const result = await users.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md index 41cc7818..70c6e061 100644 --- a/docs/examples/users/update-email-verification.md +++ b/docs/examples/users/update-email-verification.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updateEmailVerification({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md index 26f56f62..888db49e 100644 --- a/docs/examples/users/update-email.md +++ b/docs/examples/users/update-email.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updateEmail({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md index 917cd1f7..40f37765 100644 --- a/docs/examples/users/update-impersonator.md +++ b/docs/examples/users/update-impersonator.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updateImpersonator({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md index 5754ca2e..1924283c 100644 --- a/docs/examples/users/update-labels.md +++ b/docs/examples/users/update-labels.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updateLabels({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-mfa-recovery-codes.md b/docs/examples/users/update-mfa-recovery-codes.md index 480b73ab..ddf0faa4 100644 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ b/docs/examples/users/update-mfa-recovery-codes.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -12,4 +14,4 @@ const result = await users.updateMFARecoveryCodes({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md index 8bdcab01..57856c5e 100644 --- a/docs/examples/users/update-mfa.md +++ b/docs/examples/users/update-mfa.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updateMFA({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md index 5462a36d..34ad4fb9 100644 --- a/docs/examples/users/update-name.md +++ b/docs/examples/users/update-name.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updateName({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md index 62915d50..320c9fc3 100644 --- a/docs/examples/users/update-password.md +++ b/docs/examples/users/update-password.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updatePassword({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md index 882cc511..1b7f3838 100644 --- a/docs/examples/users/update-phone-verification.md +++ b/docs/examples/users/update-phone-verification.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updatePhoneVerification({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md index 8b367e9a..42327936 100644 --- a/docs/examples/users/update-phone.md +++ b/docs/examples/users/update-phone.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updatePhone({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md index 89f38d33..a817fb9d 100644 --- a/docs/examples/users/update-prefs.md +++ b/docs/examples/users/update-prefs.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updatePrefs({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md index c9e583b2..ccfeb591 100644 --- a/docs/examples/users/update-status.md +++ b/docs/examples/users/update-status.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -13,4 +15,4 @@ const result = await users.updateStatus({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md index 76868514..77cbbe6b 100644 --- a/docs/examples/users/update-target.md +++ b/docs/examples/users/update-target.md @@ -1,9 +1,11 @@ ```javascript import { Client, Users } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const users = new Users(client); @@ -16,4 +18,4 @@ const result = await users.updateTarget({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md index d5d87086..6dd24b3c 100644 --- a/docs/examples/webhooks/create.md +++ b/docs/examples/webhooks/create.md @@ -1,9 +1,11 @@ ```javascript import { Client, Webhooks } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const webhooks = new Webhooks(client); @@ -20,4 +22,4 @@ const result = await webhooks.create({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md index d80acfbd..1d7ee085 100644 --- a/docs/examples/webhooks/delete.md +++ b/docs/examples/webhooks/delete.md @@ -1,9 +1,11 @@ ```javascript import { Client, Webhooks } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const webhooks = new Webhooks(client); @@ -12,4 +14,4 @@ const result = await webhooks.delete({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md index 5d737d5e..6d9e603a 100644 --- a/docs/examples/webhooks/get.md +++ b/docs/examples/webhooks/get.md @@ -1,9 +1,11 @@ ```javascript import { Client, Webhooks } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const webhooks = new Webhooks(client); @@ -12,4 +14,4 @@ const result = await webhooks.get({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md index 282d3546..5411b8b2 100644 --- a/docs/examples/webhooks/list.md +++ b/docs/examples/webhooks/list.md @@ -1,9 +1,11 @@ ```javascript import { Client, Webhooks } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const webhooks = new Webhooks(client); @@ -13,4 +15,4 @@ const result = await webhooks.list({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md index 7736f73c..cd83ccd5 100644 --- a/docs/examples/webhooks/update-secret.md +++ b/docs/examples/webhooks/update-secret.md @@ -1,9 +1,11 @@ ```javascript import { Client, Webhooks } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const webhooks = new Webhooks(client); @@ -13,4 +15,4 @@ const result = await webhooks.updateSecret({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md index 2dad3865..a30dc425 100644 --- a/docs/examples/webhooks/update.md +++ b/docs/examples/webhooks/update.md @@ -1,9 +1,11 @@ ```javascript import { Client, Webhooks } from "appwrite"; -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID +const client = Client.fromAPIKey({ + endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint + projectId: '<YOUR_PROJECT_ID>', // Your project ID + apiKey: '<YOUR_API_KEY>' // Your secret API key +}); const webhooks = new Webhooks(client); @@ -19,4 +21,4 @@ const result = await webhooks.update({ }); console.log(result); -``` +``` \ No newline at end of file diff --git a/src/client.ts b/src/client.ts index 38a1ac44..0ca6c4ed 100644 --- a/src/client.ts +++ b/src/client.ts @@ -394,31 +394,31 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { endpoint: string; endpointRealtime: string; project: string; + key: string; jwt: string; locale: string; session: string; + forwardeduseragent: string; devkey: string; cookie: string; impersonateuserid: string; impersonateuseremail: string; impersonateuserphone: string; - key: string; - forwardeduseragent: string; selfSigned: boolean; } = { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', project: '', + key: '', jwt: '', locale: '', session: '', + forwardeduseragent: '', devkey: '', cookie: '', impersonateuserid: '', impersonateuseremail: '', impersonateuserphone: '', - key: '', - forwardeduseragent: '', selfSigned: false, }; @@ -630,6 +630,15 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { return this as unknown as this; } + /** + * @deprecated Use a static client factory or factory params object instead. + */ + setKey(value: string): ClientRuntime<'apiKey'> { + this.headers['X-Appwrite-Key'] = value; + this.config.key = value; + return this as unknown as ClientRuntime<'apiKey'>; + } + /** * @deprecated Use a static client factory or factory params object instead. */ @@ -657,6 +666,15 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { return this as unknown as ClientRuntime<'session'>; } + /** + * @deprecated Use a static client factory or factory params object instead. + */ + setForwardedUserAgent(value: string): this { + this.headers['X-Forwarded-User-Agent'] = value; + this.config.forwardeduseragent = value; + return this as unknown as this; + } + /** * @deprecated Use a static client factory or factory params object instead. */ @@ -702,24 +720,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { return this as unknown as ClientRuntime<'impersonation'>; } - /** - * @deprecated Use a static client factory or factory params object instead. - */ - setKey(value: string): ClientRuntime<'apiKey'> { - this.headers['X-Appwrite-Key'] = value; - this.config.key = value; - return this as unknown as ClientRuntime<'apiKey'>; - } - - /** - * @deprecated Use a static client factory or factory params object instead. - */ - setForwardedUserAgent(value: string): this { - this.headers['X-Forwarded-User-Agent'] = value; - this.config.forwardeduseragent = value; - return this as unknown as this; - } - private realtime: Realtime = { socket: undefined, diff --git a/src/models.ts b/src/models.ts index 404dc453..de934950 100644 --- a/src/models.ts +++ b/src/models.ts @@ -4214,7 +4214,7 @@ export namespace Models { /** * Billing limits reached */ - billingLimits: BillingLimits; + billingLimits?: BillingLimits; /** * Project blocks information */ @@ -6764,35 +6764,35 @@ export namespace Models { /** * Bandwidth limit */ - bandwidth: number; + bandwidth?: number; /** * Storage limit */ - storage: number; + storage?: number; /** * Users limit */ - users: number; + users?: number; /** * Executions limit */ - executions: number; + executions?: number; /** * GBHours limit */ - GBHours: number; + GBHours?: number; /** * Image transformations limit */ - imageTransformations: number; + imageTransformations?: number; /** * Auth phone limit */ - authPhone: number; + authPhone?: number; /** * Budget limit percentage */ - budgetLimit: number; + budgetLimit?: number; } /** diff --git a/src/services/account.ts b/src/services/account.ts index 0a9985fa..73ffcf7b 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1941,6 +1941,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -2693,6 +2694,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); diff --git a/src/services/avatars.ts b/src/services/avatars.ts index 5e91655e..a84754a5 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -97,6 +97,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -177,6 +178,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -236,6 +238,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -316,6 +319,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -394,6 +398,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -478,6 +483,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -557,6 +563,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -754,6 +761,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); diff --git a/src/services/functions.ts b/src/services/functions.ts index 00e2e474..ff6e7aa9 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1308,6 +1308,7 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); diff --git a/src/services/presences.ts b/src/services/presences.ts index 6ea7b001..d9ba50f5 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -3,7 +3,7 @@ import type { Models } from '../models'; type PresencesServerOnlyMethod = never; -type PresencesClientOnlyMethod = 'upsert' | 'update' | 'updatePresence'; +type PresencesClientOnlyMethod = 'upsert' | 'updatePresence'; export type Presences<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = TAuth extends ClientAuth @@ -140,92 +140,6 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } - /** - * Create or update a presence log by its user ID. - * - * - * @param {string} params.presenceId - Presence unique 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>(this: Presences<ClientAuth>, params: { presenceId: 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} 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>(this: Presences<ClientAuth>, presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Presence>; - upsert<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, - ...rest: [(string)?, (string[])?, (string)?, (object)?] - ): Promise<Presence> { - let params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }; - } else { - params = { - presenceId: paramsOrFirst as string, - status: rest[0] as string, - permissions: rest[1] as string[], - expiresAt: rest[2] as string, - metadata: rest[3] as object - }; - } - - const presenceId = params.presenceId; - 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 status === 'undefined') { - throw new AppwriteException('Missing required parameter: "status"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - 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 - ); - } - /** * Create or update a presence log by its user ID. * @@ -322,96 +236,6 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } - /** - * 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.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>} - */ - update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, params: { presenceId: 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} 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. - */ - update<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Presence>; - update<Presence extends Models.Presence = Models.DefaultPresence>( - paramsOrFirst: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, - ...rest: [(string)?, (string)?, (object)?, (string[])?, (boolean)?] - ): Promise<Presence> { - let params: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }; - } else { - params = { - presenceId: paramsOrFirst as string, - status: rest[0] as string, - expiresAt: rest[1] as string, - metadata: rest[2] as object, - permissions: rest[3] as string[], - purge: rest[4] as boolean - }; - } - - const presenceId = params.presenceId; - 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"'); - } - - const apiPath = '/presences/{presenceId}'.replace('{presenceId}', presenceId); - const payload: Payload = {}; - 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 - ); - } - /** * Update a presence log by its unique ID. Using the patch method you can pass only specific fields that will get updated. * diff --git a/src/services/sites.ts b/src/services/sites.ts index 1c2869e3..5e3827af 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -1307,6 +1307,7 @@ class SitesRuntime { } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); diff --git a/src/services/storage.ts b/src/services/storage.ts index fe671549..4a3f12d4 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -870,6 +870,7 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1014,6 +1015,7 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); @@ -1081,6 +1083,7 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server } payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); From fda0d745f7a6caf841c0d30f08661dd1256f21c3 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Wed, 20 May 2026 15:22:35 +0530 Subject: [PATCH 04/12] chore: update Web SDK to 26.0.0 --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cc95c9f..28da3cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,22 @@ * Added: Static factory constructors `Client.from`, `Client.fromSession`, `Client.fromAPIKey`, `Client.fromCookie`, `Client.fromJWT`, `Client.fromDevKey`, and `Client.fromImpersonation` * Added: Server-side auth via `apiKey`, `cookie`, and `jwt` factories * Added: Admin and server-only endpoints (`Users`, `Projects`, function and site deployments, storage buckets, and more) +* Breaking: Renamed `Presences.update` to `Presences.updatePresence` +* Breaking: `Presences.upsert` and `Presences.updatePresence` now require a `userId` parameter * Deprecated: `new Client()` constructor and `setEndpoint`/`setProject`/setter pattern remain for backwards compatibility but are now marked deprecated +### Migration + +```ts +// Before (25.x) +await presences.upsert(presenceId, status); +await presences.update(presenceId, status); + +// After (26.0.0) +await presences.upsert(presenceId, userId, status); +await presences.updatePresence(presenceId, userId, status); +``` + ## 25.1.1 * Fixed: Removed `Advisor` service and `Insight`, `InsightCTA`, `InsightList`, `Report`, `ReportList` models (admin-only endpoints, not intended for client SDKs) From 1c5722f61a2c903d7efaf51e6501f32badc7400a Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Wed, 20 May 2026 16:41:37 +0530 Subject: [PATCH 05/12] chore: update Web SDK to 26.0.0 --- src/client.ts | 4 ++-- src/services/account.ts | 6 ------ src/services/avatars.ts | 24 ------------------------ src/services/functions.ts | 21 ++++++++++++--------- src/services/sites.ts | 21 ++++++++++++--------- src/services/storage.ts | 9 --------- 6 files changed, 26 insertions(+), 59 deletions(-) diff --git a/src/client.ts b/src/client.ts index 0ca6c4ed..ab486cd0 100644 --- a/src/client.ts +++ b/src/client.ts @@ -422,14 +422,14 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { selfSigned: false, }; - private sdkPlatform: SDKPlatform = 'server'; + private sdkPlatform: SDKPlatform = 'client'; /** * Custom headers for API requests. */ headers: Headers = { 'x-sdk-name': 'Web', - 'x-sdk-platform': 'server', + 'x-sdk-platform': 'client', 'x-sdk-language': 'web', 'x-sdk-version': '26.0.0', 'X-Appwrite-Response-Format': '1.9.5', diff --git a/src/services/account.ts b/src/services/account.ts index 73ffcf7b..d30034aa 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1940,9 +1940,6 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -2693,9 +2690,6 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } diff --git a/src/services/avatars.ts b/src/services/avatars.ts index a84754a5..abb05d15 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -96,9 +96,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -177,9 +174,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -237,9 +231,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -318,9 +309,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -397,9 +385,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -482,9 +467,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -562,9 +544,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -760,9 +739,6 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } diff --git a/src/services/functions.ts b/src/services/functions.ts index ff6e7aa9..d05aea47 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1256,9 +1256,9 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @param {string} params.deploymentId - Deployment ID. * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". * @throws {AppwriteException} - * @returns {string} + * @returns {Promise<ArrayBuffer>} */ - getDeploymentDownload(this: Functions<ServerAuth>, params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }): string; + getDeploymentDownload(this: Functions<ServerAuth>, 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. * @@ -1266,14 +1266,14 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @param {string} deploymentId - Deployment ID. * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". * @throws {AppwriteException} - * @returns {string} + * @returns {Promise<ArrayBuffer>} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeploymentDownload(this: Functions<ServerAuth>, functionId: string, deploymentId: string, type?: DeploymentDownloadType): string; + getDeploymentDownload(this: Functions<ServerAuth>, functionId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>; getDeploymentDownload( paramsOrFirst: { functionId: string, deploymentId: string, type?: DeploymentDownloadType } | string, ...rest: [(string)?, (DeploymentDownloadType)?] - ): string { + ): Promise<ArrayBuffer> { let params: { functionId: string, deploymentId: string, type?: DeploymentDownloadType }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -1307,14 +1307,17 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); } /** diff --git a/src/services/sites.ts b/src/services/sites.ts index 5e3827af..ebd34c22 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -1255,9 +1255,9 @@ class SitesRuntime { * @param {string} params.deploymentId - Deployment ID. * @param {DeploymentDownloadType} params.type - Deployment file to download. Can be: "source", "output". * @throws {AppwriteException} - * @returns {string} + * @returns {Promise<ArrayBuffer>} */ - getDeploymentDownload(params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }): string; + 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. * @@ -1265,14 +1265,14 @@ class SitesRuntime { * @param {string} deploymentId - Deployment ID. * @param {DeploymentDownloadType} type - Deployment file to download. Can be: "source", "output". * @throws {AppwriteException} - * @returns {string} + * @returns {Promise<ArrayBuffer>} * @deprecated Use the object parameter style method for a better developer experience. */ - getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): string; + getDeploymentDownload(siteId: string, deploymentId: string, type?: DeploymentDownloadType): Promise<ArrayBuffer>; getDeploymentDownload( paramsOrFirst: { siteId: string, deploymentId: string, type?: DeploymentDownloadType } | string, ...rest: [(string)?, (DeploymentDownloadType)?] - ): string { + ): Promise<ArrayBuffer> { let params: { siteId: string, deploymentId: string, type?: DeploymentDownloadType }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -1306,14 +1306,17 @@ class SitesRuntime { const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['key'] = (this.client.config as unknown as Record<string, string>)['key']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); + return this.client.call( + 'get', + uri, + apiHeaders, + payload, + 'arrayBuffer' + ); } /** diff --git a/src/services/storage.ts b/src/services/storage.ts index 4a3f12d4..0fa1be64 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -869,9 +869,6 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -1014,9 +1011,6 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } @@ -1082,9 +1076,6 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; - payload['session'] = (this.client.config as unknown as Record<string, string>)['session']; - for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } From b1426d8697a5816d75f8c0c2195a27f916d87aec Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Wed, 20 May 2026 17:22:30 +0530 Subject: [PATCH 06/12] chore: update Web SDK to 26.0.0 --- src/services/account.ts | 4 ++-- src/services/avatars.ts | 16 ++++++++-------- src/services/functions.ts | 4 ---- src/services/sites.ts | 4 ---- src/services/storage.ts | 6 +++--- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/services/account.ts b/src/services/account.ts index d30034aa..e8985c25 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1940,10 +1940,10 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - if (typeof window !== 'undefined' && window?.location) { window.location.href = uri.toString(); return; @@ -2690,10 +2690,10 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - if (typeof window !== 'undefined' && window?.location) { window.location.href = uri.toString(); return; diff --git a/src/services/avatars.ts b/src/services/avatars.ts index abb05d15..cda9dfa6 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -96,10 +96,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -174,10 +174,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -231,10 +231,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -309,10 +309,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -385,10 +385,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -467,10 +467,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -544,10 +544,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -739,10 +739,10 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } } diff --git a/src/services/functions.ts b/src/services/functions.ts index d05aea47..16baceac 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1307,10 +1307,6 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const apiHeaders: { [header: string]: string } = { } - for (const [key, value] of Object.entries(Service.flatten(payload))) { - uri.searchParams.append(key, value); - } - return this.client.call( 'get', uri, diff --git a/src/services/sites.ts b/src/services/sites.ts index ebd34c22..e17da317 100644 --- a/src/services/sites.ts +++ b/src/services/sites.ts @@ -1306,10 +1306,6 @@ class SitesRuntime { const apiHeaders: { [header: string]: string } = { } - for (const [key, value] of Object.entries(Service.flatten(payload))) { - uri.searchParams.append(key, value); - } - return this.client.call( 'get', uri, diff --git a/src/services/storage.ts b/src/services/storage.ts index 0fa1be64..b0586c78 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -869,10 +869,10 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -1011,10 +1011,10 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } @@ -1076,10 +1076,10 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const apiHeaders: { [header: string]: string } = { } + payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } - return uri.toString(); } } From 4afb0aca0a373a86bae005318d0ef36ad2ec14fd Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Mon, 8 Jun 2026 11:21:45 +0530 Subject: [PATCH 07/12] chore: update Web SDK to 26.0.0 --- CHANGELOG.md | 27 +- .../account/create-anonymous-session.md | 10 +- .../account/create-email-password-session.md | 9 +- docs/examples/account/create-email-token.md | 9 +- .../account/create-email-verification.md | 9 +- docs/examples/account/create-jwt.md | 9 +- .../account/create-magic-url-token.md | 9 +- .../account/create-mfa-authenticator.md | 9 +- docs/examples/account/create-mfa-challenge.md | 9 +- .../account/create-mfa-recovery-codes.md | 10 +- .../account/create-o-auth-2-session.md | 10 +- .../examples/account/create-o-auth-2-token.md | 10 +- docs/examples/account/create-phone-token.md | 9 +- .../account/create-phone-verification.md | 10 +- docs/examples/account/create-push-target.md | 9 +- docs/examples/account/create-recovery.md | 9 +- docs/examples/account/create-session.md | 9 +- docs/examples/account/create-verification.md | 9 +- docs/examples/account/create.md | 9 +- docs/examples/account/delete-identity.md | 9 +- .../account/delete-mfa-authenticator.md | 9 +- docs/examples/account/delete-push-target.md | 9 +- docs/examples/account/delete-session.md | 9 +- docs/examples/account/delete-sessions.md | 10 +- .../account/get-mfa-recovery-codes.md | 10 +- docs/examples/account/get-prefs.md | 10 +- docs/examples/account/get-session.md | 9 +- docs/examples/account/get.md | 10 +- docs/examples/account/list-identities.md | 9 +- docs/examples/account/list-logs.md | 9 +- docs/examples/account/list-mfa-factors.md | 10 +- docs/examples/account/list-sessions.md | 10 +- .../account/update-email-verification.md | 9 +- docs/examples/account/update-email.md | 9 +- .../account/update-magic-url-session.md | 9 +- .../account/update-mfa-authenticator.md | 9 +- docs/examples/account/update-mfa-challenge.md | 9 +- .../account/update-mfa-recovery-codes.md | 10 +- docs/examples/account/update-mfa.md | 9 +- docs/examples/account/update-name.md | 9 +- docs/examples/account/update-password.md | 11 +- docs/examples/account/update-phone-session.md | 9 +- .../account/update-phone-verification.md | 9 +- docs/examples/account/update-phone.md | 9 +- docs/examples/account/update-prefs.md | 9 +- docs/examples/account/update-push-target.md | 9 +- docs/examples/account/update-recovery.md | 9 +- docs/examples/account/update-session.md | 9 +- docs/examples/account/update-status.md | 10 +- docs/examples/account/update-verification.md | 9 +- docs/examples/activities/get-event.md | 17 - docs/examples/activities/list-events.md | 17 - docs/examples/advisor/delete-report.md | 17 - docs/examples/advisor/get-insight.md | 18 - docs/examples/advisor/get-report.md | 17 - docs/examples/advisor/list-insights.md | 19 - docs/examples/advisor/list-reports.md | 18 - docs/examples/apps/create-secret.md | 15 + docs/examples/apps/create.md | 21 + docs/examples/apps/delete-secret.md | 16 + docs/examples/apps/delete-tokens.md | 15 + docs/examples/apps/delete.md | 15 + docs/examples/apps/get-secret.md | 16 + docs/examples/apps/get.md | 15 + docs/examples/apps/list-secrets.md | 17 + docs/examples/apps/list.md | 16 + docs/examples/apps/update-team.md | 16 + docs/examples/apps/update.md | 20 + docs/examples/avatars/get-browser.md | 9 +- docs/examples/avatars/get-credit-card.md | 9 +- docs/examples/avatars/get-favicon.md | 9 +- docs/examples/avatars/get-flag.md | 9 +- docs/examples/avatars/get-image.md | 9 +- docs/examples/avatars/get-initials.md | 9 +- docs/examples/avatars/get-qr.md | 9 +- docs/examples/avatars/get-screenshot.md | 15 +- docs/examples/backups/create-archive.md | 18 - docs/examples/backups/create-policy.md | 23 - docs/examples/backups/create-restoration.md | 20 - docs/examples/backups/delete-archive.md | 17 - docs/examples/backups/delete-policy.md | 17 - docs/examples/backups/get-archive.md | 17 - docs/examples/backups/get-policy.md | 17 - docs/examples/backups/get-restoration.md | 17 - docs/examples/backups/list-archives.md | 17 - docs/examples/backups/list-policies.md | 17 - docs/examples/backups/list-restorations.md | 17 - docs/examples/backups/update-policy.md | 21 - .../databases/create-big-int-attribute.md | 24 - .../databases/create-boolean-attribute.md | 22 - docs/examples/databases/create-collection.md | 24 - .../databases/create-datetime-attribute.md | 22 - docs/examples/databases/create-document.md | 9 +- docs/examples/databases/create-documents.md | 20 - .../databases/create-email-attribute.md | 22 - .../databases/create-enum-attribute.md | 23 - .../databases/create-float-attribute.md | 24 - docs/examples/databases/create-index.md | 23 - .../databases/create-integer-attribute.md | 24 - .../examples/databases/create-ip-attribute.md | 22 - .../databases/create-line-attribute.md | 21 - .../databases/create-longtext-attribute.md | 23 - .../databases/create-mediumtext-attribute.md | 23 - docs/examples/databases/create-operations.md | 10 +- .../databases/create-point-attribute.md | 21 - .../databases/create-polygon-attribute.md | 21 - .../create-relationship-attribute.md | 24 - .../databases/create-string-attribute.md | 24 - .../databases/create-text-attribute.md | 23 - docs/examples/databases/create-transaction.md | 10 +- .../databases/create-url-attribute.md | 22 - .../databases/create-varchar-attribute.md | 24 - docs/examples/databases/create.md | 19 - .../databases/decrement-document-attribute.md | 9 +- docs/examples/databases/delete-attribute.md | 19 - docs/examples/databases/delete-collection.md | 18 - docs/examples/databases/delete-document.md | 9 +- docs/examples/databases/delete-documents.md | 20 - docs/examples/databases/delete-index.md | 19 - docs/examples/databases/delete-transaction.md | 10 +- docs/examples/databases/delete.md | 17 - docs/examples/databases/get-attribute.md | 19 - docs/examples/databases/get-collection.md | 18 - docs/examples/databases/get-document.md | 9 +- docs/examples/databases/get-index.md | 19 - docs/examples/databases/get-transaction.md | 10 +- docs/examples/databases/get.md | 17 - .../databases/increment-document-attribute.md | 9 +- docs/examples/databases/list-attributes.md | 20 - docs/examples/databases/list-collections.md | 20 - docs/examples/databases/list-documents.md | 9 +- docs/examples/databases/list-indexes.md | 20 - docs/examples/databases/list-transactions.md | 10 +- docs/examples/databases/list.md | 19 - .../databases/update-big-int-attribute.md | 24 - .../databases/update-boolean-attribute.md | 22 - docs/examples/databases/update-collection.md | 23 - .../databases/update-datetime-attribute.md | 22 - docs/examples/databases/update-document.md | 9 +- docs/examples/databases/update-documents.md | 27 - .../databases/update-email-attribute.md | 22 - .../databases/update-enum-attribute.md | 23 - .../databases/update-float-attribute.md | 24 - .../databases/update-integer-attribute.md | 24 - .../examples/databases/update-ip-attribute.md | 22 - .../databases/update-line-attribute.md | 22 - .../databases/update-longtext-attribute.md | 22 - .../databases/update-mediumtext-attribute.md | 22 - .../databases/update-point-attribute.md | 22 - .../databases/update-polygon-attribute.md | 22 - .../update-relationship-attribute.md | 21 - .../databases/update-string-attribute.md | 23 - .../databases/update-text-attribute.md | 22 - docs/examples/databases/update-transaction.md | 10 +- .../databases/update-url-attribute.md | 22 - .../databases/update-varchar-attribute.md | 23 - docs/examples/databases/update.md | 19 - docs/examples/databases/upsert-document.md | 9 +- docs/examples/databases/upsert-documents.md | 20 - docs/examples/functions/create-deployment.md | 21 - .../functions/create-duplicate-deployment.md | 19 - docs/examples/functions/create-execution.md | 9 +- .../functions/create-template-deployment.md | 23 - docs/examples/functions/create-variable.md | 21 - .../functions/create-vcs-deployment.md | 20 - docs/examples/functions/create.md | 36 - docs/examples/functions/delete-deployment.md | 18 - docs/examples/functions/delete-execution.md | 18 - docs/examples/functions/delete-variable.md | 18 - docs/examples/functions/delete.md | 17 - .../functions/get-deployment-download.md | 19 - docs/examples/functions/get-deployment.md | 18 - docs/examples/functions/get-execution.md | 9 +- docs/examples/functions/get-variable.md | 18 - docs/examples/functions/get.md | 17 - docs/examples/functions/list-deployments.md | 20 - docs/examples/functions/list-executions.md | 9 +- docs/examples/functions/list-runtimes.md | 16 - .../examples/functions/list-specifications.md | 16 - docs/examples/functions/list-variables.md | 19 - docs/examples/functions/list.md | 19 - .../functions/update-deployment-status.md | 18 - .../functions/update-function-deployment.md | 18 - docs/examples/functions/update-variable.md | 21 - docs/examples/functions/update.md | 36 - docs/examples/graphql/mutation.md | 10 +- docs/examples/graphql/query.md | 10 +- docs/examples/health/get-antivirus.md | 16 - docs/examples/health/get-cache.md | 16 - docs/examples/health/get-certificate.md | 17 - docs/examples/health/get-console-pausing.md | 18 - docs/examples/health/get-db.md | 16 - docs/examples/health/get-failed-jobs.md | 18 - docs/examples/health/get-pub-sub.md | 16 - docs/examples/health/get-queue-audits.md | 17 - docs/examples/health/get-queue-builds.md | 17 - .../examples/health/get-queue-certificates.md | 17 - docs/examples/health/get-queue-databases.md | 18 - docs/examples/health/get-queue-deletes.md | 17 - docs/examples/health/get-queue-functions.md | 17 - docs/examples/health/get-queue-logs.md | 17 - docs/examples/health/get-queue-mails.md | 17 - docs/examples/health/get-queue-messaging.md | 17 - docs/examples/health/get-queue-migrations.md | 17 - .../health/get-queue-stats-resources.md | 17 - docs/examples/health/get-queue-usage.md | 17 - docs/examples/health/get-queue-webhooks.md | 17 - docs/examples/health/get-storage-local.md | 16 - docs/examples/health/get-storage.md | 16 - docs/examples/health/get-time.md | 16 - docs/examples/health/get.md | 16 - docs/examples/locale/get.md | 10 +- docs/examples/locale/list-codes.md | 10 +- docs/examples/locale/list-continents.md | 10 +- docs/examples/locale/list-countries-eu.md | 10 +- docs/examples/locale/list-countries-phones.md | 10 +- docs/examples/locale/list-countries.md | 10 +- docs/examples/locale/list-currencies.md | 10 +- docs/examples/locale/list-languages.md | 10 +- .../messaging/create-apns-provider.md | 24 - docs/examples/messaging/create-email.md | 28 - .../examples/messaging/create-fcm-provider.md | 20 - .../messaging/create-mailgun-provider.md | 26 - .../messaging/create-msg-91-provider.md | 22 - docs/examples/messaging/create-push.md | 35 - .../messaging/create-resend-provider.md | 24 - .../messaging/create-sendgrid-provider.md | 24 - docs/examples/messaging/create-sms.md | 23 - .../messaging/create-smtp-provider.md | 30 - docs/examples/messaging/create-subscriber.md | 10 +- .../messaging/create-telesign-provider.md | 22 - .../messaging/create-textmagic-provider.md | 22 - docs/examples/messaging/create-topic.md | 19 - .../messaging/create-twilio-provider.md | 22 - .../messaging/create-vonage-provider.md | 22 - docs/examples/messaging/delete-provider.md | 17 - docs/examples/messaging/delete-subscriber.md | 10 +- docs/examples/messaging/delete-topic.md | 17 - docs/examples/messaging/delete.md | 17 - docs/examples/messaging/get-message.md | 17 - docs/examples/messaging/get-provider.md | 17 - docs/examples/messaging/get-subscriber.md | 18 - docs/examples/messaging/get-topic.md | 17 - docs/examples/messaging/list-message-logs.md | 19 - docs/examples/messaging/list-messages.md | 19 - docs/examples/messaging/list-provider-logs.md | 19 - docs/examples/messaging/list-providers.md | 19 - .../messaging/list-subscriber-logs.md | 19 - docs/examples/messaging/list-subscribers.md | 20 - docs/examples/messaging/list-targets.md | 19 - docs/examples/messaging/list-topic-logs.md | 19 - docs/examples/messaging/list-topics.md | 19 - .../messaging/update-apns-provider.md | 24 - docs/examples/messaging/update-email.md | 28 - .../examples/messaging/update-fcm-provider.md | 20 - .../messaging/update-mailgun-provider.md | 26 - .../messaging/update-msg-91-provider.md | 22 - docs/examples/messaging/update-push.md | 35 - .../messaging/update-resend-provider.md | 24 - .../messaging/update-sendgrid-provider.md | 24 - docs/examples/messaging/update-sms.md | 23 - .../messaging/update-smtp-provider.md | 30 - .../messaging/update-telesign-provider.md | 22 - .../messaging/update-textmagic-provider.md | 22 - docs/examples/messaging/update-topic.md | 19 - .../messaging/update-twilio-provider.md | 22 - .../messaging/update-vonage-provider.md | 22 - docs/examples/oauth2/approve.md | 17 + docs/examples/oauth2/authorize.md | 26 + docs/examples/oauth2/create-grant.md | 16 + docs/examples/oauth2/get-grant.md | 16 + docs/examples/oauth2/reject.md | 16 + docs/examples/presences/delete.md | 10 +- docs/examples/presences/get.md | 10 +- docs/examples/presences/list.md | 10 +- .../{update-presence.md => update.md} | 13 +- docs/examples/presences/upsert.md | 11 +- .../project/create-android-platform.md | 19 - .../examples/project/create-apple-platform.md | 19 - docs/examples/project/create-ephemeral-key.md | 18 - docs/examples/project/create-key.md | 20 - .../examples/project/create-linux-platform.md | 19 - docs/examples/project/create-mock-phone.md | 18 - docs/examples/project/create-smtp-test.md | 17 - docs/examples/project/create-variable.md | 20 - docs/examples/project/create-web-platform.md | 19 - .../project/create-windows-platform.md | 19 - docs/examples/project/delete-key.md | 17 - docs/examples/project/delete-mock-phone.md | 17 - docs/examples/project/delete-platform.md | 17 - docs/examples/project/delete-variable.md | 17 - docs/examples/project/delete.md | 16 - docs/examples/project/get-email-template.md | 18 - docs/examples/project/get-key.md | 17 - docs/examples/project/get-mock-phone.md | 17 - .../examples/project/get-o-auth-2-provider.md | 17 - docs/examples/project/get-platform.md | 17 - docs/examples/project/get-policy.md | 17 - docs/examples/project/get-variable.md | 17 - docs/examples/project/get.md | 16 - docs/examples/project/list-email-templates.md | 18 - docs/examples/project/list-keys.md | 18 - docs/examples/project/list-mock-phones.md | 18 - .../project/list-o-auth-2-providers.md | 18 - docs/examples/project/list-platforms.md | 18 - docs/examples/project/list-policies.md | 18 - docs/examples/project/list-variables.md | 18 - .../project/update-android-platform.md | 19 - .../examples/project/update-apple-platform.md | 19 - docs/examples/project/update-auth-method.md | 18 - .../update-deny-aliased-email-policy.md | 17 - .../update-deny-disposable-email-policy.md | 17 - .../project/update-deny-free-email-policy.md | 17 - .../examples/project/update-email-template.md | 24 - docs/examples/project/update-key.md | 20 - docs/examples/project/update-labels.md | 17 - .../examples/project/update-linux-platform.md | 19 - .../update-membership-privacy-policy.md | 21 - docs/examples/project/update-mock-phone.md | 18 - .../project/update-o-auth-2-amazon.md | 19 - .../examples/project/update-o-auth-2-apple.md | 21 - .../project/update-o-auth-2-auth-0.md | 20 - .../project/update-o-auth-2-authentik.md | 20 - .../project/update-o-auth-2-autodesk.md | 19 - .../project/update-o-auth-2-bitbucket.md | 19 - .../examples/project/update-o-auth-2-bitly.md | 19 - docs/examples/project/update-o-auth-2-box.md | 19 - .../project/update-o-auth-2-dailymotion.md | 19 - .../project/update-o-auth-2-discord.md | 19 - .../project/update-o-auth-2-disqus.md | 19 - .../project/update-o-auth-2-dropbox.md | 19 - docs/examples/project/update-o-auth-2-etsy.md | 19 - .../project/update-o-auth-2-facebook.md | 19 - .../examples/project/update-o-auth-2-figma.md | 19 - .../project/update-o-auth-2-fusion-auth.md | 20 - .../project/update-o-auth-2-git-hub.md | 19 - .../project/update-o-auth-2-gitlab.md | 20 - .../project/update-o-auth-2-google.md | 20 - .../project/update-o-auth-2-keycloak.md | 21 - docs/examples/project/update-o-auth-2-kick.md | 19 - .../project/update-o-auth-2-linkedin.md | 19 - .../project/update-o-auth-2-microsoft.md | 20 - .../project/update-o-auth-2-notion.md | 19 - docs/examples/project/update-o-auth-2-oidc.md | 23 - docs/examples/project/update-o-auth-2-okta.md | 21 - .../project/update-o-auth-2-paypal-sandbox.md | 19 - .../project/update-o-auth-2-paypal.md | 19 - .../examples/project/update-o-auth-2-podio.md | 19 - .../project/update-o-auth-2-salesforce.md | 19 - .../examples/project/update-o-auth-2-slack.md | 19 - .../project/update-o-auth-2-spotify.md | 19 - .../project/update-o-auth-2-stripe.md | 19 - .../update-o-auth-2-tradeshift-sandbox.md | 19 - .../project/update-o-auth-2-tradeshift.md | 19 - .../project/update-o-auth-2-twitch.md | 19 - .../project/update-o-auth-2-word-press.md | 19 - .../examples/project/update-o-auth-2-yahoo.md | 19 - .../project/update-o-auth-2-yandex.md | 19 - docs/examples/project/update-o-auth-2-zoho.md | 19 - docs/examples/project/update-o-auth-2-zoom.md | 19 - docs/examples/project/update-o-auth-2x.md | 19 - .../update-password-dictionary-policy.md | 17 - .../project/update-password-history-policy.md | 17 - .../update-password-personal-data-policy.md | 17 - docs/examples/project/update-protocol.md | 18 - docs/examples/project/update-service.md | 18 - .../project/update-session-alert-policy.md | 17 - .../project/update-session-duration-policy.md | 17 - .../update-session-invalidation-policy.md | 17 - .../project/update-session-limit-policy.md | 17 - docs/examples/project/update-smtp.md | 26 - .../project/update-user-limit-policy.md | 17 - docs/examples/project/update-variable.md | 20 - docs/examples/project/update-web-platform.md | 19 - .../project/update-windows-platform.md | 19 - docs/examples/proxy/create-api-rule.md | 17 - docs/examples/proxy/create-function-rule.md | 19 - docs/examples/proxy/create-redirect-rule.md | 21 - docs/examples/proxy/create-site-rule.md | 19 - docs/examples/proxy/delete-rule.md | 17 - docs/examples/proxy/get-rule.md | 17 - docs/examples/proxy/list-rules.md | 18 - docs/examples/proxy/update-rule-status.md | 17 - docs/examples/sites/create-deployment.md | 22 - .../sites/create-duplicate-deployment.md | 18 - .../sites/create-template-deployment.md | 23 - docs/examples/sites/create-variable.md | 21 - docs/examples/sites/create-vcs-deployment.md | 20 - docs/examples/sites/create.md | 37 - docs/examples/sites/delete-deployment.md | 18 - docs/examples/sites/delete-log.md | 18 - docs/examples/sites/delete-variable.md | 18 - docs/examples/sites/delete.md | 17 - .../examples/sites/get-deployment-download.md | 19 - docs/examples/sites/get-deployment.md | 18 - docs/examples/sites/get-log.md | 18 - docs/examples/sites/get-variable.md | 18 - docs/examples/sites/get.md | 17 - docs/examples/sites/list-deployments.md | 20 - docs/examples/sites/list-frameworks.md | 16 - docs/examples/sites/list-logs.md | 19 - docs/examples/sites/list-specifications.md | 16 - docs/examples/sites/list-variables.md | 19 - docs/examples/sites/list.md | 19 - .../sites/update-deployment-status.md | 18 - docs/examples/sites/update-site-deployment.md | 18 - docs/examples/sites/update-variable.md | 21 - docs/examples/sites/update.md | 37 - docs/examples/storage/create-bucket.md | 27 - docs/examples/storage/create-file.md | 9 +- docs/examples/storage/delete-bucket.md | 17 - docs/examples/storage/delete-file.md | 9 +- docs/examples/storage/get-bucket.md | 17 - docs/examples/storage/get-file-download.md | 9 +- docs/examples/storage/get-file-preview.md | 9 +- docs/examples/storage/get-file-view.md | 9 +- docs/examples/storage/get-file.md | 9 +- docs/examples/storage/list-buckets.md | 19 - docs/examples/storage/list-files.md | 9 +- docs/examples/storage/update-bucket.md | 27 - docs/examples/storage/update-file.md | 9 +- .../tablesdb/create-big-int-column.md | 24 - .../tablesdb/create-boolean-column.md | 22 - .../tablesdb/create-datetime-column.md | 22 - docs/examples/tablesdb/create-email-column.md | 22 - docs/examples/tablesdb/create-enum-column.md | 23 - docs/examples/tablesdb/create-float-column.md | 24 - docs/examples/tablesdb/create-index.md | 23 - .../tablesdb/create-integer-column.md | 24 - docs/examples/tablesdb/create-ip-column.md | 22 - docs/examples/tablesdb/create-line-column.md | 21 - .../tablesdb/create-longtext-column.md | 23 - .../tablesdb/create-mediumtext-column.md | 23 - docs/examples/tablesdb/create-operations.md | 10 +- docs/examples/tablesdb/create-point-column.md | 21 - .../tablesdb/create-polygon-column.md | 21 - .../tablesdb/create-relationship-column.md | 24 - docs/examples/tablesdb/create-row.md | 9 +- docs/examples/tablesdb/create-rows.md | 20 - .../examples/tablesdb/create-string-column.md | 24 - docs/examples/tablesdb/create-table.md | 24 - docs/examples/tablesdb/create-text-column.md | 23 - docs/examples/tablesdb/create-transaction.md | 10 +- docs/examples/tablesdb/create-url-column.md | 22 - .../tablesdb/create-varchar-column.md | 24 - docs/examples/tablesdb/create.md | 19 - .../examples/tablesdb/decrement-row-column.md | 9 +- docs/examples/tablesdb/delete-column.md | 19 - docs/examples/tablesdb/delete-index.md | 19 - docs/examples/tablesdb/delete-row.md | 9 +- docs/examples/tablesdb/delete-rows.md | 20 - docs/examples/tablesdb/delete-table.md | 18 - docs/examples/tablesdb/delete-transaction.md | 10 +- docs/examples/tablesdb/delete.md | 17 - docs/examples/tablesdb/get-column.md | 19 - docs/examples/tablesdb/get-index.md | 19 - docs/examples/tablesdb/get-row.md | 9 +- docs/examples/tablesdb/get-table.md | 18 - docs/examples/tablesdb/get-transaction.md | 10 +- docs/examples/tablesdb/get.md | 17 - .../examples/tablesdb/increment-row-column.md | 9 +- docs/examples/tablesdb/list-columns.md | 20 - docs/examples/tablesdb/list-indexes.md | 20 - docs/examples/tablesdb/list-rows.md | 9 +- docs/examples/tablesdb/list-tables.md | 20 - docs/examples/tablesdb/list-transactions.md | 10 +- docs/examples/tablesdb/list.md | 19 - .../tablesdb/update-big-int-column.md | 24 - .../tablesdb/update-boolean-column.md | 22 - .../tablesdb/update-datetime-column.md | 22 - docs/examples/tablesdb/update-email-column.md | 22 - docs/examples/tablesdb/update-enum-column.md | 23 - docs/examples/tablesdb/update-float-column.md | 24 - .../tablesdb/update-integer-column.md | 24 - docs/examples/tablesdb/update-ip-column.md | 22 - docs/examples/tablesdb/update-line-column.md | 22 - .../tablesdb/update-longtext-column.md | 22 - .../tablesdb/update-mediumtext-column.md | 22 - docs/examples/tablesdb/update-point-column.md | 22 - .../tablesdb/update-polygon-column.md | 22 - .../tablesdb/update-relationship-column.md | 21 - docs/examples/tablesdb/update-row.md | 9 +- docs/examples/tablesdb/update-rows.md | 27 - .../examples/tablesdb/update-string-column.md | 23 - docs/examples/tablesdb/update-table.md | 23 - docs/examples/tablesdb/update-text-column.md | 22 - docs/examples/tablesdb/update-transaction.md | 10 +- docs/examples/tablesdb/update-url-column.md | 22 - .../tablesdb/update-varchar-column.md | 23 - docs/examples/tablesdb/update.md | 19 - docs/examples/tablesdb/upsert-row.md | 9 +- docs/examples/tablesdb/upsert-rows.md | 20 - docs/examples/teams/create-membership.md | 9 +- docs/examples/teams/create.md | 9 +- docs/examples/teams/delete-membership.md | 9 +- docs/examples/teams/delete.md | 9 +- docs/examples/teams/get-membership.md | 9 +- docs/examples/teams/get-prefs.md | 9 +- docs/examples/teams/get.md | 9 +- docs/examples/teams/list-memberships.md | 9 +- docs/examples/teams/list.md | 9 +- .../teams/update-membership-status.md | 9 +- docs/examples/teams/update-membership.md | 9 +- docs/examples/teams/update-name.md | 9 +- docs/examples/teams/update-prefs.md | 9 +- docs/examples/tokens/create-file-token.md | 19 - docs/examples/tokens/delete.md | 17 - docs/examples/tokens/get.md | 17 - docs/examples/tokens/list.md | 20 - docs/examples/tokens/update.md | 18 - docs/examples/usage/list-events.md | 18 - docs/examples/usage/list-gauges.md | 18 - docs/examples/users/create-argon-2-user.md | 20 - docs/examples/users/create-bcrypt-user.md | 20 - docs/examples/users/create-jwt.md | 19 - docs/examples/users/create-md-5-user.md | 20 - .../users/create-mfa-recovery-codes.md | 17 - docs/examples/users/create-ph-pass-user.md | 20 - .../users/create-scrypt-modified-user.md | 23 - docs/examples/users/create-scrypt-user.md | 25 - docs/examples/users/create-session.md | 17 - docs/examples/users/create-sha-user.md | 21 - docs/examples/users/create-target.md | 22 - docs/examples/users/create-token.md | 19 - docs/examples/users/create.md | 21 - docs/examples/users/delete-identity.md | 17 - .../users/delete-mfa-authenticator.md | 18 - docs/examples/users/delete-session.md | 18 - docs/examples/users/delete-sessions.md | 17 - docs/examples/users/delete-target.md | 18 - docs/examples/users/delete.md | 17 - docs/examples/users/get-mfa-recovery-codes.md | 17 - docs/examples/users/get-prefs.md | 17 - docs/examples/users/get-target.md | 18 - docs/examples/users/get.md | 17 - docs/examples/users/list-identities.md | 19 - docs/examples/users/list-logs.md | 19 - docs/examples/users/list-memberships.md | 20 - docs/examples/users/list-mfa-factors.md | 17 - docs/examples/users/list-sessions.md | 18 - docs/examples/users/list-targets.md | 19 - docs/examples/users/list.md | 19 - .../users/update-email-verification.md | 18 - docs/examples/users/update-email.md | 18 - docs/examples/users/update-impersonator.md | 18 - docs/examples/users/update-labels.md | 18 - .../users/update-mfa-recovery-codes.md | 17 - docs/examples/users/update-mfa.md | 18 - docs/examples/users/update-name.md | 18 - docs/examples/users/update-password.md | 18 - .../users/update-phone-verification.md | 18 - docs/examples/users/update-phone.md | 18 - docs/examples/users/update-prefs.md | 18 - docs/examples/users/update-status.md | 18 - docs/examples/users/update-target.md | 21 - docs/examples/webhooks/create.md | 25 - docs/examples/webhooks/delete.md | 17 - docs/examples/webhooks/get.md | 17 - docs/examples/webhooks/list.md | 18 - docs/examples/webhooks/update-secret.md | 18 - docs/examples/webhooks/update.md | 24 - src/client.ts | 519 +- src/enums/adapter.ts | 4 - src/enums/attribute-status.ts | 7 - src/enums/backup-services.ts | 8 - src/enums/{theme.ts => browser-theme.ts} | 2 +- src/enums/build-runtime.ts | 91 - src/enums/column-status.ts | 7 - src/enums/compression.ts | 5 - 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/framework.ts | 17 - src/enums/health-antivirus-status.ts | 5 - src/enums/health-check-status.ts | 4 - 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/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 | 91 - 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/vcs-reference-type.ts | 5 - src/index.ts | 61 +- src/models.ts | 6884 ++--------------- src/services/account.ts | 146 +- src/services/activities.ts | 123 - src/services/advisor.ts | 316 - src/services/apps.ts | 743 ++ src/services/avatars.ts | 92 +- src/services/backups.ts | 761 -- src/services/databases.ts | 5385 +------------ src/services/functions.ts | 1973 +---- src/services/graphql.ts | 29 +- src/services/health.ts | 1050 --- src/services/locale.ts | 41 +- src/services/messaging.ts | 5079 +----------- src/services/oauth-2.ts | 418 + src/services/presences.ts | 136 +- src/services/project.ts | 6466 ---------------- src/services/proxy.ts | 548 -- src/services/realtime.ts | 34 +- src/services/sites.ts | 1924 ----- src/services/storage.ts | 476 +- src/services/tables-db.ts | 5444 +------------ src/services/teams.ts | 49 +- src/services/tokens.ts | 322 - src/services/usage.ts | 137 - src/services/users.ts | 3277 -------- src/services/webhooks.ts | 473 -- 634 files changed, 3647 insertions(+), 49897 deletions(-) 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 create mode 100644 docs/examples/apps/create-secret.md create mode 100644 docs/examples/apps/create.md create mode 100644 docs/examples/apps/delete-secret.md create mode 100644 docs/examples/apps/delete-tokens.md create mode 100644 docs/examples/apps/delete.md create mode 100644 docs/examples/apps/get-secret.md create mode 100644 docs/examples/apps/get.md create mode 100644 docs/examples/apps/list-secrets.md create mode 100644 docs/examples/apps/list.md create mode 100644 docs/examples/apps/update-team.md create mode 100644 docs/examples/apps/update.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-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-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-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/delete-attribute.md delete mode 100644 docs/examples/databases/delete-collection.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.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-index.md delete mode 100644 docs/examples/databases/get.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-indexes.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-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-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-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-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-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-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/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/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-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-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 create mode 100644 docs/examples/oauth2/approve.md create mode 100644 docs/examples/oauth2/authorize.md create mode 100644 docs/examples/oauth2/create-grant.md create mode 100644 docs/examples/oauth2/get-grant.md create mode 100644 docs/examples/oauth2/reject.md rename docs/examples/presences/{update-presence.md => update.md} (57%) 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/delete-bucket.md delete mode 100644 docs/examples/storage/get-bucket.md delete mode 100644 docs/examples/storage/list-buckets.md delete mode 100644 docs/examples/storage/update-bucket.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-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-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-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/delete-column.md delete mode 100644 docs/examples/tablesdb/delete-index.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.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-table.md delete mode 100644 docs/examples/tablesdb/get.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-tables.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-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-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-rows.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 src/enums/adapter.ts delete mode 100644 src/enums/attribute-status.ts delete mode 100644 src/enums/backup-services.ts rename src/enums/{theme.ts => browser-theme.ts} (60%) 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/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/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/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/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/vcs-reference-type.ts delete mode 100644 src/services/activities.ts delete mode 100644 src/services/advisor.ts create mode 100644 src/services/apps.ts delete mode 100644 src/services/backups.ts delete mode 100644 src/services/health.ts create mode 100644 src/services/oauth-2.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/tokens.ts delete mode 100644 src/services/usage.ts delete mode 100644 src/services/users.ts delete mode 100644 src/services/webhooks.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 28da3cfa..c4df246d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,25 +2,14 @@ ## 26.0.0 -* Added: Isomorphic `Client<TAuth>` typed by auth capability — services narrow available methods by auth type at compile time -* Added: Static factory constructors `Client.from`, `Client.fromSession`, `Client.fromAPIKey`, `Client.fromCookie`, `Client.fromJWT`, `Client.fromDevKey`, and `Client.fromImpersonation` -* Added: Server-side auth via `apiKey`, `cookie`, and `jwt` factories -* Added: Admin and server-only endpoints (`Users`, `Projects`, function and site deployments, storage buckets, and more) -* Breaking: Renamed `Presences.update` to `Presences.updatePresence` -* Breaking: `Presences.upsert` and `Presences.updatePresence` now require a `userId` parameter -* Deprecated: `new Client()` constructor and `setEndpoint`/`setProject`/setter pattern remain for backwards compatibility but are now marked deprecated - -### Migration - -```ts -// Before (25.x) -await presences.upsert(presenceId, status); -await presences.update(presenceId, status); - -// After (26.0.0) -await presences.upsert(presenceId, userId, status); -await presences.updatePresence(presenceId, userId, status); -``` +* Breaking: Removed `Client.setKey()` and `Client.setForwardedUserAgent()` methods. +* Breaking: Renamed `Theme` enum to `BrowserTheme`, changing `avatars.getScreenshot()` `theme` param type. +* Breaking: Made `presences` `list`/`get`/`upsert`/`update` non-generic and removed `Models.DefaultPresence`. +* Added: `apps` and `oauth2` services for application and OAuth2 management. +* Added: `App`, `AppSecret`, `AppSecretPlaintext`, `AppsList`, and `AppSecretList` models. +* Added: `Oauth2Authorize`, `Oauth2Approve`, `Oauth2Reject`, and `Oauth2Grant` models. +* Added: Email metadata fields to `User` (`emailCanonical`, `emailIsFree`, `emailIsDisposable`, `emailIsCorporate`, `emailIsCanonical`). +* Added: `Membership.userAccessedAt` and `Presence.metadata` fields. ## 25.1.1 diff --git a/docs/examples/account/create-anonymous-session.md b/docs/examples/account/create-anonymous-session.md index ecc96bd4..818f50a4 100644 --- a/docs/examples/account/create-anonymous-session.md +++ b/docs/examples/account/create-anonymous-session.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.createAnonymousSession(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-email-password-session.md b/docs/examples/account/create-email-password-session.md index f047703a..4010b91f 100644 --- a/docs/examples/account/create-email-password-session.md +++ b/docs/examples/account/create-email-password-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.createEmailPasswordSession({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-email-token.md b/docs/examples/account/create-email-token.md index 0c8e00f6..940a7f70 100644 --- a/docs/examples/account/create-email-token.md +++ b/docs/examples/account/create-email-token.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -15,4 +14,4 @@ const result = await account.createEmailToken({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-email-verification.md b/docs/examples/account/create-email-verification.md index 91e34e24..a3e378d2 100644 --- a/docs/examples/account/create-email-verification.md +++ b/docs/examples/account/create-email-verification.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.createEmailVerification({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index 6a0b3205..0ba2d266 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.createJWT({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-magic-url-token.md b/docs/examples/account/create-magic-url-token.md index db3d0e64..59d1aaf0 100644 --- a/docs/examples/account/create-magic-url-token.md +++ b/docs/examples/account/create-magic-url-token.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -16,4 +15,4 @@ const result = await account.createMagicURLToken({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-mfa-authenticator.md b/docs/examples/account/create-mfa-authenticator.md index 5afe9a2c..cf6a6098 100644 --- a/docs/examples/account/create-mfa-authenticator.md +++ b/docs/examples/account/create-mfa-authenticator.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account, AuthenticatorType } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.createMFAAuthenticator({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-mfa-challenge.md b/docs/examples/account/create-mfa-challenge.md index d5ed988b..d9d9856d 100644 --- a/docs/examples/account/create-mfa-challenge.md +++ b/docs/examples/account/create-mfa-challenge.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account, AuthenticationFactor } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.createMFAChallenge({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-mfa-recovery-codes.md b/docs/examples/account/create-mfa-recovery-codes.md index e73f5a81..3c292f26 100644 --- a/docs/examples/account/create-mfa-recovery-codes.md +++ b/docs/examples/account/create-mfa-recovery-codes.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.createMFARecoveryCodes(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-o-auth-2-session.md b/docs/examples/account/create-o-auth-2-session.md index 46b4988d..734b6972 100644 --- a/docs/examples/account/create-o-auth-2-session.md +++ b/docs/examples/account/create-o-auth-2-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account, OAuthProvider } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,5 @@ account.createOAuth2Session({ failure: 'https://example.com', // optional scopes: [] // optional }); -``` \ No newline at end of file + +``` diff --git a/docs/examples/account/create-o-auth-2-token.md b/docs/examples/account/create-o-auth-2-token.md index d9865c6d..f6187249 100644 --- a/docs/examples/account/create-o-auth-2-token.md +++ b/docs/examples/account/create-o-auth-2-token.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account, OAuthProvider } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,5 @@ account.createOAuth2Token({ failure: 'https://example.com', // optional scopes: [] // optional }); -``` \ No newline at end of file + +``` diff --git a/docs/examples/account/create-phone-token.md b/docs/examples/account/create-phone-token.md index c27d585b..78812e33 100644 --- a/docs/examples/account/create-phone-token.md +++ b/docs/examples/account/create-phone-token.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.createPhoneToken({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-phone-verification.md b/docs/examples/account/create-phone-verification.md index 49fd657c..9c0ea143 100644 --- a/docs/examples/account/create-phone-verification.md +++ b/docs/examples/account/create-phone-verification.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.createPhoneVerification(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-push-target.md b/docs/examples/account/create-push-target.md index a253d338..39f4d48a 100644 --- a/docs/examples/account/create-push-target.md +++ b/docs/examples/account/create-push-target.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -15,4 +14,4 @@ const result = await account.createPushTarget({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-recovery.md b/docs/examples/account/create-recovery.md index b8ad516d..0f4e7a91 100644 --- a/docs/examples/account/create-recovery.md +++ b/docs/examples/account/create-recovery.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.createRecovery({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-session.md b/docs/examples/account/create-session.md index 63dfd40b..1639c12c 100644 --- a/docs/examples/account/create-session.md +++ b/docs/examples/account/create-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.createSession({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create-verification.md b/docs/examples/account/create-verification.md index 08596147..0795d0ac 100644 --- a/docs/examples/account/create-verification.md +++ b/docs/examples/account/create-verification.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.createVerification({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/create.md b/docs/examples/account/create.md index 438d6d3d..a78197cd 100644 --- a/docs/examples/account/create.md +++ b/docs/examples/account/create.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -16,4 +15,4 @@ const result = await account.create({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/delete-identity.md b/docs/examples/account/delete-identity.md index f0c3b6b0..d63addb7 100644 --- a/docs/examples/account/delete-identity.md +++ b/docs/examples/account/delete-identity.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.deleteIdentity({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/delete-mfa-authenticator.md b/docs/examples/account/delete-mfa-authenticator.md index 6824a56b..079f0b95 100644 --- a/docs/examples/account/delete-mfa-authenticator.md +++ b/docs/examples/account/delete-mfa-authenticator.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account, AuthenticatorType } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.deleteMFAAuthenticator({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/delete-push-target.md b/docs/examples/account/delete-push-target.md index 6eaf5be9..38d0ed5a 100644 --- a/docs/examples/account/delete-push-target.md +++ b/docs/examples/account/delete-push-target.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.deletePushTarget({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/delete-session.md b/docs/examples/account/delete-session.md index 30058f40..9d2b8f3e 100644 --- a/docs/examples/account/delete-session.md +++ b/docs/examples/account/delete-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.deleteSession({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/delete-sessions.md b/docs/examples/account/delete-sessions.md index 475e4e7a..d7df883e 100644 --- a/docs/examples/account/delete-sessions.md +++ b/docs/examples/account/delete-sessions.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.deleteSessions(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/get-mfa-recovery-codes.md b/docs/examples/account/get-mfa-recovery-codes.md index 22527912..1d102583 100644 --- a/docs/examples/account/get-mfa-recovery-codes.md +++ b/docs/examples/account/get-mfa-recovery-codes.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.getMFARecoveryCodes(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/get-prefs.md b/docs/examples/account/get-prefs.md index 0a7cf6ed..9e2d5e25 100644 --- a/docs/examples/account/get-prefs.md +++ b/docs/examples/account/get-prefs.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.getPrefs(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/get-session.md b/docs/examples/account/get-session.md index f3e7b14a..83ac4b0a 100644 --- a/docs/examples/account/get-session.md +++ b/docs/examples/account/get-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.getSession({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/get.md b/docs/examples/account/get.md index 551b62c6..0b6c59e3 100644 --- a/docs/examples/account/get.md +++ b/docs/examples/account/get.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.get(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/list-identities.md b/docs/examples/account/list-identities.md index 59a9f600..8dee4b39 100644 --- a/docs/examples/account/list-identities.md +++ b/docs/examples/account/list-identities.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.listIdentities({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/list-logs.md b/docs/examples/account/list-logs.md index d6ff44fd..91be728f 100644 --- a/docs/examples/account/list-logs.md +++ b/docs/examples/account/list-logs.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.listLogs({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/list-mfa-factors.md b/docs/examples/account/list-mfa-factors.md index 5d78f5c0..9950129b 100644 --- a/docs/examples/account/list-mfa-factors.md +++ b/docs/examples/account/list-mfa-factors.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.listMFAFactors(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/list-sessions.md b/docs/examples/account/list-sessions.md index fd96eef6..2dae7488 100644 --- a/docs/examples/account/list-sessions.md +++ b/docs/examples/account/list-sessions.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.listSessions(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-email-verification.md b/docs/examples/account/update-email-verification.md index 929f469f..f3e8b619 100644 --- a/docs/examples/account/update-email-verification.md +++ b/docs/examples/account/update-email-verification.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updateEmailVerification({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-email.md b/docs/examples/account/update-email.md index 5bd523d0..0bd7d36c 100644 --- a/docs/examples/account/update-email.md +++ b/docs/examples/account/update-email.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updateEmail({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-magic-url-session.md b/docs/examples/account/update-magic-url-session.md index e6d65eb1..d0598719 100644 --- a/docs/examples/account/update-magic-url-session.md +++ b/docs/examples/account/update-magic-url-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updateMagicURLSession({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-mfa-authenticator.md b/docs/examples/account/update-mfa-authenticator.md index da6e953b..bf25c76b 100644 --- a/docs/examples/account/update-mfa-authenticator.md +++ b/docs/examples/account/update-mfa-authenticator.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account, AuthenticatorType } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updateMFAAuthenticator({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-mfa-challenge.md b/docs/examples/account/update-mfa-challenge.md index c8c33a43..a16ea43a 100644 --- a/docs/examples/account/update-mfa-challenge.md +++ b/docs/examples/account/update-mfa-challenge.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updateMFAChallenge({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-mfa-recovery-codes.md b/docs/examples/account/update-mfa-recovery-codes.md index b93b22af..8bc8273c 100644 --- a/docs/examples/account/update-mfa-recovery-codes.md +++ b/docs/examples/account/update-mfa-recovery-codes.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.updateMFARecoveryCodes(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-mfa.md b/docs/examples/account/update-mfa.md index 79eb2084..f17ca2b1 100644 --- a/docs/examples/account/update-mfa.md +++ b/docs/examples/account/update-mfa.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.updateMFA({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-name.md b/docs/examples/account/update-name.md index c380d92d..3e184d75 100644 --- a/docs/examples/account/update-name.md +++ b/docs/examples/account/update-name.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.updateName({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-password.md b/docs/examples/account/update-password.md index efbfbdf4..3f87ddc8 100644 --- a/docs/examples/account/update-password.md +++ b/docs/examples/account/update-password.md @@ -1,17 +1,16 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.updatePassword({ password: '', - oldPassword: 'password' // optional + oldPassword: '<OLD_PASSWORD>' // optional }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-phone-session.md b/docs/examples/account/update-phone-session.md index 82846fdc..5352cf0a 100644 --- a/docs/examples/account/update-phone-session.md +++ b/docs/examples/account/update-phone-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updatePhoneSession({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-phone-verification.md b/docs/examples/account/update-phone-verification.md index 9d652b58..2ddd0f13 100644 --- a/docs/examples/account/update-phone-verification.md +++ b/docs/examples/account/update-phone-verification.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updatePhoneVerification({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-phone.md b/docs/examples/account/update-phone.md index 94b13d58..9f640a12 100644 --- a/docs/examples/account/update-phone.md +++ b/docs/examples/account/update-phone.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updatePhone({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-prefs.md b/docs/examples/account/update-prefs.md index be633038..ca2841b7 100644 --- a/docs/examples/account/update-prefs.md +++ b/docs/examples/account/update-prefs.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -17,4 +16,4 @@ const result = await account.updatePrefs({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-push-target.md b/docs/examples/account/update-push-target.md index 89c779c3..7c14aa3b 100644 --- a/docs/examples/account/update-push-target.md +++ b/docs/examples/account/update-push-target.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updatePushTarget({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-recovery.md b/docs/examples/account/update-recovery.md index 4e4f5ed6..e08d48cb 100644 --- a/docs/examples/account/update-recovery.md +++ b/docs/examples/account/update-recovery.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -15,4 +14,4 @@ const result = await account.updateRecovery({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-session.md b/docs/examples/account/update-session.md index 5d630e41..9159580f 100644 --- a/docs/examples/account/update-session.md +++ b/docs/examples/account/update-session.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -13,4 +12,4 @@ const result = await account.updateSession({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-status.md b/docs/examples/account/update-status.md index 76b46596..ac2aa48e 100644 --- a/docs/examples/account/update-status.md +++ b/docs/examples/account/update-status.md @@ -1,15 +1,13 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); const result = await account.updateStatus(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/account/update-verification.md b/docs/examples/account/update-verification.md index 2c760c20..3b52a83c 100644 --- a/docs/examples/account/update-verification.md +++ b/docs/examples/account/update-verification.md @@ -1,10 +1,9 @@ ```javascript import { Client, Account } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const account = new Account(client); @@ -14,4 +13,4 @@ const result = await account.updateVerification({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/activities/get-event.md b/docs/examples/activities/get-event.md deleted file mode 100644 index 675681d9..00000000 --- a/docs/examples/activities/get-event.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Activities } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const activities = new Activities(client); - -const result = await activities.getEvent({ - eventId: '<EVENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/activities/list-events.md b/docs/examples/activities/list-events.md deleted file mode 100644 index 53307864..00000000 --- a/docs/examples/activities/list-events.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Activities } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const activities = new Activities(client); - -const result = await activities.listEvents({ - queries: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/advisor/delete-report.md b/docs/examples/advisor/delete-report.md deleted file mode 100644 index 8c99eac9..00000000 --- a/docs/examples/advisor/delete-report.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Advisor } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const advisor = new Advisor(client); - -const result = await advisor.deleteReport({ - reportId: '<REPORT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/advisor/get-insight.md b/docs/examples/advisor/get-insight.md deleted file mode 100644 index cb50fa74..00000000 --- a/docs/examples/advisor/get-insight.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Advisor } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const advisor = new Advisor(client); - -const result = await advisor.getInsight({ - reportId: '<REPORT_ID>', - insightId: '<INSIGHT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/advisor/get-report.md b/docs/examples/advisor/get-report.md deleted file mode 100644 index ecf4cd44..00000000 --- a/docs/examples/advisor/get-report.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Advisor } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const advisor = new Advisor(client); - -const result = await advisor.getReport({ - reportId: '<REPORT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/advisor/list-insights.md b/docs/examples/advisor/list-insights.md deleted file mode 100644 index 57c30ad5..00000000 --- a/docs/examples/advisor/list-insights.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Advisor } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const advisor = new Advisor(client); - -const result = await advisor.listInsights({ - reportId: '<REPORT_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/advisor/list-reports.md b/docs/examples/advisor/list-reports.md deleted file mode 100644 index 86f677eb..00000000 --- a/docs/examples/advisor/list-reports.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Advisor } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const advisor = new Advisor(client); - -const result = await advisor.listReports({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/apps/create-secret.md b/docs/examples/apps/create-secret.md new file mode 100644 index 00000000..05d0e230 --- /dev/null +++ b/docs/examples/apps/create-secret.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.createSecret({ + appId: '<APP_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/create.md b/docs/examples/apps/create.md new file mode 100644 index 00000000..411ae776 --- /dev/null +++ b/docs/examples/apps/create.md @@ -0,0 +1,21 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.create({ + appId: '<APP_ID>', + name: '<NAME>', + redirectUris: [], + enabled: false, // optional + type: 'public', // optional + deviceFlow: false, // optional + teamId: '<TEAM_ID>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/apps/delete-secret.md b/docs/examples/apps/delete-secret.md new file mode 100644 index 00000000..7f69d060 --- /dev/null +++ b/docs/examples/apps/delete-secret.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.deleteSecret({ + appId: '<APP_ID>', + secretId: '<SECRET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/delete-tokens.md b/docs/examples/apps/delete-tokens.md new file mode 100644 index 00000000..8058f32b --- /dev/null +++ b/docs/examples/apps/delete-tokens.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.deleteTokens({ + appId: '<APP_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/delete.md b/docs/examples/apps/delete.md new file mode 100644 index 00000000..80b9d75f --- /dev/null +++ b/docs/examples/apps/delete.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.delete({ + appId: '<APP_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/get-secret.md b/docs/examples/apps/get-secret.md new file mode 100644 index 00000000..aceb0f8f --- /dev/null +++ b/docs/examples/apps/get-secret.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.getSecret({ + appId: '<APP_ID>', + secretId: '<SECRET_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/get.md b/docs/examples/apps/get.md new file mode 100644 index 00000000..140f43c4 --- /dev/null +++ b/docs/examples/apps/get.md @@ -0,0 +1,15 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.get({ + appId: '<APP_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/list-secrets.md b/docs/examples/apps/list-secrets.md new file mode 100644 index 00000000..a536aeec --- /dev/null +++ b/docs/examples/apps/list-secrets.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.listSecrets({ + appId: '<APP_ID>', + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/apps/list.md b/docs/examples/apps/list.md new file mode 100644 index 00000000..cb64b923 --- /dev/null +++ b/docs/examples/apps/list.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.list({ + queries: [], // optional + total: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/apps/update-team.md b/docs/examples/apps/update-team.md new file mode 100644 index 00000000..6dcdb5db --- /dev/null +++ b/docs/examples/apps/update-team.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.updateTeam({ + appId: '<APP_ID>', + teamId: '<TEAM_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/apps/update.md b/docs/examples/apps/update.md new file mode 100644 index 00000000..54e42c3f --- /dev/null +++ b/docs/examples/apps/update.md @@ -0,0 +1,20 @@ +```javascript +import { Client, Apps } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const apps = new Apps(client); + +const result = await apps.update({ + appId: '<APP_ID>', + name: '<NAME>', + enabled: false, // optional + redirectUris: [], // optional + type: 'public', // optional + deviceFlow: false // optional +}); + +console.log(result); +``` diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 3649b924..d4c1a40f 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -1,10 +1,9 @@ ```javascript import { Client, Avatars, Browser } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -16,4 +15,4 @@ const result = avatars.getBrowser({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index fc340b24..57758501 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -1,10 +1,9 @@ ```javascript import { Client, Avatars, CreditCard } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -16,4 +15,4 @@ const result = avatars.getCreditCard({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/avatars/get-favicon.md b/docs/examples/avatars/get-favicon.md index 11343a93..8b09f65f 100644 --- a/docs/examples/avatars/get-favicon.md +++ b/docs/examples/avatars/get-favicon.md @@ -1,10 +1,9 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -13,4 +12,4 @@ const result = avatars.getFavicon({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index eea92243..d24b9b40 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -1,10 +1,9 @@ ```javascript import { Client, Avatars, Flag } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -16,4 +15,4 @@ const result = avatars.getFlag({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/avatars/get-image.md b/docs/examples/avatars/get-image.md index e03338ca..f8f33731 100644 --- a/docs/examples/avatars/get-image.md +++ b/docs/examples/avatars/get-image.md @@ -1,10 +1,9 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -15,4 +14,4 @@ const result = avatars.getImage({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/avatars/get-initials.md b/docs/examples/avatars/get-initials.md index 0434bcb5..0722a72d 100644 --- a/docs/examples/avatars/get-initials.md +++ b/docs/examples/avatars/get-initials.md @@ -1,10 +1,9 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -16,4 +15,4 @@ const result = avatars.getInitials({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/avatars/get-qr.md b/docs/examples/avatars/get-qr.md index 8cf61e99..829c7121 100644 --- a/docs/examples/avatars/get-qr.md +++ b/docs/examples/avatars/get-qr.md @@ -1,10 +1,9 @@ ```javascript import { Client, Avatars } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -16,4 +15,4 @@ const result = avatars.getQR({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 258984d4..d45f1e6e 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -1,10 +1,9 @@ ```javascript -import { Client, Avatars, Theme, Timezone, BrowserPermission, ImageFormat } from "appwrite"; +import { Client, Avatars, BrowserTheme, Timezone, BrowserPermission, ImageFormat } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const avatars = new Avatars(client); @@ -17,11 +16,11 @@ const result = avatars.getScreenshot({ viewportWidth: 1920, // optional viewportHeight: 1080, // optional scale: 2, // optional - theme: Theme.Dark, // optional + theme: 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: Timezone.AmericaNewYork, // optional + timezone: Timezone.AfricaAbidjan, // optional latitude: 37.7749, // optional longitude: -122.4194, // optional accuracy: 100, // optional @@ -35,4 +34,4 @@ const result = avatars.getScreenshot({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/backups/create-archive.md b/docs/examples/backups/create-archive.md deleted file mode 100644 index 38db2e9b..00000000 --- a/docs/examples/backups/create-archive.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Backups, BackupServices } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.createArchive({ - services: [BackupServices.Databases], - resourceId: '<RESOURCE_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/create-policy.md b/docs/examples/backups/create-policy.md deleted file mode 100644 index 631f97a7..00000000 --- a/docs/examples/backups/create-policy.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Backups, BackupServices } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.createPolicy({ - policyId: '<POLICY_ID>', - services: [BackupServices.Databases], - retention: 1, - schedule: '', - name: '<NAME>', // optional - resourceId: '<RESOURCE_ID>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/create-restoration.md b/docs/examples/backups/create-restoration.md deleted file mode 100644 index d0c68ae8..00000000 --- a/docs/examples/backups/create-restoration.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Backups, BackupServices } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.createRestoration({ - archiveId: '<ARCHIVE_ID>', - services: [BackupServices.Databases], - newResourceId: '<NEW_RESOURCE_ID>', // optional - newResourceName: '<NEW_RESOURCE_NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/delete-archive.md b/docs/examples/backups/delete-archive.md deleted file mode 100644 index 731367cd..00000000 --- a/docs/examples/backups/delete-archive.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.deleteArchive({ - archiveId: '<ARCHIVE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/delete-policy.md b/docs/examples/backups/delete-policy.md deleted file mode 100644 index 0d51d644..00000000 --- a/docs/examples/backups/delete-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.deletePolicy({ - policyId: '<POLICY_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/get-archive.md b/docs/examples/backups/get-archive.md deleted file mode 100644 index 989fdad4..00000000 --- a/docs/examples/backups/get-archive.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.getArchive({ - archiveId: '<ARCHIVE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/get-policy.md b/docs/examples/backups/get-policy.md deleted file mode 100644 index 6a3bf33b..00000000 --- a/docs/examples/backups/get-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.getPolicy({ - policyId: '<POLICY_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/get-restoration.md b/docs/examples/backups/get-restoration.md deleted file mode 100644 index b48d1dc6..00000000 --- a/docs/examples/backups/get-restoration.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.getRestoration({ - restorationId: '<RESTORATION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/list-archives.md b/docs/examples/backups/list-archives.md deleted file mode 100644 index 63f64796..00000000 --- a/docs/examples/backups/list-archives.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.listArchives({ - queries: [] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/list-policies.md b/docs/examples/backups/list-policies.md deleted file mode 100644 index 45a74d9b..00000000 --- a/docs/examples/backups/list-policies.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.listPolicies({ - queries: [] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/list-restorations.md b/docs/examples/backups/list-restorations.md deleted file mode 100644 index e0548a91..00000000 --- a/docs/examples/backups/list-restorations.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.listRestorations({ - queries: [] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/backups/update-policy.md b/docs/examples/backups/update-policy.md deleted file mode 100644 index 805a753f..00000000 --- a/docs/examples/backups/update-policy.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Backups } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const backups = new Backups(client); - -const result = await backups.updatePolicy({ - policyId: '<POLICY_ID>', - name: '<NAME>', // optional - retention: 1, // optional - schedule: '', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 3b58d773..00000000 --- a/docs/examples/databases/create-big-int-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-boolean-attribute.md b/docs/examples/databases/create-boolean-attribute.md deleted file mode 100644 index dbaa56dd..00000000 --- a/docs/examples/databases/create-boolean-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createBooleanAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: false, // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-collection.md b/docs/examples/databases/create-collection.md deleted file mode 100644 index ab6ef901..00000000 --- a/docs/examples/databases/create-collection.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases, Permission, Role } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - documentSecurity: false, // optional - enabled: false, // optional - attributes: [], // optional - indexes: [] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-datetime-attribute.md b/docs/examples/databases/create-datetime-attribute.md deleted file mode 100644 index 289a3b82..00000000 --- a/docs/examples/databases/create-datetime-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 81828da5..4d8d7f90 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -24,4 +23,4 @@ const result = await databases.createDocument({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/create-documents.md b/docs/examples/databases/create-documents.md deleted file mode 100644 index 1361dd01..00000000 --- a/docs/examples/databases/create-documents.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createDocuments({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documents: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-email-attribute.md b/docs/examples/databases/create-email-attribute.md deleted file mode 100644 index 52a86854..00000000 --- a/docs/examples/databases/create-email-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createEmailAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'email@example.com', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-enum-attribute.md b/docs/examples/databases/create-enum-attribute.md deleted file mode 100644 index 287370f1..00000000 --- a/docs/examples/databases/create-enum-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createEnumAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-float-attribute.md b/docs/examples/databases/create-float-attribute.md deleted file mode 100644 index a13e3356..00000000 --- a/docs/examples/databases/create-float-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-index.md b/docs/examples/databases/create-index.md deleted file mode 100644 index e2e9f681..00000000 --- a/docs/examples/databases/create-index.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases, DatabasesIndexType, OrderBy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createIndex({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - type: DatabasesIndexType.Key, - attributes: [], - orders: [OrderBy.Asc], // optional - lengths: [] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-integer-attribute.md b/docs/examples/databases/create-integer-attribute.md deleted file mode 100644 index c7787f96..00000000 --- a/docs/examples/databases/create-integer-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-ip-attribute.md b/docs/examples/databases/create-ip-attribute.md deleted file mode 100644 index c5051ba8..00000000 --- a/docs/examples/databases/create-ip-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createIpAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-line-attribute.md b/docs/examples/databases/create-line-attribute.md deleted file mode 100644 index 83d0c20f..00000000 --- a/docs/examples/databases/create-line-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createLineAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-longtext-attribute.md b/docs/examples/databases/create-longtext-attribute.md deleted file mode 100644 index 8b72342d..00000000 --- a/docs/examples/databases/create-longtext-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-mediumtext-attribute.md b/docs/examples/databases/create-mediumtext-attribute.md deleted file mode 100644 index a04ab8c5..00000000 --- a/docs/examples/databases/create-mediumtext-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-operations.md b/docs/examples/databases/create-operations.md index 34ee30a8..48c74718 100644 --- a/docs/examples/databases/create-operations.md +++ b/docs/examples/databases/create-operations.md @@ -1,11 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -25,4 +23,4 @@ const result = await databases.createOperations({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/create-point-attribute.md b/docs/examples/databases/create-point-attribute.md deleted file mode 100644 index a62d8dee..00000000 --- a/docs/examples/databases/create-point-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createPointAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [1, 2] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-polygon-attribute.md b/docs/examples/databases/create-polygon-attribute.md deleted file mode 100644 index 1f3d33e3..00000000 --- a/docs/examples/databases/create-polygon-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-relationship-attribute.md b/docs/examples/databases/create-relationship-attribute.md deleted file mode 100644 index 1f332983..00000000 --- a/docs/examples/databases/create-relationship-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases, RelationshipType, RelationMutate } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createRelationshipAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - relatedCollectionId: '<RELATED_COLLECTION_ID>', - type: RelationshipType.OneToOne, - twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: RelationMutate.Cascade // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-string-attribute.md b/docs/examples/databases/create-string-attribute.md deleted file mode 100644 index b745b066..00000000 --- a/docs/examples/databases/create-string-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-text-attribute.md b/docs/examples/databases/create-text-attribute.md deleted file mode 100644 index 3c848a44..00000000 --- a/docs/examples/databases/create-text-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-transaction.md b/docs/examples/databases/create-transaction.md index 3d92a03c..eab2aa52 100644 --- a/docs/examples/databases/create-transaction.md +++ b/docs/examples/databases/create-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -14,4 +12,4 @@ const result = await databases.createTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/create-url-attribute.md b/docs/examples/databases/create-url-attribute.md deleted file mode 100644 index fe65eb10..00000000 --- a/docs/examples/databases/create-url-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.createUrlAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'https://example.com', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create-varchar-attribute.md b/docs/examples/databases/create-varchar-attribute.md deleted file mode 100644 index 1c59217e..00000000 --- a/docs/examples/databases/create-varchar-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/create.md b/docs/examples/databases/create.md deleted file mode 100644 index 9669d1b9..00000000 --- a/docs/examples/databases/create.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.create({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/decrement-document-attribute.md b/docs/examples/databases/decrement-document-attribute.md index 87812337..c657bd49 100644 --- a/docs/examples/databases/decrement-document-attribute.md +++ b/docs/examples/databases/decrement-document-attribute.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -19,4 +18,4 @@ const result = await databases.decrementDocumentAttribute({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/delete-attribute.md b/docs/examples/databases/delete-attribute.md deleted file mode 100644 index 9d7c5ca6..00000000 --- a/docs/examples/databases/delete-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.deleteAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/delete-collection.md b/docs/examples/databases/delete-collection.md deleted file mode 100644 index fbc73376..00000000 --- a/docs/examples/databases/delete-collection.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.deleteCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/delete-document.md b/docs/examples/databases/delete-document.md index 3a8b3f37..95665088 100644 --- a/docs/examples/databases/delete-document.md +++ b/docs/examples/databases/delete-document.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -16,4 +15,4 @@ const result = await databases.deleteDocument({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/delete-documents.md b/docs/examples/databases/delete-documents.md deleted file mode 100644 index 392547b5..00000000 --- a/docs/examples/databases/delete-documents.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.deleteDocuments({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/delete-index.md b/docs/examples/databases/delete-index.md deleted file mode 100644 index 605cfaf7..00000000 --- a/docs/examples/databases/delete-index.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.deleteIndex({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/delete-transaction.md b/docs/examples/databases/delete-transaction.md index 9a46ece0..2e41d9be 100644 --- a/docs/examples/databases/delete-transaction.md +++ b/docs/examples/databases/delete-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -14,4 +12,4 @@ const result = await databases.deleteTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/delete.md b/docs/examples/databases/delete.md deleted file mode 100644 index 096dbb99..00000000 --- a/docs/examples/databases/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.delete({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/get-attribute.md b/docs/examples/databases/get-attribute.md deleted file mode 100644 index a150bf5a..00000000 --- a/docs/examples/databases/get-attribute.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.getAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/get-collection.md b/docs/examples/databases/get-collection.md deleted file mode 100644 index ccf0a4a9..00000000 --- a/docs/examples/databases/get-collection.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.getCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/get-document.md b/docs/examples/databases/get-document.md index 6385c6bb..ad11eb8d 100644 --- a/docs/examples/databases/get-document.md +++ b/docs/examples/databases/get-document.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -17,4 +16,4 @@ const result = await databases.getDocument({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/get-index.md b/docs/examples/databases/get-index.md deleted file mode 100644 index 1011e293..00000000 --- a/docs/examples/databases/get-index.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.getIndex({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/get-transaction.md b/docs/examples/databases/get-transaction.md index 68b42eb3..2419a8c0 100644 --- a/docs/examples/databases/get-transaction.md +++ b/docs/examples/databases/get-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -14,4 +12,4 @@ const result = await databases.getTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/get.md b/docs/examples/databases/get.md deleted file mode 100644 index 4a84961f..00000000 --- a/docs/examples/databases/get.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.get({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/increment-document-attribute.md b/docs/examples/databases/increment-document-attribute.md index ae91f08a..51eec6d5 100644 --- a/docs/examples/databases/increment-document-attribute.md +++ b/docs/examples/databases/increment-document-attribute.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -19,4 +18,4 @@ const result = await databases.incrementDocumentAttribute({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/list-attributes.md b/docs/examples/databases/list-attributes.md deleted file mode 100644 index 6c491c69..00000000 --- a/docs/examples/databases/list-attributes.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.listAttributes({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/list-collections.md b/docs/examples/databases/list-collections.md deleted file mode 100644 index e3cfb645..00000000 --- a/docs/examples/databases/list-collections.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.listCollections({ - databaseId: '<DATABASE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/list-documents.md b/docs/examples/databases/list-documents.md index ff7dc7bf..5444dffb 100644 --- a/docs/examples/databases/list-documents.md +++ b/docs/examples/databases/list-documents.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -18,4 +17,4 @@ const result = await databases.listDocuments({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/list-indexes.md b/docs/examples/databases/list-indexes.md deleted file mode 100644 index 3a35f618..00000000 --- a/docs/examples/databases/list-indexes.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.listIndexes({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/list-transactions.md b/docs/examples/databases/list-transactions.md index c0e40ca4..6a74afc0 100644 --- a/docs/examples/databases/list-transactions.md +++ b/docs/examples/databases/list-transactions.md @@ -1,11 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -14,4 +12,4 @@ const result = await databases.listTransactions({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/list.md b/docs/examples/databases/list.md deleted file mode 100644 index 106511cf..00000000 --- a/docs/examples/databases/list.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 73581c5d..00000000 --- a/docs/examples/databases/update-big-int-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md deleted file mode 100644 index 8b74501d..00000000 --- a/docs/examples/databases/update-boolean-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateBooleanAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: false, - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-collection.md b/docs/examples/databases/update-collection.md deleted file mode 100644 index 61ce04f4..00000000 --- a/docs/examples/databases/update-collection.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases, Permission, Role } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateCollection({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - name: '<NAME>', // optional - permissions: [Permission.read(Role.any())], // optional - documentSecurity: false, // optional - enabled: false, // optional - purge: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md deleted file mode 100644 index 6858bec2..00000000 --- a/docs/examples/databases/update-datetime-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 604ca741..df5651d8 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -24,4 +23,4 @@ const result = await databases.updateDocument({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/update-documents.md b/docs/examples/databases/update-documents.md deleted file mode 100644 index 2a25921f..00000000 --- a/docs/examples/databases/update-documents.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md deleted file mode 100644 index 90102cf2..00000000 --- a/docs/examples/databases/update-email-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateEmailAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'email@example.com', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md deleted file mode 100644 index 1725e206..00000000 --- a/docs/examples/databases/update-enum-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateEnumAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md deleted file mode 100644 index 7b1bd28b..00000000 --- a/docs/examples/databases/update-float-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md deleted file mode 100644 index ca2bb467..00000000 --- a/docs/examples/databases/update-integer-attribute.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md deleted file mode 100644 index 35a11447..00000000 --- a/docs/examples/databases/update-ip-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateIpAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-line-attribute.md b/docs/examples/databases/update-line-attribute.md deleted file mode 100644 index 2b690dbf..00000000 --- a/docs/examples/databases/update-line-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md deleted file mode 100644 index 1468025f..00000000 --- a/docs/examples/databases/update-longtext-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateLongtextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md deleted file mode 100644 index 12ba2807..00000000 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateMediumtextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-point-attribute.md b/docs/examples/databases/update-point-attribute.md deleted file mode 100644 index ae819fc9..00000000 --- a/docs/examples/databases/update-point-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updatePointAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: [1, 2], // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-polygon-attribute.md b/docs/examples/databases/update-polygon-attribute.md deleted file mode 100644 index 814178af..00000000 --- a/docs/examples/databases/update-polygon-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-relationship-attribute.md b/docs/examples/databases/update-relationship-attribute.md deleted file mode 100644 index b8e543e3..00000000 --- a/docs/examples/databases/update-relationship-attribute.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Databases, RelationMutate } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateRelationshipAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - onDelete: RelationMutate.Cascade, // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md deleted file mode 100644 index 4c575dbb..00000000 --- a/docs/examples/databases/update-string-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateStringAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md deleted file mode 100644 index cbc8afde..00000000 --- a/docs/examples/databases/update-text-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateTextAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-transaction.md b/docs/examples/databases/update-transaction.md index 620dae1d..5a50ef67 100644 --- a/docs/examples/databases/update-transaction.md +++ b/docs/examples/databases/update-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, Databases } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -16,4 +14,4 @@ const result = await databases.updateTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md deleted file mode 100644 index d9db1973..00000000 --- a/docs/examples/databases/update-url-attribute.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateUrlAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: 'https://example.com', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md deleted file mode 100644 index 09f5816c..00000000 --- a/docs/examples/databases/update-varchar-attribute.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.updateVarcharAttribute({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/update.md b/docs/examples/databases/update.md deleted file mode 100644 index a1001fab..00000000 --- a/docs/examples/databases/update.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.update({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 6edb42f6..212964a6 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -1,10 +1,9 @@ ```javascript import { Client, Databases, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const databases = new Databases(client); @@ -24,4 +23,4 @@ const result = await databases.upsertDocument({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/databases/upsert-documents.md b/docs/examples/databases/upsert-documents.md deleted file mode 100644 index b642efaf..00000000 --- a/docs/examples/databases/upsert-documents.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Databases } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const databases = new Databases(client); - -const result = await databases.upsertDocuments({ - databaseId: '<DATABASE_ID>', - collectionId: '<COLLECTION_ID>', - documents: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/create-deployment.md b/docs/examples/functions/create-deployment.md deleted file mode 100644 index 448c00da..00000000 --- a/docs/examples/functions/create-deployment.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.createDeployment({ - functionId: '<FUNCTION_ID>', - code: document.getElementById('uploader').files[0], - activate: false, - entrypoint: '<ENTRYPOINT>', // optional - commands: '<COMMANDS>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/create-duplicate-deployment.md b/docs/examples/functions/create-duplicate-deployment.md deleted file mode 100644 index ee9e11ad..00000000 --- a/docs/examples/functions/create-duplicate-deployment.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.createDuplicateDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', - buildId: '<BUILD_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/create-execution.md b/docs/examples/functions/create-execution.md index 7538c329..71dd8cc3 100644 --- a/docs/examples/functions/create-execution.md +++ b/docs/examples/functions/create-execution.md @@ -1,10 +1,9 @@ ```javascript import { Client, Functions, ExecutionMethod } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const functions = new Functions(client); @@ -19,4 +18,4 @@ const result = await functions.createExecution({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/functions/create-template-deployment.md b/docs/examples/functions/create-template-deployment.md deleted file mode 100644 index 04e5830a..00000000 --- a/docs/examples/functions/create-template-deployment.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Functions, TemplateReferenceType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.createTemplateDeployment({ - functionId: '<FUNCTION_ID>', - repository: '<REPOSITORY>', - owner: '<OWNER>', - rootDirectory: '<ROOT_DIRECTORY>', - type: TemplateReferenceType.Commit, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/create-variable.md b/docs/examples/functions/create-variable.md deleted file mode 100644 index 76f9a315..00000000 --- a/docs/examples/functions/create-variable.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.createVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/create-vcs-deployment.md b/docs/examples/functions/create-vcs-deployment.md deleted file mode 100644 index ac83b178..00000000 --- a/docs/examples/functions/create-vcs-deployment.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Functions, VCSReferenceType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.createVcsDeployment({ - functionId: '<FUNCTION_ID>', - type: VCSReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md deleted file mode 100644 index 9db1b3e1..00000000 --- a/docs/examples/functions/create.md +++ /dev/null @@ -1,36 +0,0 @@ -```javascript -import { Client, Functions, Runtime, Scopes } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.create({ - functionId: '<FUNCTION_ID>', - name: '<NAME>', - runtime: 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: [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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/delete-deployment.md b/docs/examples/functions/delete-deployment.md deleted file mode 100644 index de513094..00000000 --- a/docs/examples/functions/delete-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.deleteDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/delete-execution.md b/docs/examples/functions/delete-execution.md deleted file mode 100644 index 4351cc8c..00000000 --- a/docs/examples/functions/delete-execution.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.deleteExecution({ - functionId: '<FUNCTION_ID>', - executionId: '<EXECUTION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/delete-variable.md b/docs/examples/functions/delete-variable.md deleted file mode 100644 index c3133db1..00000000 --- a/docs/examples/functions/delete-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.deleteVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/delete.md b/docs/examples/functions/delete.md deleted file mode 100644 index f297b6f8..00000000 --- a/docs/examples/functions/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.delete({ - functionId: '<FUNCTION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/get-deployment-download.md b/docs/examples/functions/get-deployment-download.md deleted file mode 100644 index eb8c7bee..00000000 --- a/docs/examples/functions/get-deployment-download.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Functions, DeploymentDownloadType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = functions.getDeploymentDownload({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>', - type: DeploymentDownloadType.Source // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/get-deployment.md b/docs/examples/functions/get-deployment.md deleted file mode 100644 index f12ac97e..00000000 --- a/docs/examples/functions/get-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.getDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/get-execution.md b/docs/examples/functions/get-execution.md index 978fa2ec..a9b22e29 100644 --- a/docs/examples/functions/get-execution.md +++ b/docs/examples/functions/get-execution.md @@ -1,10 +1,9 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const functions = new Functions(client); @@ -14,4 +13,4 @@ const result = await functions.getExecution({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/functions/get-variable.md b/docs/examples/functions/get-variable.md deleted file mode 100644 index 4db7a86c..00000000 --- a/docs/examples/functions/get-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.getVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/get.md b/docs/examples/functions/get.md deleted file mode 100644 index bfb693a2..00000000 --- a/docs/examples/functions/get.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.get({ - functionId: '<FUNCTION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/list-deployments.md b/docs/examples/functions/list-deployments.md deleted file mode 100644 index bc6291b1..00000000 --- a/docs/examples/functions/list-deployments.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.listDeployments({ - functionId: '<FUNCTION_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index c73e944a..55aa3cb7 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -1,10 +1,9 @@ ```javascript import { Client, Functions } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const functions = new Functions(client); @@ -15,4 +14,4 @@ const result = await functions.listExecutions({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/functions/list-runtimes.md b/docs/examples/functions/list-runtimes.md deleted file mode 100644 index 189a1fe3..00000000 --- a/docs/examples/functions/list-runtimes.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.listRuntimes(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/list-specifications.md b/docs/examples/functions/list-specifications.md deleted file mode 100644 index d777a8f5..00000000 --- a/docs/examples/functions/list-specifications.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.listSpecifications(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/list-variables.md b/docs/examples/functions/list-variables.md deleted file mode 100644 index 7a070c32..00000000 --- a/docs/examples/functions/list-variables.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.listVariables({ - functionId: '<FUNCTION_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/list.md b/docs/examples/functions/list.md deleted file mode 100644 index af3daf03..00000000 --- a/docs/examples/functions/list.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/update-deployment-status.md b/docs/examples/functions/update-deployment-status.md deleted file mode 100644 index 58e75b59..00000000 --- a/docs/examples/functions/update-deployment-status.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.updateDeploymentStatus({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/update-function-deployment.md b/docs/examples/functions/update-function-deployment.md deleted file mode 100644 index 5d1641bb..00000000 --- a/docs/examples/functions/update-function-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.updateFunctionDeployment({ - functionId: '<FUNCTION_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/update-variable.md b/docs/examples/functions/update-variable.md deleted file mode 100644 index 570ada49..00000000 --- a/docs/examples/functions/update-variable.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Functions } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.updateVariable({ - functionId: '<FUNCTION_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md deleted file mode 100644 index f69c9d75..00000000 --- a/docs/examples/functions/update.md +++ /dev/null @@ -1,36 +0,0 @@ -```javascript -import { Client, Functions, Runtime, Scopes } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const functions = new Functions(client); - -const result = await functions.update({ - functionId: '<FUNCTION_ID>', - name: '<NAME>', - runtime: 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: [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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/graphql/mutation.md b/docs/examples/graphql/mutation.md index 148cc83b..a0230ef6 100644 --- a/docs/examples/graphql/mutation.md +++ b/docs/examples/graphql/mutation.md @@ -1,11 +1,9 @@ ```javascript import { Client, Graphql } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const graphql = new Graphql(client); @@ -14,4 +12,4 @@ const result = await graphql.mutation({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/graphql/query.md b/docs/examples/graphql/query.md index cd9acbbc..bef786ab 100644 --- a/docs/examples/graphql/query.md +++ b/docs/examples/graphql/query.md @@ -1,11 +1,9 @@ ```javascript import { Client, Graphql } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const graphql = new Graphql(client); @@ -14,4 +12,4 @@ const result = await graphql.query({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/health/get-antivirus.md b/docs/examples/health/get-antivirus.md deleted file mode 100644 index ece01fce..00000000 --- a/docs/examples/health/get-antivirus.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getAntivirus(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-cache.md b/docs/examples/health/get-cache.md deleted file mode 100644 index df446b93..00000000 --- a/docs/examples/health/get-cache.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getCache(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-certificate.md b/docs/examples/health/get-certificate.md deleted file mode 100644 index 326f2c59..00000000 --- a/docs/examples/health/get-certificate.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getCertificate({ - domain: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-console-pausing.md b/docs/examples/health/get-console-pausing.md deleted file mode 100644 index 40875cf4..00000000 --- a/docs/examples/health/get-console-pausing.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getConsolePausing({ - threshold: null, // optional - inactivityDays: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-db.md b/docs/examples/health/get-db.md deleted file mode 100644 index 81a65c77..00000000 --- a/docs/examples/health/get-db.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getDB(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-failed-jobs.md b/docs/examples/health/get-failed-jobs.md deleted file mode 100644 index 263f3a38..00000000 --- a/docs/examples/health/get-failed-jobs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Health, Name } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getFailedJobs({ - name: Name.V1Database, - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-pub-sub.md b/docs/examples/health/get-pub-sub.md deleted file mode 100644 index 7892d241..00000000 --- a/docs/examples/health/get-pub-sub.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getPubSub(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-audits.md b/docs/examples/health/get-queue-audits.md deleted file mode 100644 index 5c56db40..00000000 --- a/docs/examples/health/get-queue-audits.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueAudits({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-builds.md b/docs/examples/health/get-queue-builds.md deleted file mode 100644 index 7fc7d687..00000000 --- a/docs/examples/health/get-queue-builds.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueBuilds({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-certificates.md b/docs/examples/health/get-queue-certificates.md deleted file mode 100644 index 0aa0291a..00000000 --- a/docs/examples/health/get-queue-certificates.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueCertificates({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-databases.md b/docs/examples/health/get-queue-databases.md deleted file mode 100644 index ea4c16c9..00000000 --- a/docs/examples/health/get-queue-databases.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueDatabases({ - name: '<NAME>', // optional - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-deletes.md b/docs/examples/health/get-queue-deletes.md deleted file mode 100644 index 823a8164..00000000 --- a/docs/examples/health/get-queue-deletes.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueDeletes({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-functions.md b/docs/examples/health/get-queue-functions.md deleted file mode 100644 index 4cf297cd..00000000 --- a/docs/examples/health/get-queue-functions.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueFunctions({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-logs.md b/docs/examples/health/get-queue-logs.md deleted file mode 100644 index f9d4b76c..00000000 --- a/docs/examples/health/get-queue-logs.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueLogs({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-mails.md b/docs/examples/health/get-queue-mails.md deleted file mode 100644 index daf6643c..00000000 --- a/docs/examples/health/get-queue-mails.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueMails({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-messaging.md b/docs/examples/health/get-queue-messaging.md deleted file mode 100644 index 81435a16..00000000 --- a/docs/examples/health/get-queue-messaging.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueMessaging({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-migrations.md b/docs/examples/health/get-queue-migrations.md deleted file mode 100644 index e536351e..00000000 --- a/docs/examples/health/get-queue-migrations.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueMigrations({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file 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 18ff25fb..00000000 --- a/docs/examples/health/get-queue-stats-resources.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueStatsResources({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-usage.md b/docs/examples/health/get-queue-usage.md deleted file mode 100644 index f19c738f..00000000 --- a/docs/examples/health/get-queue-usage.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueUsage({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-queue-webhooks.md b/docs/examples/health/get-queue-webhooks.md deleted file mode 100644 index 00b98b99..00000000 --- a/docs/examples/health/get-queue-webhooks.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getQueueWebhooks({ - threshold: null // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-storage-local.md b/docs/examples/health/get-storage-local.md deleted file mode 100644 index 7c69dd9f..00000000 --- a/docs/examples/health/get-storage-local.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getStorageLocal(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-storage.md b/docs/examples/health/get-storage.md deleted file mode 100644 index d396b75b..00000000 --- a/docs/examples/health/get-storage.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getStorage(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get-time.md b/docs/examples/health/get-time.md deleted file mode 100644 index 1b3a044b..00000000 --- a/docs/examples/health/get-time.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.getTime(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/health/get.md b/docs/examples/health/get.md deleted file mode 100644 index 040bd454..00000000 --- a/docs/examples/health/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Health } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const health = new Health(client); - -const result = await health.get(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/locale/get.md b/docs/examples/locale/get.md index 3f5672cf..95e92c4c 100644 --- a/docs/examples/locale/get.md +++ b/docs/examples/locale/get.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.get(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/locale/list-codes.md b/docs/examples/locale/list-codes.md index fb8d7108..d6e9d33b 100644 --- a/docs/examples/locale/list-codes.md +++ b/docs/examples/locale/list-codes.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.listCodes(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/locale/list-continents.md b/docs/examples/locale/list-continents.md index e28b7886..6af2b7f4 100644 --- a/docs/examples/locale/list-continents.md +++ b/docs/examples/locale/list-continents.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.listContinents(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/locale/list-countries-eu.md b/docs/examples/locale/list-countries-eu.md index 972e887a..92b3fa08 100644 --- a/docs/examples/locale/list-countries-eu.md +++ b/docs/examples/locale/list-countries-eu.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.listCountriesEU(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/locale/list-countries-phones.md b/docs/examples/locale/list-countries-phones.md index 9104141c..517a19a3 100644 --- a/docs/examples/locale/list-countries-phones.md +++ b/docs/examples/locale/list-countries-phones.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.listCountriesPhones(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/locale/list-countries.md b/docs/examples/locale/list-countries.md index f0b2e810..f92f9985 100644 --- a/docs/examples/locale/list-countries.md +++ b/docs/examples/locale/list-countries.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.listCountries(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/locale/list-currencies.md b/docs/examples/locale/list-currencies.md index 6782410d..50c0f222 100644 --- a/docs/examples/locale/list-currencies.md +++ b/docs/examples/locale/list-currencies.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.listCurrencies(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/locale/list-languages.md b/docs/examples/locale/list-languages.md index 2c118e09..a3afe001 100644 --- a/docs/examples/locale/list-languages.md +++ b/docs/examples/locale/list-languages.md @@ -1,15 +1,13 @@ ```javascript import { Client, Locale } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const locale = new Locale(client); const result = await locale.listLanguages(); - console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/messaging/create-apns-provider.md b/docs/examples/messaging/create-apns-provider.md deleted file mode 100644 index f3a9ee79..00000000 --- a/docs/examples/messaging/create-apns-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-email.md b/docs/examples/messaging/create-email.md deleted file mode 100644 index 7e3ed5b9..00000000 --- a/docs/examples/messaging/create-email.md +++ /dev/null @@ -1,28 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-fcm-provider.md b/docs/examples/messaging/create-fcm-provider.md deleted file mode 100644 index 4266a02c..00000000 --- a/docs/examples/messaging/create-fcm-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.createFCMProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - serviceAccountJSON: {}, // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-mailgun-provider.md b/docs/examples/messaging/create-mailgun-provider.md deleted file mode 100644 index b531f8ba..00000000 --- a/docs/examples/messaging/create-mailgun-provider.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file 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 ce64f78b..00000000 --- a/docs/examples/messaging/create-msg-91-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-push.md b/docs/examples/messaging/create-push.md deleted file mode 100644 index 6bbbad98..00000000 --- a/docs/examples/messaging/create-push.md +++ /dev/null @@ -1,35 +0,0 @@ -```javascript -import { Client, Messaging, MessagePriority } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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: MessagePriority.Normal // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-resend-provider.md b/docs/examples/messaging/create-resend-provider.md deleted file mode 100644 index 3c22546a..00000000 --- a/docs/examples/messaging/create-resend-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-sendgrid-provider.md b/docs/examples/messaging/create-sendgrid-provider.md deleted file mode 100644 index 757abe3f..00000000 --- a/docs/examples/messaging/create-sendgrid-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-sms.md b/docs/examples/messaging/create-sms.md deleted file mode 100644 index 6f8884db..00000000 --- a/docs/examples/messaging/create-sms.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-smtp-provider.md b/docs/examples/messaging/create-smtp-provider.md deleted file mode 100644 index 1db9e186..00000000 --- a/docs/examples/messaging/create-smtp-provider.md +++ /dev/null @@ -1,30 +0,0 @@ -```javascript -import { Client, Messaging, SmtpEncryption } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.createSMTPProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', - host: '<HOST>', - port: 1, // optional - username: '<USERNAME>', // optional - password: '<PASSWORD>', // optional - encryption: 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-subscriber.md b/docs/examples/messaging/create-subscriber.md index dafae8dd..c29c2f71 100644 --- a/docs/examples/messaging/create-subscriber.md +++ b/docs/examples/messaging/create-subscriber.md @@ -1,11 +1,9 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = Client.fromJWT({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - jwt: '<YOUR_JWT>' // Your secret JSON Web Token -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const messaging = new Messaging(client); @@ -16,4 +14,4 @@ const result = await messaging.createSubscriber({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/messaging/create-telesign-provider.md b/docs/examples/messaging/create-telesign-provider.md deleted file mode 100644 index 725dbd73..00000000 --- a/docs/examples/messaging/create-telesign-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-textmagic-provider.md b/docs/examples/messaging/create-textmagic-provider.md deleted file mode 100644 index 3f6d6fd4..00000000 --- a/docs/examples/messaging/create-textmagic-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-topic.md b/docs/examples/messaging/create-topic.md deleted file mode 100644 index abcd1729..00000000 --- a/docs/examples/messaging/create-topic.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.createTopic({ - topicId: '<TOPIC_ID>', - name: '<NAME>', - subscribe: ["any"] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-twilio-provider.md b/docs/examples/messaging/create-twilio-provider.md deleted file mode 100644 index 4b67a61e..00000000 --- a/docs/examples/messaging/create-twilio-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/create-vonage-provider.md b/docs/examples/messaging/create-vonage-provider.md deleted file mode 100644 index f41b1ce7..00000000 --- a/docs/examples/messaging/create-vonage-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/delete-provider.md b/docs/examples/messaging/delete-provider.md deleted file mode 100644 index 77e1c003..00000000 --- a/docs/examples/messaging/delete-provider.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.deleteProvider({ - providerId: '<PROVIDER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/delete-subscriber.md b/docs/examples/messaging/delete-subscriber.md index 8cac30c1..acd0be51 100644 --- a/docs/examples/messaging/delete-subscriber.md +++ b/docs/examples/messaging/delete-subscriber.md @@ -1,11 +1,9 @@ ```javascript import { Client, Messaging } from "appwrite"; -const client = Client.fromJWT({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - jwt: '<YOUR_JWT>' // Your secret JSON Web Token -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const messaging = new Messaging(client); @@ -15,4 +13,4 @@ const result = await messaging.deleteSubscriber({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/messaging/delete-topic.md b/docs/examples/messaging/delete-topic.md deleted file mode 100644 index 3dc0c076..00000000 --- a/docs/examples/messaging/delete-topic.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.deleteTopic({ - topicId: '<TOPIC_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/delete.md b/docs/examples/messaging/delete.md deleted file mode 100644 index d0345472..00000000 --- a/docs/examples/messaging/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.delete({ - messageId: '<MESSAGE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/get-message.md b/docs/examples/messaging/get-message.md deleted file mode 100644 index 1e216294..00000000 --- a/docs/examples/messaging/get-message.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.getMessage({ - messageId: '<MESSAGE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/get-provider.md b/docs/examples/messaging/get-provider.md deleted file mode 100644 index cbc20a70..00000000 --- a/docs/examples/messaging/get-provider.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.getProvider({ - providerId: '<PROVIDER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/get-subscriber.md b/docs/examples/messaging/get-subscriber.md deleted file mode 100644 index 142e9fe3..00000000 --- a/docs/examples/messaging/get-subscriber.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.getSubscriber({ - topicId: '<TOPIC_ID>', - subscriberId: '<SUBSCRIBER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/get-topic.md b/docs/examples/messaging/get-topic.md deleted file mode 100644 index 5eeb2b1c..00000000 --- a/docs/examples/messaging/get-topic.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.getTopic({ - topicId: '<TOPIC_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-message-logs.md b/docs/examples/messaging/list-message-logs.md deleted file mode 100644 index d0204e6a..00000000 --- a/docs/examples/messaging/list-message-logs.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listMessageLogs({ - messageId: '<MESSAGE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-messages.md b/docs/examples/messaging/list-messages.md deleted file mode 100644 index ca77d1b2..00000000 --- a/docs/examples/messaging/list-messages.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listMessages({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-provider-logs.md b/docs/examples/messaging/list-provider-logs.md deleted file mode 100644 index 41c2a6ff..00000000 --- a/docs/examples/messaging/list-provider-logs.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listProviderLogs({ - providerId: '<PROVIDER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-providers.md b/docs/examples/messaging/list-providers.md deleted file mode 100644 index 13816a92..00000000 --- a/docs/examples/messaging/list-providers.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listProviders({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-subscriber-logs.md b/docs/examples/messaging/list-subscriber-logs.md deleted file mode 100644 index 0835310b..00000000 --- a/docs/examples/messaging/list-subscriber-logs.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listSubscriberLogs({ - subscriberId: '<SUBSCRIBER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-subscribers.md b/docs/examples/messaging/list-subscribers.md deleted file mode 100644 index 0b7c023c..00000000 --- a/docs/examples/messaging/list-subscribers.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listSubscribers({ - topicId: '<TOPIC_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-targets.md b/docs/examples/messaging/list-targets.md deleted file mode 100644 index 572eb068..00000000 --- a/docs/examples/messaging/list-targets.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listTargets({ - messageId: '<MESSAGE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-topic-logs.md b/docs/examples/messaging/list-topic-logs.md deleted file mode 100644 index 5a8f97ec..00000000 --- a/docs/examples/messaging/list-topic-logs.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listTopicLogs({ - topicId: '<TOPIC_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/list-topics.md b/docs/examples/messaging/list-topics.md deleted file mode 100644 index 608a7421..00000000 --- a/docs/examples/messaging/list-topics.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.listTopics({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-apns-provider.md b/docs/examples/messaging/update-apns-provider.md deleted file mode 100644 index 2b51ff50..00000000 --- a/docs/examples/messaging/update-apns-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-email.md b/docs/examples/messaging/update-email.md deleted file mode 100644 index 909e461d..00000000 --- a/docs/examples/messaging/update-email.md +++ /dev/null @@ -1,28 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-fcm-provider.md b/docs/examples/messaging/update-fcm-provider.md deleted file mode 100644 index 23866d26..00000000 --- a/docs/examples/messaging/update-fcm-provider.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.updateFCMProvider({ - providerId: '<PROVIDER_ID>', - name: '<NAME>', // optional - enabled: false, // optional - serviceAccountJSON: {} // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-mailgun-provider.md b/docs/examples/messaging/update-mailgun-provider.md deleted file mode 100644 index c4284655..00000000 --- a/docs/examples/messaging/update-mailgun-provider.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file 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 7910b102..00000000 --- a/docs/examples/messaging/update-msg-91-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-push.md b/docs/examples/messaging/update-push.md deleted file mode 100644 index c4640c72..00000000 --- a/docs/examples/messaging/update-push.md +++ /dev/null @@ -1,35 +0,0 @@ -```javascript -import { Client, Messaging, MessagePriority } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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: MessagePriority.Normal // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-resend-provider.md b/docs/examples/messaging/update-resend-provider.md deleted file mode 100644 index fd929164..00000000 --- a/docs/examples/messaging/update-resend-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-sendgrid-provider.md b/docs/examples/messaging/update-sendgrid-provider.md deleted file mode 100644 index 6ee6a304..00000000 --- a/docs/examples/messaging/update-sendgrid-provider.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-sms.md b/docs/examples/messaging/update-sms.md deleted file mode 100644 index 7a0552e7..00000000 --- a/docs/examples/messaging/update-sms.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-smtp-provider.md b/docs/examples/messaging/update-smtp-provider.md deleted file mode 100644 index 7158f1cc..00000000 --- a/docs/examples/messaging/update-smtp-provider.md +++ /dev/null @@ -1,30 +0,0 @@ -```javascript -import { Client, Messaging, SmtpEncryption } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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: 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-telesign-provider.md b/docs/examples/messaging/update-telesign-provider.md deleted file mode 100644 index d5afee0f..00000000 --- a/docs/examples/messaging/update-telesign-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-textmagic-provider.md b/docs/examples/messaging/update-textmagic-provider.md deleted file mode 100644 index fb320cfc..00000000 --- a/docs/examples/messaging/update-textmagic-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-topic.md b/docs/examples/messaging/update-topic.md deleted file mode 100644 index 42634f12..00000000 --- a/docs/examples/messaging/update-topic.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new Messaging(client); - -const result = await messaging.updateTopic({ - topicId: '<TOPIC_ID>', - name: '<NAME>', // optional - subscribe: ["any"] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-twilio-provider.md b/docs/examples/messaging/update-twilio-provider.md deleted file mode 100644 index 6d535d2c..00000000 --- a/docs/examples/messaging/update-twilio-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/messaging/update-vonage-provider.md b/docs/examples/messaging/update-vonage-provider.md deleted file mode 100644 index 4f9e50cf..00000000 --- a/docs/examples/messaging/update-vonage-provider.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Messaging } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const messaging = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/oauth2/approve.md b/docs/examples/oauth2/approve.md new file mode 100644 index 00000000..4027d587 --- /dev/null +++ b/docs/examples/oauth2/approve.md @@ -0,0 +1,17 @@ +```javascript +import { Client, Oauth2 } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProjectQuery('<YOUR_PROJECT_ID>'); // Your project ID + +const oauth2 = new Oauth2(client); + +const result = await oauth2.approve({ + projectId: '<PROJECT_ID>', + grantId: '<GRANT_ID>', + authorizationDetails: '<AUTHORIZATION_DETAILS>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/oauth2/authorize.md b/docs/examples/oauth2/authorize.md new file mode 100644 index 00000000..0b9fec46 --- /dev/null +++ b/docs/examples/oauth2/authorize.md @@ -0,0 +1,26 @@ +```javascript +import { Client, Oauth2 } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProjectQuery('<YOUR_PROJECT_ID>'); // Your project ID + +const oauth2 = new Oauth2(client); + +const result = await oauth2.authorize({ + projectId: '<PROJECT_ID>', + clientId: '<CLIENT_ID>', + redirectUri: 'https://example.com', + responseType: 'code', + scope: '<SCOPE>', + state: '<STATE>', // optional + nonce: '<NONCE>', // optional + codeChallenge: '<CODE_CHALLENGE>', // optional + codeChallengeMethod: 's256', // optional + prompt: '<PROMPT>', // optional + maxAge: 0, // optional + authorizationDetails: '<AUTHORIZATION_DETAILS>' // optional +}); + +console.log(result); +``` diff --git a/docs/examples/oauth2/create-grant.md b/docs/examples/oauth2/create-grant.md new file mode 100644 index 00000000..f29fd88a --- /dev/null +++ b/docs/examples/oauth2/create-grant.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Oauth2 } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const oauth2 = new Oauth2(client); + +const result = await oauth2.createGrant({ + projectId: '<PROJECT_ID>', + userCode: '<USER_CODE>' +}); + +console.log(result); +``` diff --git a/docs/examples/oauth2/get-grant.md b/docs/examples/oauth2/get-grant.md new file mode 100644 index 00000000..fcbe915d --- /dev/null +++ b/docs/examples/oauth2/get-grant.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Oauth2 } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const oauth2 = new Oauth2(client); + +const result = await oauth2.getGrant({ + projectId: '<PROJECT_ID>', + grantId: '<GRANT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/oauth2/reject.md b/docs/examples/oauth2/reject.md new file mode 100644 index 00000000..4f4644d4 --- /dev/null +++ b/docs/examples/oauth2/reject.md @@ -0,0 +1,16 @@ +```javascript +import { Client, Oauth2 } from "appwrite"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProjectQuery('<YOUR_PROJECT_ID>'); // Your project ID + +const oauth2 = new Oauth2(client); + +const result = await oauth2.reject({ + projectId: '<PROJECT_ID>', + grantId: '<GRANT_ID>' +}); + +console.log(result); +``` diff --git a/docs/examples/presences/delete.md b/docs/examples/presences/delete.md index d9c8f08b..05d740bb 100644 --- a/docs/examples/presences/delete.md +++ b/docs/examples/presences/delete.md @@ -1,11 +1,9 @@ ```javascript import { Client, Presences } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const presences = new Presences(client); @@ -14,4 +12,4 @@ const result = await presences.delete({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/presences/get.md b/docs/examples/presences/get.md index 8cf32140..dc4f2438 100644 --- a/docs/examples/presences/get.md +++ b/docs/examples/presences/get.md @@ -1,11 +1,9 @@ ```javascript import { Client, Presences } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const presences = new Presences(client); @@ -14,4 +12,4 @@ const result = await presences.get({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/presences/list.md b/docs/examples/presences/list.md index e299d0bf..4e7c8762 100644 --- a/docs/examples/presences/list.md +++ b/docs/examples/presences/list.md @@ -1,11 +1,9 @@ ```javascript import { Client, Presences } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const presences = new Presences(client); @@ -16,4 +14,4 @@ const result = await presences.list({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/presences/update-presence.md b/docs/examples/presences/update.md similarity index 57% rename from docs/examples/presences/update-presence.md rename to docs/examples/presences/update.md index 414b1605..79e5aa91 100644 --- a/docs/examples/presences/update-presence.md +++ b/docs/examples/presences/update.md @@ -1,17 +1,14 @@ ```javascript import { Client, Presences, Permission, Role } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const presences = new Presences(client); -const result = await presences.updatePresence({ +const result = await presences.update({ presenceId: '<PRESENCE_ID>', - userId: '<USER_ID>', status: '<STATUS>', // optional expiresAt: '2020-10-15T06:38:00.000+00:00', // optional metadata: {}, // optional @@ -20,4 +17,4 @@ const result = await presences.updatePresence({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/presences/upsert.md b/docs/examples/presences/upsert.md index f46a1b81..e8fb6349 100644 --- a/docs/examples/presences/upsert.md +++ b/docs/examples/presences/upsert.md @@ -1,17 +1,14 @@ ```javascript import { Client, Presences, Permission, Role } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const presences = new Presences(client); const result = await presences.upsert({ presenceId: '<PRESENCE_ID>', - userId: '<USER_ID>', status: '<STATUS>', permissions: [Permission.read(Role.any())], // optional expiresAt: '2020-10-15T06:38:00.000+00:00', // optional @@ -19,4 +16,4 @@ const result = await presences.upsert({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/project/create-android-platform.md b/docs/examples/project/create-android-platform.md deleted file mode 100644 index 3f096cad..00000000 --- a/docs/examples/project/create-android-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createAndroidPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - applicationId: '<APPLICATION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-apple-platform.md b/docs/examples/project/create-apple-platform.md deleted file mode 100644 index de93e850..00000000 --- a/docs/examples/project/create-apple-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createApplePlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - bundleIdentifier: '<BUNDLE_IDENTIFIER>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-ephemeral-key.md b/docs/examples/project/create-ephemeral-key.md deleted file mode 100644 index b8202643..00000000 --- a/docs/examples/project/create-ephemeral-key.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project, ProjectKeyScopes } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createEphemeralKey({ - scopes: [ProjectKeyScopes.ProjectRead], - duration: 600 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-key.md b/docs/examples/project/create-key.md deleted file mode 100644 index 4a54e2ec..00000000 --- a/docs/examples/project/create-key.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project, ProjectKeyScopes } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createKey({ - keyId: '<KEY_ID>', - name: '<NAME>', - scopes: [ProjectKeyScopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-linux-platform.md b/docs/examples/project/create-linux-platform.md deleted file mode 100644 index 6774a326..00000000 --- a/docs/examples/project/create-linux-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createLinuxPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageName: '<PACKAGE_NAME>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-mock-phone.md b/docs/examples/project/create-mock-phone.md deleted file mode 100644 index df5b6bb0..00000000 --- a/docs/examples/project/create-mock-phone.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createMockPhone({ - number: '+12065550100', - otp: '<OTP>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md deleted file mode 100644 index afa6e9b8..00000000 --- a/docs/examples/project/create-smtp-test.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createSMTPTest({ - emails: [] -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-variable.md b/docs/examples/project/create-variable.md deleted file mode 100644 index e870104a..00000000 --- a/docs/examples/project/create-variable.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createVariable({ - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-web-platform.md b/docs/examples/project/create-web-platform.md deleted file mode 100644 index e92270c8..00000000 --- a/docs/examples/project/create-web-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createWebPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - hostname: 'app.example.com' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/create-windows-platform.md b/docs/examples/project/create-windows-platform.md deleted file mode 100644 index ff1102b3..00000000 --- a/docs/examples/project/create-windows-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.createWindowsPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/delete-key.md b/docs/examples/project/delete-key.md deleted file mode 100644 index 0a8ab977..00000000 --- a/docs/examples/project/delete-key.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.deleteKey({ - keyId: '<KEY_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/delete-mock-phone.md b/docs/examples/project/delete-mock-phone.md deleted file mode 100644 index 76cc6134..00000000 --- a/docs/examples/project/delete-mock-phone.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.deleteMockPhone({ - number: '+12065550100' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/delete-platform.md b/docs/examples/project/delete-platform.md deleted file mode 100644 index 898ce212..00000000 --- a/docs/examples/project/delete-platform.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.deletePlatform({ - platformId: '<PLATFORM_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/delete-variable.md b/docs/examples/project/delete-variable.md deleted file mode 100644 index 36d0d471..00000000 --- a/docs/examples/project/delete-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.deleteVariable({ - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/delete.md b/docs/examples/project/delete.md deleted file mode 100644 index bf9a5509..00000000 --- a/docs/examples/project/delete.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.delete(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md deleted file mode 100644 index e3797cc4..00000000 --- a/docs/examples/project/get-email-template.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project, ProjectEmailTemplateId, ProjectEmailTemplateLocale } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.getEmailTemplate({ - templateId: ProjectEmailTemplateId.Verification, - locale: ProjectEmailTemplateLocale.Af // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/get-key.md b/docs/examples/project/get-key.md deleted file mode 100644 index d5dce229..00000000 --- a/docs/examples/project/get-key.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.getKey({ - keyId: '<KEY_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/get-mock-phone.md b/docs/examples/project/get-mock-phone.md deleted file mode 100644 index 508800b2..00000000 --- a/docs/examples/project/get-mock-phone.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.getMockPhone({ - number: '+12065550100' -}); - -console.log(result); -``` \ No newline at end of file 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 5484e087..00000000 --- a/docs/examples/project/get-o-auth-2-provider.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project, ProjectOAuthProviderId } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.getOAuth2Provider({ - providerId: ProjectOAuthProviderId.Amazon -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/get-platform.md b/docs/examples/project/get-platform.md deleted file mode 100644 index a49dbd42..00000000 --- a/docs/examples/project/get-platform.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.getPlatform({ - platformId: '<PLATFORM_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/get-policy.md b/docs/examples/project/get-policy.md deleted file mode 100644 index b8a4e0d8..00000000 --- a/docs/examples/project/get-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project, ProjectPolicyId } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.getPolicy({ - policyId: ProjectPolicyId.PasswordDictionary -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/get-variable.md b/docs/examples/project/get-variable.md deleted file mode 100644 index 111aeee4..00000000 --- a/docs/examples/project/get-variable.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.getVariable({ - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/get.md b/docs/examples/project/get.md deleted file mode 100644 index b84cf264..00000000 --- a/docs/examples/project/get.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.get(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/list-email-templates.md b/docs/examples/project/list-email-templates.md deleted file mode 100644 index fa062e32..00000000 --- a/docs/examples/project/list-email-templates.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.listEmailTemplates({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/list-keys.md b/docs/examples/project/list-keys.md deleted file mode 100644 index 2ba5d8b4..00000000 --- a/docs/examples/project/list-keys.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.listKeys({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/list-mock-phones.md b/docs/examples/project/list-mock-phones.md deleted file mode 100644 index d4a810ad..00000000 --- a/docs/examples/project/list-mock-phones.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.listMockPhones({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 112ce8b0..00000000 --- a/docs/examples/project/list-o-auth-2-providers.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.listOAuth2Providers({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/list-platforms.md b/docs/examples/project/list-platforms.md deleted file mode 100644 index 186a78e7..00000000 --- a/docs/examples/project/list-platforms.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.listPlatforms({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/list-policies.md b/docs/examples/project/list-policies.md deleted file mode 100644 index 14ba8275..00000000 --- a/docs/examples/project/list-policies.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.listPolicies({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/list-variables.md b/docs/examples/project/list-variables.md deleted file mode 100644 index dab8b0f2..00000000 --- a/docs/examples/project/list-variables.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.listVariables({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-android-platform.md b/docs/examples/project/update-android-platform.md deleted file mode 100644 index 4085db68..00000000 --- a/docs/examples/project/update-android-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateAndroidPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - applicationId: '<APPLICATION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-apple-platform.md b/docs/examples/project/update-apple-platform.md deleted file mode 100644 index a0d34da0..00000000 --- a/docs/examples/project/update-apple-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateApplePlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - bundleIdentifier: '<BUNDLE_IDENTIFIER>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-auth-method.md b/docs/examples/project/update-auth-method.md deleted file mode 100644 index bbf06cb6..00000000 --- a/docs/examples/project/update-auth-method.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project, ProjectAuthMethodId } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateAuthMethod({ - methodId: ProjectAuthMethodId.EmailPassword, - enabled: false -}); - -console.log(result); -``` \ No newline at end of file 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 d84bb4b5..00000000 --- a/docs/examples/project/update-deny-aliased-email-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateDenyAliasedEmailPolicy({ - enabled: false -}); - -console.log(result); -``` \ No newline at end of file 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 dac38b74..00000000 --- a/docs/examples/project/update-deny-disposable-email-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateDenyDisposableEmailPolicy({ - enabled: false -}); - -console.log(result); -``` \ No newline at end of file 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 83325373..00000000 --- a/docs/examples/project/update-deny-free-email-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateDenyFreeEmailPolicy({ - enabled: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md deleted file mode 100644 index 9c682103..00000000 --- a/docs/examples/project/update-email-template.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Project, ProjectEmailTemplateId, ProjectEmailTemplateLocale } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateEmailTemplate({ - templateId: ProjectEmailTemplateId.Verification, - locale: 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-key.md b/docs/examples/project/update-key.md deleted file mode 100644 index 4b380796..00000000 --- a/docs/examples/project/update-key.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project, ProjectKeyScopes } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateKey({ - keyId: '<KEY_ID>', - name: '<NAME>', - scopes: [ProjectKeyScopes.ProjectRead], - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-labels.md b/docs/examples/project/update-labels.md deleted file mode 100644 index 6cce7088..00000000 --- a/docs/examples/project/update-labels.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateLabels({ - labels: [] -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-linux-platform.md b/docs/examples/project/update-linux-platform.md deleted file mode 100644 index 2f4211f0..00000000 --- a/docs/examples/project/update-linux-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateLinuxPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageName: '<PACKAGE_NAME>' -}); - -console.log(result); -``` \ No newline at end of file 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 d3cdb301..00000000 --- a/docs/examples/project/update-membership-privacy-policy.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateMembershipPrivacyPolicy({ - userId: false, // optional - userEmail: false, // optional - userPhone: false, // optional - userName: false, // optional - userMFA: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-mock-phone.md b/docs/examples/project/update-mock-phone.md deleted file mode 100644 index 33514c3f..00000000 --- a/docs/examples/project/update-mock-phone.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateMockPhone({ - number: '+12065550100', - otp: '<OTP>' -}); - -console.log(result); -``` \ No newline at end of file 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 09daa37a..00000000 --- a/docs/examples/project/update-o-auth-2-amazon.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Amazon({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 d6ea058d..00000000 --- a/docs/examples/project/update-o-auth-2-apple.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new 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 -}); - -console.log(result); -``` \ No newline at end of file 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 94074de1..00000000 --- a/docs/examples/project/update-o-auth-2-auth-0.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Auth0({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 ae6e98a2..00000000 --- a/docs/examples/project/update-o-auth-2-authentik.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Authentik({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 20ffa7eb..00000000 --- a/docs/examples/project/update-o-auth-2-autodesk.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Autodesk({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 f18ee60f..00000000 --- a/docs/examples/project/update-o-auth-2-bitbucket.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Bitbucket({ - key: '<KEY>', // optional - secret: '<SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 a2b5ab43..00000000 --- a/docs/examples/project/update-o-auth-2-bitly.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Bitly({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 faa90ebb..00000000 --- a/docs/examples/project/update-o-auth-2-box.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Box({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 7761c777..00000000 --- a/docs/examples/project/update-o-auth-2-dailymotion.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Dailymotion({ - apiKey: '<API_KEY>', // optional - apiSecret: '<API_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 b57537f6..00000000 --- a/docs/examples/project/update-o-auth-2-discord.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Discord({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 f6c09048..00000000 --- a/docs/examples/project/update-o-auth-2-disqus.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Disqus({ - publicKey: '<PUBLIC_KEY>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 eed52e7a..00000000 --- a/docs/examples/project/update-o-auth-2-dropbox.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Dropbox({ - appKey: '<APP_KEY>', // optional - appSecret: '<APP_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 f5f7e08a..00000000 --- a/docs/examples/project/update-o-auth-2-etsy.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Etsy({ - keyString: '<KEY_STRING>', // optional - sharedSecret: '<SHARED_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 de3de217..00000000 --- a/docs/examples/project/update-o-auth-2-facebook.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Facebook({ - appId: '<APP_ID>', // optional - appSecret: '<APP_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 a189bb37..00000000 --- a/docs/examples/project/update-o-auth-2-figma.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Figma({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 c3791f56..00000000 --- a/docs/examples/project/update-o-auth-2-fusion-auth.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2FusionAuth({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - endpoint: '<ENDPOINT>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 ca91eba7..00000000 --- a/docs/examples/project/update-o-auth-2-git-hub.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2GitHub({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 c10e2440..00000000 --- a/docs/examples/project/update-o-auth-2-gitlab.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Gitlab({ - applicationId: '<APPLICATION_ID>', // optional - secret: '<SECRET>', // optional - endpoint: 'https://example.com', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 b271f054..00000000 --- a/docs/examples/project/update-o-auth-2-google.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project, ProjectOAuth2GooglePrompt } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Google({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - prompt: [ProjectOAuth2GooglePrompt.None], // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 fc1b49b1..00000000 --- a/docs/examples/project/update-o-auth-2-keycloak.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new 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 -}); - -console.log(result); -``` \ No newline at end of file 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 cf436fd0..00000000 --- a/docs/examples/project/update-o-auth-2-kick.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Kick({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 671fb18d..00000000 --- a/docs/examples/project/update-o-auth-2-linkedin.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Linkedin({ - clientId: '<CLIENT_ID>', // optional - primaryClientSecret: '<PRIMARY_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 52e60174..00000000 --- a/docs/examples/project/update-o-auth-2-microsoft.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Microsoft({ - applicationId: '<APPLICATION_ID>', // optional - applicationSecret: '<APPLICATION_SECRET>', // optional - tenant: '<TENANT>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 73bd5298..00000000 --- a/docs/examples/project/update-o-auth-2-notion.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Notion({ - oauthClientId: '<OAUTH_CLIENT_ID>', // optional - oauthClientSecret: '<OAUTH_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 74f4dae2..00000000 --- a/docs/examples/project/update-o-auth-2-oidc.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new 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 -}); - -console.log(result); -``` \ No newline at end of file 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 347ec234..00000000 --- a/docs/examples/project/update-o-auth-2-okta.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new 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 -}); - -console.log(result); -``` \ No newline at end of file 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 d0578f60..00000000 --- a/docs/examples/project/update-o-auth-2-paypal-sandbox.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2PaypalSandbox({ - clientId: '<CLIENT_ID>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 35cd37c2..00000000 --- a/docs/examples/project/update-o-auth-2-paypal.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Paypal({ - clientId: '<CLIENT_ID>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 586ee22c..00000000 --- a/docs/examples/project/update-o-auth-2-podio.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Podio({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 48745326..00000000 --- a/docs/examples/project/update-o-auth-2-salesforce.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Salesforce({ - customerKey: '<CUSTOMER_KEY>', // optional - customerSecret: '<CUSTOMER_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 a967080b..00000000 --- a/docs/examples/project/update-o-auth-2-slack.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Slack({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 8a3bef76..00000000 --- a/docs/examples/project/update-o-auth-2-spotify.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Spotify({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 5e9b7ae5..00000000 --- a/docs/examples/project/update-o-auth-2-stripe.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Stripe({ - clientId: '<CLIENT_ID>', // optional - apiSecretKey: '<API_SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 e8cd802d..00000000 --- a/docs/examples/project/update-o-auth-2-tradeshift-sandbox.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2TradeshiftSandbox({ - oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional - oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 621dfe57..00000000 --- a/docs/examples/project/update-o-auth-2-tradeshift.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Tradeshift({ - oauth2ClientId: '<OAUTH2_CLIENT_ID>', // optional - oauth2ClientSecret: '<OAUTH2_CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 e8a03d7c..00000000 --- a/docs/examples/project/update-o-auth-2-twitch.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Twitch({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 a0288ba0..00000000 --- a/docs/examples/project/update-o-auth-2-word-press.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2WordPress({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 278effd7..00000000 --- a/docs/examples/project/update-o-auth-2-yahoo.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Yahoo({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 7e71873b..00000000 --- a/docs/examples/project/update-o-auth-2-yandex.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Yandex({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 681f3286..00000000 --- a/docs/examples/project/update-o-auth-2-zoho.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Zoho({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 f5741cb6..00000000 --- a/docs/examples/project/update-o-auth-2-zoom.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2Zoom({ - clientId: '<CLIENT_ID>', // optional - clientSecret: '<CLIENT_SECRET>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 10ba341d..00000000 --- a/docs/examples/project/update-o-auth-2x.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateOAuth2X({ - customerKey: '<CUSTOMER_KEY>', // optional - secretKey: '<SECRET_KEY>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 4583f9b5..00000000 --- a/docs/examples/project/update-password-dictionary-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updatePasswordDictionaryPolicy({ - enabled: false -}); - -console.log(result); -``` \ No newline at end of file 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 6fcad2a3..00000000 --- a/docs/examples/project/update-password-history-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updatePasswordHistoryPolicy({ - total: 1 -}); - -console.log(result); -``` \ No newline at end of file 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 e68fb90d..00000000 --- a/docs/examples/project/update-password-personal-data-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updatePasswordPersonalDataPolicy({ - enabled: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-protocol.md b/docs/examples/project/update-protocol.md deleted file mode 100644 index 132335b7..00000000 --- a/docs/examples/project/update-protocol.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project, ProjectProtocolId } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateProtocol({ - protocolId: ProjectProtocolId.Rest, - enabled: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-service.md b/docs/examples/project/update-service.md deleted file mode 100644 index 283dbc5f..00000000 --- a/docs/examples/project/update-service.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Project, ProjectServiceId } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateService({ - serviceId: ProjectServiceId.Account, - enabled: false -}); - -console.log(result); -``` \ No newline at end of file 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 fbab3646..00000000 --- a/docs/examples/project/update-session-alert-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateSessionAlertPolicy({ - enabled: false -}); - -console.log(result); -``` \ No newline at end of file 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 5e9ce0e1..00000000 --- a/docs/examples/project/update-session-duration-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateSessionDurationPolicy({ - duration: 5 -}); - -console.log(result); -``` \ No newline at end of file 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 62cfd725..00000000 --- a/docs/examples/project/update-session-invalidation-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateSessionInvalidationPolicy({ - enabled: false -}); - -console.log(result); -``` \ No newline at end of file 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 6dfbf407..00000000 --- a/docs/examples/project/update-session-limit-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateSessionLimitPolicy({ - total: 1 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md deleted file mode 100644 index 06811547..00000000 --- a/docs/examples/project/update-smtp.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, Project, ProjectSMTPSecure } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new 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: ProjectSMTPSecure.Tls, // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 b35ea1b0..00000000 --- a/docs/examples/project/update-user-limit-policy.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateUserLimitPolicy({ - total: 1 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-variable.md b/docs/examples/project/update-variable.md deleted file mode 100644 index e82a1cff..00000000 --- a/docs/examples/project/update-variable.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateVariable({ - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-web-platform.md b/docs/examples/project/update-web-platform.md deleted file mode 100644 index 313af63f..00000000 --- a/docs/examples/project/update-web-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateWebPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - hostname: 'app.example.com' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/project/update-windows-platform.md b/docs/examples/project/update-windows-platform.md deleted file mode 100644 index bffd26ad..00000000 --- a/docs/examples/project/update-windows-platform.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Project } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const project = new Project(client); - -const result = await project.updateWindowsPlatform({ - platformId: '<PLATFORM_ID>', - name: '<NAME>', - packageIdentifierName: '<PACKAGE_IDENTIFIER_NAME>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/create-api-rule.md b/docs/examples/proxy/create-api-rule.md deleted file mode 100644 index 46311715..00000000 --- a/docs/examples/proxy/create-api-rule.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.createAPIRule({ - domain: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/create-function-rule.md b/docs/examples/proxy/create-function-rule.md deleted file mode 100644 index 0b3bceeb..00000000 --- a/docs/examples/proxy/create-function-rule.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.createFunctionRule({ - domain: '', - functionId: '<FUNCTION_ID>', - branch: '<BRANCH>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/create-redirect-rule.md b/docs/examples/proxy/create-redirect-rule.md deleted file mode 100644 index 897c377a..00000000 --- a/docs/examples/proxy/create-redirect-rule.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Proxy, StatusCode, ProxyResourceType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.createRedirectRule({ - domain: '', - url: 'https://example.com', - statusCode: StatusCode.MovedPermanently301, - resourceId: '<RESOURCE_ID>', - resourceType: ProxyResourceType.Site -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/create-site-rule.md b/docs/examples/proxy/create-site-rule.md deleted file mode 100644 index 1b763b07..00000000 --- a/docs/examples/proxy/create-site-rule.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.createSiteRule({ - domain: '', - siteId: '<SITE_ID>', - branch: '<BRANCH>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/delete-rule.md b/docs/examples/proxy/delete-rule.md deleted file mode 100644 index 6f6574ae..00000000 --- a/docs/examples/proxy/delete-rule.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.deleteRule({ - ruleId: '<RULE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/get-rule.md b/docs/examples/proxy/get-rule.md deleted file mode 100644 index 2c82d619..00000000 --- a/docs/examples/proxy/get-rule.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.getRule({ - ruleId: '<RULE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/list-rules.md b/docs/examples/proxy/list-rules.md deleted file mode 100644 index 9bde6f35..00000000 --- a/docs/examples/proxy/list-rules.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.listRules({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/proxy/update-rule-status.md b/docs/examples/proxy/update-rule-status.md deleted file mode 100644 index 691da2e6..00000000 --- a/docs/examples/proxy/update-rule-status.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Proxy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const proxy = new Proxy(client); - -const result = await proxy.updateRuleStatus({ - ruleId: '<RULE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/create-deployment.md b/docs/examples/sites/create-deployment.md deleted file mode 100644 index e7b110e9..00000000 --- a/docs/examples/sites/create-deployment.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.createDeployment({ - siteId: '<SITE_ID>', - code: document.getElementById('uploader').files[0], - installCommand: '<INSTALL_COMMAND>', // optional - buildCommand: '<BUILD_COMMAND>', // optional - outputDirectory: '<OUTPUT_DIRECTORY>', // optional - activate: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/create-duplicate-deployment.md b/docs/examples/sites/create-duplicate-deployment.md deleted file mode 100644 index eb0634c6..00000000 --- a/docs/examples/sites/create-duplicate-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.createDuplicateDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/create-template-deployment.md b/docs/examples/sites/create-template-deployment.md deleted file mode 100644 index f0dfcd5e..00000000 --- a/docs/examples/sites/create-template-deployment.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Sites, TemplateReferenceType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.createTemplateDeployment({ - siteId: '<SITE_ID>', - repository: '<REPOSITORY>', - owner: '<OWNER>', - rootDirectory: '<ROOT_DIRECTORY>', - type: TemplateReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/create-variable.md b/docs/examples/sites/create-variable.md deleted file mode 100644 index 5e6171c1..00000000 --- a/docs/examples/sites/create-variable.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.createVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', - value: '<VALUE>', - secret: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/create-vcs-deployment.md b/docs/examples/sites/create-vcs-deployment.md deleted file mode 100644 index 1411d04d..00000000 --- a/docs/examples/sites/create-vcs-deployment.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Sites, VCSReferenceType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.createVcsDeployment({ - siteId: '<SITE_ID>', - type: VCSReferenceType.Branch, - reference: '<REFERENCE>', - activate: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/create.md b/docs/examples/sites/create.md deleted file mode 100644 index 9996b465..00000000 --- a/docs/examples/sites/create.md +++ /dev/null @@ -1,37 +0,0 @@ -```javascript -import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.create({ - siteId: '<SITE_ID>', - name: '<NAME>', - framework: Framework.Analog, - buildRuntime: 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: 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/delete-deployment.md b/docs/examples/sites/delete-deployment.md deleted file mode 100644 index 5b7d9022..00000000 --- a/docs/examples/sites/delete-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.deleteDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/delete-log.md b/docs/examples/sites/delete-log.md deleted file mode 100644 index ec504437..00000000 --- a/docs/examples/sites/delete-log.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.deleteLog({ - siteId: '<SITE_ID>', - logId: '<LOG_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/delete-variable.md b/docs/examples/sites/delete-variable.md deleted file mode 100644 index e24ab209..00000000 --- a/docs/examples/sites/delete-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.deleteVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/delete.md b/docs/examples/sites/delete.md deleted file mode 100644 index 3a150d44..00000000 --- a/docs/examples/sites/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.delete({ - siteId: '<SITE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/get-deployment-download.md b/docs/examples/sites/get-deployment-download.md deleted file mode 100644 index 5cb096a8..00000000 --- a/docs/examples/sites/get-deployment-download.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Sites, DeploymentDownloadType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = sites.getDeploymentDownload({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>', - type: DeploymentDownloadType.Source // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/get-deployment.md b/docs/examples/sites/get-deployment.md deleted file mode 100644 index de537487..00000000 --- a/docs/examples/sites/get-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.getDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/get-log.md b/docs/examples/sites/get-log.md deleted file mode 100644 index 044b57a4..00000000 --- a/docs/examples/sites/get-log.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.getLog({ - siteId: '<SITE_ID>', - logId: '<LOG_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/get-variable.md b/docs/examples/sites/get-variable.md deleted file mode 100644 index 4f39272d..00000000 --- a/docs/examples/sites/get-variable.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.getVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/get.md b/docs/examples/sites/get.md deleted file mode 100644 index 1fd1a3ae..00000000 --- a/docs/examples/sites/get.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.get({ - siteId: '<SITE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/list-deployments.md b/docs/examples/sites/list-deployments.md deleted file mode 100644 index 048faf06..00000000 --- a/docs/examples/sites/list-deployments.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.listDeployments({ - siteId: '<SITE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/list-frameworks.md b/docs/examples/sites/list-frameworks.md deleted file mode 100644 index ee21063e..00000000 --- a/docs/examples/sites/list-frameworks.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.listFrameworks(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/list-logs.md b/docs/examples/sites/list-logs.md deleted file mode 100644 index 86197692..00000000 --- a/docs/examples/sites/list-logs.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.listLogs({ - siteId: '<SITE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/list-specifications.md b/docs/examples/sites/list-specifications.md deleted file mode 100644 index 61c12020..00000000 --- a/docs/examples/sites/list-specifications.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.listSpecifications(); - - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/list-variables.md b/docs/examples/sites/list-variables.md deleted file mode 100644 index de936229..00000000 --- a/docs/examples/sites/list-variables.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.listVariables({ - siteId: '<SITE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/list.md b/docs/examples/sites/list.md deleted file mode 100644 index acdc4c65..00000000 --- a/docs/examples/sites/list.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/update-deployment-status.md b/docs/examples/sites/update-deployment-status.md deleted file mode 100644 index f9213666..00000000 --- a/docs/examples/sites/update-deployment-status.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.updateDeploymentStatus({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/update-site-deployment.md b/docs/examples/sites/update-site-deployment.md deleted file mode 100644 index d70d5693..00000000 --- a/docs/examples/sites/update-site-deployment.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.updateSiteDeployment({ - siteId: '<SITE_ID>', - deploymentId: '<DEPLOYMENT_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/update-variable.md b/docs/examples/sites/update-variable.md deleted file mode 100644 index 0ad62555..00000000 --- a/docs/examples/sites/update-variable.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Sites } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.updateVariable({ - siteId: '<SITE_ID>', - variableId: '<VARIABLE_ID>', - key: '<KEY>', // optional - value: '<VALUE>', // optional - secret: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/sites/update.md b/docs/examples/sites/update.md deleted file mode 100644 index b47af13c..00000000 --- a/docs/examples/sites/update.md +++ /dev/null @@ -1,37 +0,0 @@ -```javascript -import { Client, Sites, Framework, BuildRuntime, Adapter } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const sites = new Sites(client); - -const result = await sites.update({ - siteId: '<SITE_ID>', - name: '<NAME>', - framework: 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: BuildRuntime.Node145, // optional - adapter: 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/storage/create-bucket.md b/docs/examples/storage/create-bucket.md deleted file mode 100644 index 1acc6ea8..00000000 --- a/docs/examples/storage/create-bucket.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -import { Client, Storage, Compression, Permission, Role } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const storage = new Storage(client); - -const result = await storage.createBucket({ - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: Compression.None, // optional - encryption: false, // optional - antivirus: false, // optional - transformations: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/storage/create-file.md b/docs/examples/storage/create-file.md index def01e51..b70885b2 100644 --- a/docs/examples/storage/create-file.md +++ b/docs/examples/storage/create-file.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -16,4 +15,4 @@ const result = await storage.createFile({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/storage/delete-bucket.md b/docs/examples/storage/delete-bucket.md deleted file mode 100644 index a6ecc7bc..00000000 --- a/docs/examples/storage/delete-bucket.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Storage } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const storage = new Storage(client); - -const result = await storage.deleteBucket({ - bucketId: '<BUCKET_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/storage/delete-file.md b/docs/examples/storage/delete-file.md index 04dd2ea0..950003b8 100644 --- a/docs/examples/storage/delete-file.md +++ b/docs/examples/storage/delete-file.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -14,4 +13,4 @@ const result = await storage.deleteFile({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/storage/get-bucket.md b/docs/examples/storage/get-bucket.md deleted file mode 100644 index fb9dd244..00000000 --- a/docs/examples/storage/get-bucket.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Storage } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const storage = new Storage(client); - -const result = await storage.getBucket({ - bucketId: '<BUCKET_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index e6a9666b..7758c7b4 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -15,4 +14,4 @@ const result = storage.getFileDownload({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 765b771e..4d01ef0c 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage, ImageGravity, ImageFormat } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -26,4 +25,4 @@ const result = storage.getFilePreview({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index f7324027..682e947c 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -15,4 +14,4 @@ const result = storage.getFileView({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/storage/get-file.md b/docs/examples/storage/get-file.md index f4a9684c..82607140 100644 --- a/docs/examples/storage/get-file.md +++ b/docs/examples/storage/get-file.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -14,4 +13,4 @@ const result = await storage.getFile({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/storage/list-buckets.md b/docs/examples/storage/list-buckets.md deleted file mode 100644 index 359c1488..00000000 --- a/docs/examples/storage/list-buckets.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Storage } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const storage = new Storage(client); - -const result = await storage.listBuckets({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/storage/list-files.md b/docs/examples/storage/list-files.md index 3f12d7a7..f2dd2f44 100644 --- a/docs/examples/storage/list-files.md +++ b/docs/examples/storage/list-files.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -16,4 +15,4 @@ const result = await storage.listFiles({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/storage/update-bucket.md b/docs/examples/storage/update-bucket.md deleted file mode 100644 index 0c8a35e6..00000000 --- a/docs/examples/storage/update-bucket.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -import { Client, Storage, Compression, Permission, Role } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const storage = new Storage(client); - -const result = await storage.updateBucket({ - bucketId: '<BUCKET_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - fileSecurity: false, // optional - enabled: false, // optional - maximumFileSize: 1, // optional - allowedFileExtensions: [], // optional - compression: Compression.None, // optional - encryption: false, // optional - antivirus: false, // optional - transformations: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/storage/update-file.md b/docs/examples/storage/update-file.md index e6746ac6..eef78a1d 100644 --- a/docs/examples/storage/update-file.md +++ b/docs/examples/storage/update-file.md @@ -1,10 +1,9 @@ ```javascript import { Client, Storage, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const storage = new Storage(client); @@ -16,4 +15,4 @@ const result = await storage.updateFile({ }); console.log(result); -``` \ No newline at end of file +``` 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 3c83ed38..00000000 --- a/docs/examples/tablesdb/create-big-int-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-boolean-column.md b/docs/examples/tablesdb/create-boolean-column.md deleted file mode 100644 index 59c4aff1..00000000 --- a/docs/examples/tablesdb/create-boolean-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createBooleanColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: false, // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-datetime-column.md b/docs/examples/tablesdb/create-datetime-column.md deleted file mode 100644 index 293ee77a..00000000 --- a/docs/examples/tablesdb/create-datetime-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-email-column.md b/docs/examples/tablesdb/create-email-column.md deleted file mode 100644 index a3a4b785..00000000 --- a/docs/examples/tablesdb/create-email-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createEmailColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'email@example.com', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-enum-column.md b/docs/examples/tablesdb/create-enum-column.md deleted file mode 100644 index a5ae2688..00000000 --- a/docs/examples/tablesdb/create-enum-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createEnumColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-float-column.md b/docs/examples/tablesdb/create-float-column.md deleted file mode 100644 index 4d4069e4..00000000 --- a/docs/examples/tablesdb/create-float-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-index.md b/docs/examples/tablesdb/create-index.md deleted file mode 100644 index bed2db8a..00000000 --- a/docs/examples/tablesdb/create-index.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB, TablesDBIndexType, OrderBy } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - type: TablesDBIndexType.Key, - columns: [], - orders: [OrderBy.Asc], // optional - lengths: [] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-integer-column.md b/docs/examples/tablesdb/create-integer-column.md deleted file mode 100644 index 713fc0c8..00000000 --- a/docs/examples/tablesdb/create-integer-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-ip-column.md b/docs/examples/tablesdb/create-ip-column.md deleted file mode 100644 index d24e984a..00000000 --- a/docs/examples/tablesdb/create-ip-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createIpColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-line-column.md b/docs/examples/tablesdb/create-line-column.md deleted file mode 100644 index 96d8d2e5..00000000 --- a/docs/examples/tablesdb/create-line-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createLineColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [[1, 2], [3, 4], [5, 6]] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-longtext-column.md b/docs/examples/tablesdb/create-longtext-column.md deleted file mode 100644 index b6ed98e9..00000000 --- a/docs/examples/tablesdb/create-longtext-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-mediumtext-column.md b/docs/examples/tablesdb/create-mediumtext-column.md deleted file mode 100644 index 5aa8a8e9..00000000 --- a/docs/examples/tablesdb/create-mediumtext-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-operations.md b/docs/examples/tablesdb/create-operations.md index 2bcadecc..739b4e62 100644 --- a/docs/examples/tablesdb/create-operations.md +++ b/docs/examples/tablesdb/create-operations.md @@ -1,11 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -25,4 +23,4 @@ const result = await tablesDB.createOperations({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/create-point-column.md b/docs/examples/tablesdb/create-point-column.md deleted file mode 100644 index c3410b4d..00000000 --- a/docs/examples/tablesdb/create-point-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createPointColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [1, 2] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-polygon-column.md b/docs/examples/tablesdb/create-polygon-column.md deleted file mode 100644 index f7a2176d..00000000 --- a/docs/examples/tablesdb/create-polygon-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-relationship-column.md b/docs/examples/tablesdb/create-relationship-column.md deleted file mode 100644 index 7fcb22e0..00000000 --- a/docs/examples/tablesdb/create-relationship-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB, RelationshipType, RelationMutate } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createRelationshipColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - relatedTableId: '<RELATED_TABLE_ID>', - type: RelationshipType.OneToOne, - twoWay: false, // optional - key: '', // optional - twoWayKey: '', // optional - onDelete: RelationMutate.Cascade // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-row.md b/docs/examples/tablesdb/create-row.md index 5a1e9648..105c4445 100644 --- a/docs/examples/tablesdb/create-row.md +++ b/docs/examples/tablesdb/create-row.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -24,4 +23,4 @@ const result = await tablesDB.createRow({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/create-rows.md b/docs/examples/tablesdb/create-rows.md deleted file mode 100644 index e859e408..00000000 --- a/docs/examples/tablesdb/create-rows.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rows: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-string-column.md b/docs/examples/tablesdb/create-string-column.md deleted file mode 100644 index 8cb7260c..00000000 --- a/docs/examples/tablesdb/create-string-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-table.md b/docs/examples/tablesdb/create-table.md deleted file mode 100644 index d914c250..00000000 --- a/docs/examples/tablesdb/create-table.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB, Permission, Role } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - name: '<NAME>', - permissions: [Permission.read(Role.any())], // optional - rowSecurity: false, // optional - enabled: false, // optional - columns: [], // optional - indexes: [] // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-text-column.md b/docs/examples/tablesdb/create-text-column.md deleted file mode 100644 index 8e3ca29e..00000000 --- a/docs/examples/tablesdb/create-text-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-transaction.md b/docs/examples/tablesdb/create-transaction.md index 9e583780..333eb80e 100644 --- a/docs/examples/tablesdb/create-transaction.md +++ b/docs/examples/tablesdb/create-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -14,4 +12,4 @@ const result = await tablesDB.createTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/create-url-column.md b/docs/examples/tablesdb/create-url-column.md deleted file mode 100644 index a1bf60a8..00000000 --- a/docs/examples/tablesdb/create-url-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.createUrlColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'https://example.com', // optional - array: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create-varchar-column.md b/docs/examples/tablesdb/create-varchar-column.md deleted file mode 100644 index b289ffcb..00000000 --- a/docs/examples/tablesdb/create-varchar-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/create.md b/docs/examples/tablesdb/create.md deleted file mode 100644 index f9e738b9..00000000 --- a/docs/examples/tablesdb/create.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.create({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/decrement-row-column.md b/docs/examples/tablesdb/decrement-row-column.md index e01bfab2..bad89263 100644 --- a/docs/examples/tablesdb/decrement-row-column.md +++ b/docs/examples/tablesdb/decrement-row-column.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -19,4 +18,4 @@ const result = await tablesDB.decrementRowColumn({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/delete-column.md b/docs/examples/tablesdb/delete-column.md deleted file mode 100644 index e669272a..00000000 --- a/docs/examples/tablesdb/delete-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-index.md b/docs/examples/tablesdb/delete-index.md deleted file mode 100644 index 6dfe0ae7..00000000 --- a/docs/examples/tablesdb/delete-index.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-row.md b/docs/examples/tablesdb/delete-row.md index ed2d2e15..12663286 100644 --- a/docs/examples/tablesdb/delete-row.md +++ b/docs/examples/tablesdb/delete-row.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -16,4 +15,4 @@ const result = await tablesDB.deleteRow({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/delete-rows.md b/docs/examples/tablesdb/delete-rows.md deleted file mode 100644 index 4ebcfd7c..00000000 --- a/docs/examples/tablesdb/delete-rows.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-table.md b/docs/examples/tablesdb/delete-table.md deleted file mode 100644 index 465c095f..00000000 --- a/docs/examples/tablesdb/delete-table.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.deleteTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/delete-transaction.md b/docs/examples/tablesdb/delete-transaction.md index 48c71ace..0c98481c 100644 --- a/docs/examples/tablesdb/delete-transaction.md +++ b/docs/examples/tablesdb/delete-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -14,4 +12,4 @@ const result = await tablesDB.deleteTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/delete.md b/docs/examples/tablesdb/delete.md deleted file mode 100644 index 7afe4e21..00000000 --- a/docs/examples/tablesdb/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.delete({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-column.md b/docs/examples/tablesdb/get-column.md deleted file mode 100644 index b82e1c53..00000000 --- a/docs/examples/tablesdb/get-column.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.getColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-index.md b/docs/examples/tablesdb/get-index.md deleted file mode 100644 index 4e07bd6a..00000000 --- a/docs/examples/tablesdb/get-index.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.getIndex({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-row.md b/docs/examples/tablesdb/get-row.md index 857ac103..14316385 100644 --- a/docs/examples/tablesdb/get-row.md +++ b/docs/examples/tablesdb/get-row.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -17,4 +16,4 @@ const result = await tablesDB.getRow({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/get-table.md b/docs/examples/tablesdb/get-table.md deleted file mode 100644 index c1b952f7..00000000 --- a/docs/examples/tablesdb/get-table.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.getTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/get-transaction.md b/docs/examples/tablesdb/get-transaction.md index 31ea0081..00e72497 100644 --- a/docs/examples/tablesdb/get-transaction.md +++ b/docs/examples/tablesdb/get-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -14,4 +12,4 @@ const result = await tablesDB.getTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/get.md b/docs/examples/tablesdb/get.md deleted file mode 100644 index 68440bef..00000000 --- a/docs/examples/tablesdb/get.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.get({ - databaseId: '<DATABASE_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/increment-row-column.md b/docs/examples/tablesdb/increment-row-column.md index b99a3467..2fa3354b 100644 --- a/docs/examples/tablesdb/increment-row-column.md +++ b/docs/examples/tablesdb/increment-row-column.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -19,4 +18,4 @@ const result = await tablesDB.incrementRowColumn({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/list-columns.md b/docs/examples/tablesdb/list-columns.md deleted file mode 100644 index d86132b8..00000000 --- a/docs/examples/tablesdb/list-columns.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.listColumns({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-indexes.md b/docs/examples/tablesdb/list-indexes.md deleted file mode 100644 index 502c45b4..00000000 --- a/docs/examples/tablesdb/list-indexes.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.listIndexes({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-rows.md b/docs/examples/tablesdb/list-rows.md index ea8b3285..455ec6fe 100644 --- a/docs/examples/tablesdb/list-rows.md +++ b/docs/examples/tablesdb/list-rows.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -18,4 +17,4 @@ const result = await tablesDB.listRows({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/list-tables.md b/docs/examples/tablesdb/list-tables.md deleted file mode 100644 index 837210b7..00000000 --- a/docs/examples/tablesdb/list-tables.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.listTables({ - databaseId: '<DATABASE_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/list-transactions.md b/docs/examples/tablesdb/list-transactions.md index d03ca38a..b6448518 100644 --- a/docs/examples/tablesdb/list-transactions.md +++ b/docs/examples/tablesdb/list-transactions.md @@ -1,11 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -14,4 +12,4 @@ const result = await tablesDB.listTransactions({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/list.md b/docs/examples/tablesdb/list.md deleted file mode 100644 index eb207449..00000000 --- a/docs/examples/tablesdb/list.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 5616f1ce..00000000 --- a/docs/examples/tablesdb/update-big-int-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md deleted file mode 100644 index eb7fd44c..00000000 --- a/docs/examples/tablesdb/update-boolean-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateBooleanColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: false, - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md deleted file mode 100644 index 08519fba..00000000 --- a/docs/examples/tablesdb/update-datetime-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md deleted file mode 100644 index c1bbb80d..00000000 --- a/docs/examples/tablesdb/update-email-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateEmailColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'email@example.com', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md deleted file mode 100644 index f65b2d01..00000000 --- a/docs/examples/tablesdb/update-enum-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateEnumColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - elements: [], - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md deleted file mode 100644 index 55f7591c..00000000 --- a/docs/examples/tablesdb/update-float-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md deleted file mode 100644 index 6a383878..00000000 --- a/docs/examples/tablesdb/update-integer-column.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md deleted file mode 100644 index 5c9b780b..00000000 --- a/docs/examples/tablesdb/update-ip-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateIpColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-line-column.md b/docs/examples/tablesdb/update-line-column.md deleted file mode 100644 index e1a9c156..00000000 --- a/docs/examples/tablesdb/update-line-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md deleted file mode 100644 index 241f9c6f..00000000 --- a/docs/examples/tablesdb/update-longtext-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateLongtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md deleted file mode 100644 index d991e312..00000000 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateMediumtextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-point-column.md b/docs/examples/tablesdb/update-point-column.md deleted file mode 100644 index 73a3ca39..00000000 --- a/docs/examples/tablesdb/update-point-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updatePointColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: [1, 2], // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-polygon-column.md b/docs/examples/tablesdb/update-polygon-column.md deleted file mode 100644 index c9ca14df..00000000 --- a/docs/examples/tablesdb/update-polygon-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-relationship-column.md b/docs/examples/tablesdb/update-relationship-column.md deleted file mode 100644 index f6161a32..00000000 --- a/docs/examples/tablesdb/update-relationship-column.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, TablesDB, RelationMutate } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateRelationshipColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - onDelete: RelationMutate.Cascade, // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 1e3bfc99..77a775b3 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -24,4 +23,4 @@ const result = await tablesDB.updateRow({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/update-rows.md b/docs/examples/tablesdb/update-rows.md deleted file mode 100644 index f8aed083..00000000 --- a/docs/examples/tablesdb/update-rows.md +++ /dev/null @@ -1,27 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md deleted file mode 100644 index 19862ca3..00000000 --- a/docs/examples/tablesdb/update-string-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateStringColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-table.md b/docs/examples/tablesdb/update-table.md deleted file mode 100644 index 85f2d597..00000000 --- a/docs/examples/tablesdb/update-table.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB, Permission, Role } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateTable({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - name: '<NAME>', // optional - permissions: [Permission.read(Role.any())], // optional - rowSecurity: false, // optional - enabled: false, // optional - purge: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md deleted file mode 100644 index 5b967ad5..00000000 --- a/docs/examples/tablesdb/update-text-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateTextColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-transaction.md b/docs/examples/tablesdb/update-transaction.md index 1f6458f4..80a8b89d 100644 --- a/docs/examples/tablesdb/update-transaction.md +++ b/docs/examples/tablesdb/update-transaction.md @@ -1,11 +1,9 @@ ```javascript import { Client, TablesDB } from "appwrite"; -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -16,4 +14,4 @@ const result = await tablesDB.updateTransaction({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md deleted file mode 100644 index 2b41777c..00000000 --- a/docs/examples/tablesdb/update-url-column.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateUrlColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: 'https://example.com', - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md deleted file mode 100644 index 8260666d..00000000 --- a/docs/examples/tablesdb/update-varchar-column.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.updateVarcharColumn({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - key: '', - required: false, - xdefault: '<DEFAULT>', - size: 1, // optional - newKey: '' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/update.md b/docs/examples/tablesdb/update.md deleted file mode 100644 index dd960cea..00000000 --- a/docs/examples/tablesdb/update.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.update({ - databaseId: '<DATABASE_ID>', - name: '<NAME>', // optional - enabled: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 089c159c..fb971043 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -1,10 +1,9 @@ ```javascript import { Client, TablesDB, Permission, Role } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const tablesDB = new TablesDB(client); @@ -24,4 +23,4 @@ const result = await tablesDB.upsertRow({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tablesdb/upsert-rows.md b/docs/examples/tablesdb/upsert-rows.md deleted file mode 100644 index 5a16ecf5..00000000 --- a/docs/examples/tablesdb/upsert-rows.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, TablesDB } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tablesDB = new TablesDB(client); - -const result = await tablesDB.upsertRows({ - databaseId: '<DATABASE_ID>', - tableId: '<TABLE_ID>', - rows: [], - transactionId: '<TRANSACTION_ID>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/teams/create-membership.md b/docs/examples/teams/create-membership.md index 54ccc60c..5a23e078 100644 --- a/docs/examples/teams/create-membership.md +++ b/docs/examples/teams/create-membership.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -19,4 +18,4 @@ const result = await teams.createMembership({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/create.md b/docs/examples/teams/create.md index cc4e6a09..2c72bcdf 100644 --- a/docs/examples/teams/create.md +++ b/docs/examples/teams/create.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -15,4 +14,4 @@ const result = await teams.create({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/delete-membership.md b/docs/examples/teams/delete-membership.md index ea863645..2fe13278 100644 --- a/docs/examples/teams/delete-membership.md +++ b/docs/examples/teams/delete-membership.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -14,4 +13,4 @@ const result = await teams.deleteMembership({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/delete.md b/docs/examples/teams/delete.md index 1ab84f9b..054e34ef 100644 --- a/docs/examples/teams/delete.md +++ b/docs/examples/teams/delete.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -13,4 +12,4 @@ const result = await teams.delete({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/get-membership.md b/docs/examples/teams/get-membership.md index f5268722..bdd6c784 100644 --- a/docs/examples/teams/get-membership.md +++ b/docs/examples/teams/get-membership.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -14,4 +13,4 @@ const result = await teams.getMembership({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/get-prefs.md b/docs/examples/teams/get-prefs.md index 1615a560..bf20ed47 100644 --- a/docs/examples/teams/get-prefs.md +++ b/docs/examples/teams/get-prefs.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -13,4 +12,4 @@ const result = await teams.getPrefs({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/get.md b/docs/examples/teams/get.md index 0c59f33c..836a8e08 100644 --- a/docs/examples/teams/get.md +++ b/docs/examples/teams/get.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -13,4 +12,4 @@ const result = await teams.get({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/list-memberships.md b/docs/examples/teams/list-memberships.md index 5f43a8f0..fd3fcd30 100644 --- a/docs/examples/teams/list-memberships.md +++ b/docs/examples/teams/list-memberships.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -16,4 +15,4 @@ const result = await teams.listMemberships({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/list.md b/docs/examples/teams/list.md index ed733995..3406925f 100644 --- a/docs/examples/teams/list.md +++ b/docs/examples/teams/list.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -15,4 +14,4 @@ const result = await teams.list({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/update-membership-status.md b/docs/examples/teams/update-membership-status.md index 95ac2e27..2ca1c62d 100644 --- a/docs/examples/teams/update-membership-status.md +++ b/docs/examples/teams/update-membership-status.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -16,4 +15,4 @@ const result = await teams.updateMembershipStatus({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/update-membership.md b/docs/examples/teams/update-membership.md index 86f7ac57..ecfd1bc8 100644 --- a/docs/examples/teams/update-membership.md +++ b/docs/examples/teams/update-membership.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -15,4 +14,4 @@ const result = await teams.updateMembership({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/update-name.md b/docs/examples/teams/update-name.md index dfe7d489..dce11078 100644 --- a/docs/examples/teams/update-name.md +++ b/docs/examples/teams/update-name.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -14,4 +13,4 @@ const result = await teams.updateName({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/teams/update-prefs.md b/docs/examples/teams/update-prefs.md index b04e4c18..2c8a15a1 100644 --- a/docs/examples/teams/update-prefs.md +++ b/docs/examples/teams/update-prefs.md @@ -1,10 +1,9 @@ ```javascript import { Client, Teams } from "appwrite"; -const client = Client.from({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>' // Your project ID -}); +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID const teams = new Teams(client); @@ -14,4 +13,4 @@ const result = await teams.updatePrefs({ }); console.log(result); -``` \ No newline at end of file +``` diff --git a/docs/examples/tokens/create-file-token.md b/docs/examples/tokens/create-file-token.md deleted file mode 100644 index dd4b2a76..00000000 --- a/docs/examples/tokens/create-file-token.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tokens = new Tokens(client); - -const result = await tokens.createFileToken({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tokens/delete.md b/docs/examples/tokens/delete.md deleted file mode 100644 index 351badd0..00000000 --- a/docs/examples/tokens/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tokens = new Tokens(client); - -const result = await tokens.delete({ - tokenId: '<TOKEN_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tokens/get.md b/docs/examples/tokens/get.md deleted file mode 100644 index e538874a..00000000 --- a/docs/examples/tokens/get.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tokens = new Tokens(client); - -const result = await tokens.get({ - tokenId: '<TOKEN_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tokens/list.md b/docs/examples/tokens/list.md deleted file mode 100644 index e9002f8b..00000000 --- a/docs/examples/tokens/list.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tokens = new Tokens(client); - -const result = await tokens.list({ - bucketId: '<BUCKET_ID>', - fileId: '<FILE_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/tokens/update.md b/docs/examples/tokens/update.md deleted file mode 100644 index 49e6955a..00000000 --- a/docs/examples/tokens/update.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Tokens } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const tokens = new Tokens(client); - -const result = await tokens.update({ - tokenId: '<TOKEN_ID>', - expire: '2020-10-15T06:38:00.000+00:00' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/usage/list-events.md b/docs/examples/usage/list-events.md deleted file mode 100644 index bc6c2726..00000000 --- a/docs/examples/usage/list-events.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Usage } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const usage = new Usage(client); - -const result = await usage.listEvents({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/usage/list-gauges.md b/docs/examples/usage/list-gauges.md deleted file mode 100644 index 0d3c8a2c..00000000 --- a/docs/examples/usage/list-gauges.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Usage } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const usage = new Usage(client); - -const result = await usage.listGauges({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file 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 9268586d..00000000 --- a/docs/examples/users/create-argon-2-user.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createArgon2User({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create-bcrypt-user.md b/docs/examples/users/create-bcrypt-user.md deleted file mode 100644 index ef733636..00000000 --- a/docs/examples/users/create-bcrypt-user.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createBcryptUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create-jwt.md b/docs/examples/users/create-jwt.md deleted file mode 100644 index 94104431..00000000 --- a/docs/examples/users/create-jwt.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createJWT({ - userId: '<USER_ID>', - sessionId: '<SESSION_ID>', // optional - duration: 0 // optional -}); - -console.log(result); -``` \ No newline at end of file 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 36b691af..00000000 --- a/docs/examples/users/create-md-5-user.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createMD5User({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file 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 f6c02914..00000000 --- a/docs/examples/users/create-mfa-recovery-codes.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createMFARecoveryCodes({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file 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 747194e1..00000000 --- a/docs/examples/users/create-ph-pass-user.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createPHPassUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file 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 ecf9c6b7..00000000 --- a/docs/examples/users/create-scrypt-modified-user.md +++ /dev/null @@ -1,23 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create-scrypt-user.md b/docs/examples/users/create-scrypt-user.md deleted file mode 100644 index 4a2545b1..00000000 --- a/docs/examples/users/create-scrypt-user.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create-session.md b/docs/examples/users/create-session.md deleted file mode 100644 index b55a5ef9..00000000 --- a/docs/examples/users/create-session.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createSession({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create-sha-user.md b/docs/examples/users/create-sha-user.md deleted file mode 100644 index e1053617..00000000 --- a/docs/examples/users/create-sha-user.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Users, PasswordHash } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createSHAUser({ - userId: '<USER_ID>', - email: 'email@example.com', - password: 'password', - passwordVersion: PasswordHash.Sha1, // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create-target.md b/docs/examples/users/create-target.md deleted file mode 100644 index 944ffaba..00000000 --- a/docs/examples/users/create-target.md +++ /dev/null @@ -1,22 +0,0 @@ -```javascript -import { Client, Users, MessagingProviderType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - providerType: MessagingProviderType.Email, - identifier: '<IDENTIFIER>', - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create-token.md b/docs/examples/users/create-token.md deleted file mode 100644 index 0a7ab988..00000000 --- a/docs/examples/users/create-token.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.createToken({ - userId: '<USER_ID>', - length: 4, // optional - expire: 60 // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/create.md b/docs/examples/users/create.md deleted file mode 100644 index 713af3a8..00000000 --- a/docs/examples/users/create.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.create({ - userId: '<USER_ID>', - email: 'email@example.com', // optional - phone: '+12065550100', // optional - password: '', // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/delete-identity.md b/docs/examples/users/delete-identity.md deleted file mode 100644 index 25af7d8e..00000000 --- a/docs/examples/users/delete-identity.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.deleteIdentity({ - identityId: '<IDENTITY_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/delete-mfa-authenticator.md b/docs/examples/users/delete-mfa-authenticator.md deleted file mode 100644 index 559bb51d..00000000 --- a/docs/examples/users/delete-mfa-authenticator.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users, AuthenticatorType } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.deleteMFAAuthenticator({ - userId: '<USER_ID>', - type: AuthenticatorType.Totp -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/delete-session.md b/docs/examples/users/delete-session.md deleted file mode 100644 index ffe52dcf..00000000 --- a/docs/examples/users/delete-session.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.deleteSession({ - userId: '<USER_ID>', - sessionId: '<SESSION_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/delete-sessions.md b/docs/examples/users/delete-sessions.md deleted file mode 100644 index 8b6fc849..00000000 --- a/docs/examples/users/delete-sessions.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.deleteSessions({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/delete-target.md b/docs/examples/users/delete-target.md deleted file mode 100644 index f5ddb2d2..00000000 --- a/docs/examples/users/delete-target.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.deleteTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/delete.md b/docs/examples/users/delete.md deleted file mode 100644 index b18920b2..00000000 --- a/docs/examples/users/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.delete({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file 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 109eb94e..00000000 --- a/docs/examples/users/get-mfa-recovery-codes.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.getMFARecoveryCodes({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/get-prefs.md b/docs/examples/users/get-prefs.md deleted file mode 100644 index 6f186ea3..00000000 --- a/docs/examples/users/get-prefs.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.getPrefs({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/get-target.md b/docs/examples/users/get-target.md deleted file mode 100644 index a39832fb..00000000 --- a/docs/examples/users/get-target.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.getTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/get.md b/docs/examples/users/get.md deleted file mode 100644 index 03ef3552..00000000 --- a/docs/examples/users/get.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.get({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/list-identities.md b/docs/examples/users/list-identities.md deleted file mode 100644 index 3c938d41..00000000 --- a/docs/examples/users/list-identities.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.listIdentities({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/list-logs.md b/docs/examples/users/list-logs.md deleted file mode 100644 index 3ae2a3ea..00000000 --- a/docs/examples/users/list-logs.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.listLogs({ - userId: '<USER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/list-memberships.md b/docs/examples/users/list-memberships.md deleted file mode 100644 index 4ff9564e..00000000 --- a/docs/examples/users/list-memberships.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.listMemberships({ - userId: '<USER_ID>', - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/list-mfa-factors.md b/docs/examples/users/list-mfa-factors.md deleted file mode 100644 index 76a63f84..00000000 --- a/docs/examples/users/list-mfa-factors.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.listMFAFactors({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/list-sessions.md b/docs/examples/users/list-sessions.md deleted file mode 100644 index 21b6cbd7..00000000 --- a/docs/examples/users/list-sessions.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.listSessions({ - userId: '<USER_ID>', - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/list-targets.md b/docs/examples/users/list-targets.md deleted file mode 100644 index c3422d06..00000000 --- a/docs/examples/users/list-targets.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.listTargets({ - userId: '<USER_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/list.md b/docs/examples/users/list.md deleted file mode 100644 index 7cec3874..00000000 --- a/docs/examples/users/list.md +++ /dev/null @@ -1,19 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.list({ - queries: [], // optional - search: '<SEARCH>', // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-email-verification.md b/docs/examples/users/update-email-verification.md deleted file mode 100644 index 70c6e061..00000000 --- a/docs/examples/users/update-email-verification.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateEmailVerification({ - userId: '<USER_ID>', - emailVerification: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-email.md b/docs/examples/users/update-email.md deleted file mode 100644 index 888db49e..00000000 --- a/docs/examples/users/update-email.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateEmail({ - userId: '<USER_ID>', - email: 'email@example.com' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-impersonator.md b/docs/examples/users/update-impersonator.md deleted file mode 100644 index 40f37765..00000000 --- a/docs/examples/users/update-impersonator.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateImpersonator({ - userId: '<USER_ID>', - impersonator: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-labels.md b/docs/examples/users/update-labels.md deleted file mode 100644 index 1924283c..00000000 --- a/docs/examples/users/update-labels.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateLabels({ - userId: '<USER_ID>', - labels: [] -}); - -console.log(result); -``` \ No newline at end of file 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 ddf0faa4..00000000 --- a/docs/examples/users/update-mfa-recovery-codes.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateMFARecoveryCodes({ - userId: '<USER_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-mfa.md b/docs/examples/users/update-mfa.md deleted file mode 100644 index 57856c5e..00000000 --- a/docs/examples/users/update-mfa.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateMFA({ - userId: '<USER_ID>', - mfa: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-name.md b/docs/examples/users/update-name.md deleted file mode 100644 index 34ad4fb9..00000000 --- a/docs/examples/users/update-name.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateName({ - userId: '<USER_ID>', - name: '<NAME>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-password.md b/docs/examples/users/update-password.md deleted file mode 100644 index 320c9fc3..00000000 --- a/docs/examples/users/update-password.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updatePassword({ - userId: '<USER_ID>', - password: '' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-phone-verification.md b/docs/examples/users/update-phone-verification.md deleted file mode 100644 index 1b7f3838..00000000 --- a/docs/examples/users/update-phone-verification.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updatePhoneVerification({ - userId: '<USER_ID>', - phoneVerification: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-phone.md b/docs/examples/users/update-phone.md deleted file mode 100644 index 42327936..00000000 --- a/docs/examples/users/update-phone.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updatePhone({ - userId: '<USER_ID>', - number: '+12065550100' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-prefs.md b/docs/examples/users/update-prefs.md deleted file mode 100644 index a817fb9d..00000000 --- a/docs/examples/users/update-prefs.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updatePrefs({ - userId: '<USER_ID>', - prefs: {} -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-status.md b/docs/examples/users/update-status.md deleted file mode 100644 index ccfeb591..00000000 --- a/docs/examples/users/update-status.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateStatus({ - userId: '<USER_ID>', - status: false -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/users/update-target.md b/docs/examples/users/update-target.md deleted file mode 100644 index 77cbbe6b..00000000 --- a/docs/examples/users/update-target.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Users } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const users = new Users(client); - -const result = await users.updateTarget({ - userId: '<USER_ID>', - targetId: '<TARGET_ID>', - identifier: '<IDENTIFIER>', // optional - providerId: '<PROVIDER_ID>', // optional - name: '<NAME>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/webhooks/create.md b/docs/examples/webhooks/create.md deleted file mode 100644 index 6dd24b3c..00000000 --- a/docs/examples/webhooks/create.md +++ /dev/null @@ -1,25 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const webhooks = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/webhooks/delete.md b/docs/examples/webhooks/delete.md deleted file mode 100644 index 1d7ee085..00000000 --- a/docs/examples/webhooks/delete.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const webhooks = new Webhooks(client); - -const result = await webhooks.delete({ - webhookId: '<WEBHOOK_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/webhooks/get.md b/docs/examples/webhooks/get.md deleted file mode 100644 index 6d9e603a..00000000 --- a/docs/examples/webhooks/get.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const webhooks = new Webhooks(client); - -const result = await webhooks.get({ - webhookId: '<WEBHOOK_ID>' -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/webhooks/list.md b/docs/examples/webhooks/list.md deleted file mode 100644 index 5411b8b2..00000000 --- a/docs/examples/webhooks/list.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const webhooks = new Webhooks(client); - -const result = await webhooks.list({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/webhooks/update-secret.md b/docs/examples/webhooks/update-secret.md deleted file mode 100644 index cd83ccd5..00000000 --- a/docs/examples/webhooks/update-secret.md +++ /dev/null @@ -1,18 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const webhooks = new Webhooks(client); - -const result = await webhooks.updateSecret({ - webhookId: '<WEBHOOK_ID>', - secret: '<SECRET>' // optional -}); - -console.log(result); -``` \ No newline at end of file diff --git a/docs/examples/webhooks/update.md b/docs/examples/webhooks/update.md deleted file mode 100644 index a30dc425..00000000 --- a/docs/examples/webhooks/update.md +++ /dev/null @@ -1,24 +0,0 @@ -```javascript -import { Client, Webhooks } from "appwrite"; - -const client = Client.fromAPIKey({ - endpoint: 'https://<REGION>.cloud.appwrite.io/v1', // Your API Endpoint - projectId: '<YOUR_PROJECT_ID>', // Your project ID - apiKey: '<YOUR_API_KEY>' // Your secret API key -}); - -const webhooks = new 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 -}); - -console.log(result); -``` \ No newline at end of file diff --git a/src/client.ts b/src/client.ts index ab486cd0..15a03579 100644 --- a/src/client.ts +++ b/src/client.ts @@ -344,48 +344,8 @@ class AppwriteException extends Error { /** * Client that handles requests to Appwrite */ -type SDKPlatform = 'client' | 'server'; -type ClientAuth = 'browser' | 'session' | 'devKey' | 'impersonation'; -type ServerAuth = 'apiKey' | 'jwt' | 'cookie'; -type Auth = ClientAuth | ServerAuth; -declare const clientAuthBrand: unique symbol; - -// Forces TypeScript to display the expanded shape on hover instead of an alias name. -type Prettify<T> = { [K in keyof T]: T[K] } & {}; - -type BaseClientParams = { - endpoint: string; - endpointRealtime?: string; - selfSigned?: boolean; - projectId: string; - locale?: string; -}; - -type ImpersonationTarget = - | { userId: string; email?: never; phone?: never } - | { email: string; userId?: never; phone?: never } - | { phone: string; userId?: never; email?: never }; - -type LegacyClientSetter = Extract<keyof ClientRuntime<any>, `set${string}`>; -type ClientAuthBuilder = Extract<keyof ClientRuntime<any>, `with${string}`>; -type ClientInternalMethod = LegacyClientSetter | ClientAuthBuilder; -export type Client<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientInternalMethod>; -type LegacyClient<TAuth extends Auth = 'browser'> = Omit<ClientRuntime<TAuth>, ClientAuthBuilder>; - -type ClientConstructor = { - new <TAuth extends Auth = 'browser'>(): LegacyClient<TAuth>; - from(params: Prettify<BaseClientParams>): Client<'browser'>; - fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'>; - fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'>; - fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'>; - fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'>; - fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'>; - fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'>; -}; - -class ClientRuntime<TAuth extends Auth = 'browser'> { +class Client { static CHUNK_SIZE = 1024 * 1024 * 5; - declare readonly [clientAuthBrand]?: TAuth; /** * Holds configuration such as project. @@ -394,36 +354,27 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { endpoint: string; endpointRealtime: string; project: string; - key: string; jwt: string; locale: string; session: string; - forwardeduseragent: string; devkey: string; cookie: string; impersonateuserid: string; impersonateuseremail: string; impersonateuserphone: string; - selfSigned: boolean; } = { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', project: '', - key: '', jwt: '', locale: '', session: '', - forwardeduseragent: '', devkey: '', cookie: '', impersonateuserid: '', impersonateuseremail: '', impersonateuserphone: '', - selfSigned: false, }; - - private sdkPlatform: SDKPlatform = 'client'; - /** * Custom headers for API requests. */ @@ -435,115 +386,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { 'X-Appwrite-Response-Format': '1.9.5', }; - static from(params: Prettify<BaseClientParams>): Client<'browser'> { - return new ClientRuntime<'browser'>().applyBase<'browser'>(params, 'client'); - } - - static fromSession(params: Prettify<BaseClientParams & { session: string }>): Client<'session'> { - const client = new ClientRuntime<'session'>() - .applyBase<'session'>(params, 'client'); - client.headers['X-Appwrite-Session'] = params.session; - client.config.session = params.session; - return client; - } - - static fromAPIKey(params: Prettify<BaseClientParams & { apiKey: string }>): Client<'apiKey'> { - const client = new ClientRuntime<'apiKey'>() - .applyBase<'apiKey'>(params, 'server'); - client.headers['X-Appwrite-Key'] = params.apiKey; - (client.config as unknown as Record<string, string>).key = params.apiKey; - return client; - } - - static fromCookie(params: Prettify<BaseClientParams & { cookie: string }>): Client<'cookie'> { - const client = new ClientRuntime<'cookie'>() - .applyBase<'cookie'>(params, 'server'); - client.headers['Cookie'] = params.cookie; - client.config.cookie = params.cookie; - return client; - } - - static fromJWT(params: Prettify<BaseClientParams & { jwt: string }>): Client<'jwt'> { - const client = new ClientRuntime<'jwt'>() - .applyBase<'jwt'>(params, 'server'); - client.headers['X-Appwrite-JWT'] = params.jwt; - client.config.jwt = params.jwt; - return client; - } - - static fromDevKey(params: Prettify<BaseClientParams & { devKey: string }>): Client<'devKey'> { - const client = new ClientRuntime<'devKey'>() - .applyBase<'devKey'>(params, 'client'); - client.headers['X-Appwrite-Dev-Key'] = params.devKey; - client.config.devkey = params.devKey; - return client; - } - - static fromImpersonation(params: Prettify<BaseClientParams & { session: string } & ImpersonationTarget>): Client<'impersonation'> { - const targets = [ - params.userId !== undefined, - params.email !== undefined, - params.phone !== undefined - ].filter(Boolean).length; - - if (targets !== 1) { - throw new AppwriteException('Exactly one impersonation target must be provided'); - } - - const client = new ClientRuntime<'impersonation'>() - .applyBase<'impersonation'>(params, 'client'); - - client.headers['X-Appwrite-Session'] = params.session; - client.config.session = params.session; - - if (params.userId !== undefined) { - client.headers['X-Appwrite-Impersonate-User-Id'] = params.userId; - client.config.impersonateuserid = params.userId; - return client; - } - if (params.email !== undefined) { - client.headers['X-Appwrite-Impersonate-User-Email'] = params.email; - client.config.impersonateuseremail = params.email; - return client; - } - client.headers['X-Appwrite-Impersonate-User-Phone'] = params.phone; - client.config.impersonateuserphone = params.phone; - return client; - } - - withJWT(jwt: string): this { - this.headers['X-Appwrite-JWT'] = jwt; - this.config.jwt = jwt; - return this; - } - - withForwardedUserAgent(forwardedUserAgent: string): this { - this.headers['X-Forwarded-User-Agent'] = forwardedUserAgent; - return this; - } - - private applyBase<T extends Auth>(params: BaseClientParams, sdkPlatform: SDKPlatform): ClientRuntime<T> { - const client = this as unknown as ClientRuntime<T>; - client.sdkPlatform = sdkPlatform; - client.headers['x-sdk-platform'] = sdkPlatform === 'server' ? 'server' : 'client'; - client.setEndpoint(params.endpoint); - client.setProject(params.projectId); - - if (params.locale !== undefined) { - client.setLocale(params.locale); - } - - if (params.endpointRealtime !== undefined) { - client.setEndpointRealtime(params.endpointRealtime); - } - - if (params.selfSigned !== undefined) { - client.setSelfSigned(params.selfSigned); - } - - return client; - } - /** * Get Headers * @@ -565,9 +407,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { * * @returns {this} */ - /** - * @deprecated Use `Client.from`, `Client.fromSession`, `Client.fromAPIKey`, or another static factory instead. - */ setEndpoint(endpoint: string): this { if (!endpoint || typeof endpoint !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -590,9 +429,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { * * @returns {this} */ - /** - * @deprecated Use the `endpointRealtime` field on a static factory params object instead. - */ setEndpointRealtime(endpointRealtime: string): this { if (!endpointRealtime || typeof endpointRealtime !== 'string') { throw new AppwriteException('Endpoint must be a valid string'); @@ -607,120 +443,129 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { } /** - * Set self-signed + * Set Project * - * @param {boolean} selfSigned + * Your project ID * - * @returns {this} - */ - /** - * @deprecated Use the `selfSigned` field on a static factory params object instead. - */ - setSelfSigned(selfSigned: boolean): this { - this.config.selfSigned = selfSigned; - return this; - } - - /** - * @deprecated Use a static client factory or factory params object instead. + * @param value string + * + * @return {this} */ setProject(value: string): this { - this.headers['X-Appwrite-Project'] = value; this.config.project = value; - return this as unknown as this; - } - - /** - * @deprecated Use a static client factory or factory params object instead. - */ - setKey(value: string): ClientRuntime<'apiKey'> { - this.headers['X-Appwrite-Key'] = value; - this.config.key = value; - return this as unknown as ClientRuntime<'apiKey'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set JWT + * + * Your secret JSON Web Token + * + * @param value string + * + * @return {this} */ - setJWT(value: string): ClientRuntime<'jwt'> { + setJWT(value: string): this { this.headers['X-Appwrite-JWT'] = value; this.config.jwt = value; - return this as unknown as ClientRuntime<'jwt'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set Locale + * + * @param value string + * + * @return {this} */ setLocale(value: string): this { this.headers['X-Appwrite-Locale'] = value; this.config.locale = value; - return this as unknown as this; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * Set Session + * + * The user session to authenticate with + * + * @param value string + * + * @return {this} */ - setSession(value: string): ClientRuntime<'session'> { + setSession(value: string): this { this.headers['X-Appwrite-Session'] = value; this.config.session = value; - return this as unknown as ClientRuntime<'session'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. - */ - setForwardedUserAgent(value: string): this { - this.headers['X-Forwarded-User-Agent'] = value; - this.config.forwardeduseragent = value; - return this as unknown as this; - } - - /** - * @deprecated Use a static client factory or factory params object instead. + * Set DevKey + * + * Your secret dev API key + * + * @param value string + * + * @return {this} */ - setDevKey(value: string): ClientRuntime<'devKey'> { + setDevKey(value: string): this { this.headers['X-Appwrite-Dev-Key'] = value; this.config.devkey = value; - return this as unknown as ClientRuntime<'devKey'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * 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): ClientRuntime<'cookie'> { + setCookie(value: string): this { this.headers['Cookie'] = value; this.config.cookie = value; - return this as unknown as ClientRuntime<'cookie'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * 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): ClientRuntime<'impersonation'> { + setImpersonateUserId(value: string): this { this.headers['X-Appwrite-Impersonate-User-Id'] = value; this.config.impersonateuserid = value; - return this as unknown as ClientRuntime<'impersonation'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * 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): ClientRuntime<'impersonation'> { + setImpersonateUserEmail(value: string): this { this.headers['X-Appwrite-Impersonate-User-Email'] = value; this.config.impersonateuseremail = value; - return this as unknown as ClientRuntime<'impersonation'>; + return this; } - /** - * @deprecated Use a static client factory or factory params object instead. + * 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): ClientRuntime<'impersonation'> { + setImpersonateUserPhone(value: string): this { this.headers['X-Appwrite-Impersonate-User-Phone'] = value; this.config.impersonateuserphone = value; - return this as unknown as ClientRuntime<'impersonation'>; + return this; } - private realtime: Realtime = { socket: undefined, timeout: undefined, @@ -734,13 +579,9 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { lastMessage: undefined, connect: () => { clearTimeout(this.realtime.timeout); - this.realtime.timeout = typeof window !== 'undefined' - ? window.setTimeout(() => { - this.realtime.createSocket(); - }, 50) - : setTimeout(() => { - this.realtime.createSocket(); - }, 50) as unknown as TimeoutHandle; + this.realtime.timeout = window?.setTimeout(() => { + this.realtime.createSocket(); + }, 50); }, getTimeout: () => { switch (true) { @@ -756,20 +597,14 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { }, createHeartbeat: () => { if (this.realtime.heartbeat) { - clearInterval(this.realtime.heartbeat as any); + clearTimeout(this.realtime.heartbeat); } - this.realtime.heartbeat = typeof window !== 'undefined' - ? window.setInterval(() => { - this.realtime.socket?.send(JSONbig.stringify({ - type: 'ping' - })); - }, 20_000) - : setInterval(() => { - this.realtime.socket?.send(JSONbig.stringify({ - type: 'ping' - })); - }, 20_000) as unknown as TimeoutHandle; + this.realtime.heartbeat = window?.setInterval(() => { + this.realtime.socket?.send(JSONbig.stringify({ + type: 'ping' + })); + }, 20_000); }, createSocket: () => { if (this.realtime.subscriptions.size < 1) { @@ -855,14 +690,8 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { let session = this.config.session; if (!session) { - try { - if (typeof window !== 'undefined' && window.localStorage) { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.config.project}`]; - } - } catch (error) { - console.error('Failed to parse cookie fallback:', error); - } + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.config.project}`]; } if (session && !messageData?.user) { this.realtime.socket?.send(JSONbig.stringify(<RealtimeRequest>{ @@ -1027,7 +856,7 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { headers = Object.assign({}, this.headers, headers); - if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage) { + if (typeof window !== 'undefined' && window.localStorage) { const cookieFallback = window.localStorage.getItem('cookieFallback'); if (cookieFallback) { headers['X-Fallback-Cookies'] = cookieFallback; @@ -1039,12 +868,12 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { headers, }; - if (this.sdkPlatform === 'client' && headers['X-Appwrite-Dev-Key'] === undefined) { + if (headers['X-Appwrite-Dev-Key'] === undefined) { options.credentials = 'include'; } if (method === 'GET') { - for (const [key, value] of Object.entries(ClientRuntime.flatten(params))) { + for (const [key, value] of Object.entries(Client.flatten(params))) { url.searchParams.append(key, value); } } else { @@ -1054,10 +883,6 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { break; case 'multipart/form-data': - if (typeof FormData === 'undefined' || typeof File === 'undefined') { - throw new AppwriteException('Multipart requests require File and FormData globals'); - } - const formData = new FormData(); for (const [key, value] of Object.entries(params)) { @@ -1082,60 +907,144 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { } async chunkedUpload(method: string, url: URL, headers: Headers = {}, originalPayload: Payload = {}, onProgress: (progress: UploadProgress) => void) { - if (typeof File === 'undefined' || typeof FormData === 'undefined') { - throw new AppwriteException('Chunked uploads require File and FormData globals'); - } - const [fileParam, file] = Object.entries(originalPayload).find(([_, value]) => value instanceof File) ?? []; if (!file || !fileParam) { throw new Error('File not found in payload'); } - if (file.size <= ClientRuntime.CHUNK_SIZE) { + 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 + ClientRuntime.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; + } + + // 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 }); + } + // Upload remaining chunks with max concurrency of 8 + const CONCURRENCY = 8; + let completedCount = 1; + let uploadedBytes = firstChunkEnd; + let lastResponse = response; + let finalResponse = null; + let rejected = 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 }; - chunkHeaders['content-range'] = `bytes ${start}-${end-1}/${file.size}`; - const chunk = file.slice(start, end); + 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); - let payload = { ...originalPayload }; - payload[fileParam] = new File([chunk], file.name); + const chunkResponse = await this.call(method, url, chunkHeaders, chunkPayload); - response = await this.call(method, url, chunkHeaders, payload); + if (rejected) { + 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 / ClientRuntime.CHUNK_SIZE), - chunksUploaded: Math.ceil(end / ClientRuntime.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; - } + await new Promise<void>((resolve, reject) => { + let nextChunk = 0; + let inFlight = 0; + let completed = 0; - return response; + const uploadNext = () => { + if (rejected) { + return; + } + + if (completed === chunks.length) { + resolve(); + return; + } + + while (inFlight < CONCURRENCY && nextChunk < chunks.length) { + const chunk = chunks[nextChunk++]; + inFlight++; + + uploadChunk(chunk) + .then(() => { + inFlight--; + completed++; + uploadNext(); + }) + .catch((error) => { + rejected = true; + reject(error); + }); + } + }; + + uploadNext(); + }); + + return finalResponse ?? lastResponse; } - async ping(): Promise<string> { - return this.call('GET', new URL(this.config.endpoint + '/ping')); + async ping(): Promise<unknown> { + return this.call('GET', new URL(this.config.endpoint + '/ping'), { + 'X-Appwrite-Project': this.config.project, + }); } async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}, responseType = 'json'): Promise<any> { @@ -1146,9 +1055,9 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { const response = await fetch(uri, options); // type opaque: No-CORS, different-origin response (CORS-issue) - if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && response.type === 'opaque') { + if (response.type === 'opaque') { throw new AppwriteException( - `Invalid Origin. Register your new client (${typeof window !== 'undefined' ? window.location.host : 'unknown'}) as a new Web platform on your project console dashboard`, + `Invalid Origin. Register your new client (${window.location.host}) as a new Web platform on your project console dashboard`, 403, "forbidden", "" @@ -1182,13 +1091,18 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { const cookieFallback = response.headers.get('X-Fallback-Cookies'); - if (this.sdkPlatform === 'client' && typeof window !== 'undefined' && window.localStorage && cookieFallback) { + if (typeof window !== 'undefined' && window.localStorage && cookieFallback) { window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); window.localStorage.setItem('cookieFallback', cookieFallback); } 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; @@ -1200,7 +1114,7 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { for (const [key, value] of Object.entries(data)) { let finalKey = prefix ? prefix + '[' + key +']' : key; if (Array.isArray(value)) { - output = { ...output, ...ClientRuntime.flatten(value, finalKey) }; + output = { ...output, ...Client.flatten(value, finalKey) }; } else { output[finalKey] = value; } @@ -1210,9 +1124,8 @@ class ClientRuntime<TAuth extends Auth = 'browser'> { } } -const Client = ClientRuntime as unknown as ClientConstructor; - export { Client, AppwriteException }; -export type { Models, SDKPlatform, ClientAuth, ServerAuth, Payload, RealtimeResponseEvent, UploadProgress }; export { Query } from './query'; +export type { Models, Payload, UploadProgress }; +export type { RealtimeResponseEvent }; 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/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/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 deleted file mode 100644 index 1466d635..00000000 --- a/src/enums/build-runtime.ts +++ /dev/null @@ -1,91 +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', - 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/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/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/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/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 f4d20688..00000000 --- a/src/enums/runtime.ts +++ /dev/null @@ -1,91 +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', - 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/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/index.ts b/src/index.ts index caffb1df..eddcb150 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,29 +7,20 @@ */ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; -export { Activities } from './services/activities'; +export { Apps } from './services/apps'; 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 { Oauth2 } from './services/oauth-2'; 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 { Realtime } from './services/realtime'; -export type { Models, Payload, RealtimeResponseEvent, UploadProgress, SDKPlatform, ClientAuth, ServerAuth } from './client'; +export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client'; export type { RealtimeSubscription } from './services/realtime'; export type { QueryTypes, QueryTypesList } from './query'; export { Permission } from './permission'; @@ -43,55 +34,11 @@ 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'; -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/models.ts b/src/models.ts index de934950..5ae75f25 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1,20 +1,5 @@ -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 @@ -54,7 +39,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. */ @@ -65,90 +50,6 @@ export namespace Models { 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 */ @@ -205,34 +106,6 @@ export namespace Models { 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 */ @@ -261,76 +134,6 @@ export namespace Models { 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 */ @@ -345,34 +148,6 @@ export namespace Models { 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 */ @@ -444,6648 +219,1507 @@ export namespace Models { } /** - * Variables List + * Locale codes list */ - export type VariableList = { + export type LocaleCodeList = { /** - * Total number of variables that matched your query. + * Total number of localeCodes that matched your query. */ total: number; /** - * List of variables. + * List of localeCodes. */ - variables: Variable[]; + localeCodes: LocaleCode[]; } /** - * Mock Numbers List + * Transaction List */ - export type MockNumberList = { + export type TransactionList = { /** - * Total number of mockNumbers that matched your query. + * Total number of transactions that matched your query. */ total: number; /** - * List of mockNumbers. + * List of transactions. */ - mockNumbers: MockNumber[]; + transactions: Transaction[]; } /** - * Policies List + * Row */ - export type PolicyList = { + export type Row = { /** - * Total number of policies in the given project. + * Row ID. */ - total: number; + $id: string; /** - * List of policies. + * Row sequence ID. */ - 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 = { + $sequence: string; /** - * Total number of templates that matched your query. + * Table ID. */ - total: number; + $tableId: string; + /** + * Database ID. + */ + $databaseId: string; /** - * List of templates. + * Row creation date in ISO 8601 format. */ - templates: EmailTemplate[]; - } - - /** - * Status List - */ - export type HealthStatusList = { + $createdAt: string; /** - * Total number of statuses that matched your query. + * Row update date in ISO 8601 format. */ - total: number; + $updatedAt: string; /** - * List of statuses. + * Row permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - statuses: HealthStatus[]; + $permissions: string[]; } + export type DefaultRow = Row & { + [key: string]: any; + [__default]: true; + }; + /** - * Rule List + * Document */ - export type ProxyRuleList = { + export type Document = { /** - * Total number of rules that matched your query. + * Document ID. */ - total: number; + $id: string; /** - * List of rules. + * Document sequence ID. */ - rules: ProxyRule[]; - } - - /** - * Locale codes list - */ - export type LocaleCodeList = { + $sequence: string; /** - * Total number of localeCodes that matched your query. + * Collection ID. */ - total: number; + $collectionId: string; /** - * List of localeCodes. + * Database ID. */ - localeCodes: LocaleCode[]; - } - - /** - * Provider list - */ - export type ProviderList = { + $databaseId: string; /** - * Total number of providers that matched your query. + * Document creation date in ISO 8601 format. */ - total: number; + $createdAt: string; + /** + * Document update date in ISO 8601 format. + */ + $updatedAt: string; /** - * List of providers. + * Document permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - providers: Provider[]; + $permissions: string[]; } + export type DefaultDocument = Document & { + [key: string]: any; + [__default]: true; + }; + /** - * Message list + * Presence */ - export type MessageList = { + export type Presence = { /** - * Total number of messages that matched your query. + * Presence ID. */ - total: number; + $id: string; + /** + * Presence creation date in ISO 8601 format. + */ + $createdAt: string; /** - * List of messages. + * Presence update date in ISO 8601 format. */ - messages: Message[]; - } - - /** - * Topic list - */ - export type TopicList = { + $updatedAt: string; /** - * Total number of topics that matched your query. + * Presence permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - total: number; + $permissions: string[]; /** - * List of topics. + * User ID. */ - topics: Topic[]; - } - - /** - * Subscriber list - */ - export type SubscriberList = { + userId: string; /** - * Total number of subscribers that matched your query. + * Presence status. */ - total: number; + status?: string; /** - * List of subscribers. + * Presence source. */ - subscribers: Subscriber[]; - } - - /** - * Target list - */ - export type TargetList = { + source: string; /** - * Total number of targets that matched your query. + * Presence expiry date in ISO 8601 format. */ - total: number; + expiresAt?: string; /** - * List of targets. + * Presence metadata. */ - targets: Target[]; + metadata?: object; } /** - * 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 + * Log */ - export type PlatformWeb = { - /** - * Platform ID. - */ - $id: string; - /** - * Platform creation date in ISO 8601 format. - */ - $createdAt: string; + export type Log = { /** - * Platform update date in ISO 8601 format. + * Event name. */ - $updatedAt: string; + event: string; /** - * Platform name. + * User ID of the actor recorded for this log. During impersonation, this is the original impersonator, not the impersonated target user. */ - name: string; + userId: string; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * User email of the actor recorded for this log. During impersonation, this is the original impersonator. */ - type: PlatformType; + userEmail: string; /** - * Web app hostname. Empty string for other platforms. + * User name of the actor recorded for this log. During impersonation, this is the original impersonator. */ - hostname: string; - } - - /** - * Platform Apple - */ - export type PlatformApple = { + userName: string; /** - * Platform ID. + * API mode when event triggered. */ - $id: string; + mode: string; /** - * Platform creation date in ISO 8601 format. + * User type who triggered the audit log. Possible values: user, admin, guest, keyProject, keyAccount, keyOrganization. */ - $createdAt: string; + userType: string; /** - * Platform update date in ISO 8601 format. + * IP session in use when the session was created. */ - $updatedAt: string; + ip: string; /** - * Platform name. + * Log creation date in ISO 8601 format. */ - name: string; + time: string; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). */ - type: PlatformType; + osCode: string; /** - * Apple bundle identifier. + * Operating system name. */ - bundleIdentifier: string; - } - - /** - * Platform Android - */ - export type PlatformAndroid = { + osName: string; /** - * Platform ID. + * Operating system version. */ - $id: string; + osVersion: string; /** - * Platform creation date in ISO 8601 format. + * Client type. */ - $createdAt: string; + clientType: string; /** - * Platform update date in ISO 8601 format. + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). */ - $updatedAt: string; + clientCode: string; /** - * Platform name. + * Client name. */ - name: string; + clientName: string; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * Client version. */ - type: PlatformType; + clientVersion: string; /** - * Android application ID. + * Client engine name. */ - applicationId: string; - } - - /** - * Platform Windows - */ - export type PlatformWindows = { + clientEngine: string; /** - * Platform ID. + * Client engine name. */ - $id: string; + clientEngineVersion: string; /** - * Platform creation date in ISO 8601 format. + * Device name. */ - $createdAt: string; + deviceName: string; /** - * Platform update date in ISO 8601 format. + * Device brand name. */ - $updatedAt: string; + deviceBrand: string; /** - * Platform name. + * Device model name. */ - name: string; + deviceModel: string; /** - * Platform type. Possible values are: windows, apple, android, linux, web. + * Country two-character ISO 3166-1 alpha code. */ - type: PlatformType; + countryCode: string; /** - * Windows package identifier name. + * Country name. */ - packageIdentifierName: string; + countryName: string; } /** - * Platform Linux + * User */ - export type PlatformLinux = { + export type User<Preferences extends Models.Preferences = Models.DefaultPreferences> = { /** - * Platform ID. + * User ID. */ $id: string; /** - * Platform creation date in ISO 8601 format. + * User creation date in ISO 8601 format. */ $createdAt: string; /** - * Platform update date in ISO 8601 format. + * User update date in ISO 8601 format. */ $updatedAt: string; /** - * Platform name. + * User 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. + * Hashed user password. */ - $id: string; + password?: string; /** - * Variable creation date in ISO 8601 format. + * Password hashing algorithm. */ - $createdAt: string; + hash?: string; /** - * Variable creation date in ISO 8601 format. + * Password hashing algorithm configuration. */ - $updatedAt: string; + hashOptions?: object; /** - * Variable key. + * User registration date in ISO 8601 format. */ - key: string; + registration: string; /** - * Variable value. + * User status. Pass `true` for enabled and `false` for disabled. */ - value: string; + status: boolean; /** - * Variable secret flag. Secret variables can only be updated or deleted, but never read. + * Labels for the user. */ - secret: boolean; + labels: string[]; /** - * Service to which the variable belongs. Possible values are "project", "function" + * Password update time in ISO 8601 format. */ - resourceType: string; + passwordUpdate: 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. + * User email address. */ - resourceId: string; - } - - /** - * Country - */ - export type Country = { + email: string; /** - * Country name. + * User phone number in E.164 format. */ - name: string; + phone: string; /** - * Country two-character ISO 3166-1 alpha code. + * Email verification status. */ - code: string; - } - - /** - * Continent - */ - export type Continent = { + emailVerification: boolean; /** - * Continent name. + * Canonical form of the user email address. */ - name: string; + emailCanonical?: string; /** - * Continent two letter code. + * Whether the user email is from a free email provider. */ - code: string; - } - - /** - * Language - */ - export type Language = { + emailIsFree?: boolean; /** - * Language name. + * Whether the user email is from a disposable email provider. */ - name: string; + emailIsDisposable?: boolean; /** - * Language two-character ISO 639-1 codes. + * Whether the user email is from a corporate domain. */ - code: string; + emailIsCorporate?: boolean; /** - * Language native name. + * Whether the user email is in its canonical form. */ - nativeName: string; - } - - /** - * Currency - */ - export type Currency = { + emailIsCanonical?: boolean; /** - * Currency symbol. + * Phone verification status. */ - symbol: string; + phoneVerification: boolean; /** - * Currency name. + * Multi factor authentication status. */ - name: string; + mfa: boolean; /** - * Currency native symbol. + * User preferences as a key-value object */ - symbolNative: string; + prefs: Preferences; /** - * Number of decimal digits. + * 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. */ - decimalDigits: number; + targets: Target[]; /** - * Currency digit rounding. + * Most recent access date in ISO 8601 format. This attribute is only updated again after 24 hours. */ - rounding: number; + accessedAt: string; /** - * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. + * Whether the user can impersonate other users. */ - code: string; + impersonator?: boolean; /** - * Currency plural name + * 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. */ - namePlural: string; + impersonatorUserId?: string; } /** - * Phone + * AlgoMD5 */ - export type Phone = { - /** - * Phone code. - */ - code: string; - /** - * Country two-character ISO 3166-1 alpha code. - */ - countryCode: string; + export type AlgoMd5 = { /** - * Country name. + * Algo type. */ - countryName: string; + type: string; } /** - * Health Antivirus + * AlgoSHA */ - export type HealthAntivirus = { - /** - * Antivirus version. - */ - version: string; + export type AlgoSha = { /** - * Antivirus status. Possible values are: `disabled`, `offline`, `online` + * Algo type. */ - status: HealthAntivirusStatus; + type: string; } /** - * Health Queue + * AlgoPHPass */ - export type HealthQueue = { + export type AlgoPhpass = { /** - * Amount of actions in the queue. + * Algo type. */ - size: number; + type: string; } /** - * Health Status + * AlgoBcrypt */ - export type HealthStatus = { - /** - * Name of the service. - */ - name: string; - /** - * Duration in milliseconds how long the health check took. - */ - ping: number; + export type AlgoBcrypt = { /** - * Service status. Possible values are: `pass`, `fail` + * Algo type. */ - status: HealthCheckStatus; + type: string; } /** - * Health Certificate + * AlgoScrypt */ - export type HealthCertificate = { - /** - * Certificate name - */ - name: string; + export type AlgoScrypt = { /** - * Subject SN + * Algo type. */ - subjectSN: string; + type: string; /** - * Issuer organisation + * CPU complexity of computed hash. */ - issuerOrganisation: string; + costCpu: number; /** - * Valid from + * Memory complexity of computed hash. */ - validFrom: string; + costMemory: number; /** - * Valid to + * Parallelization of computed hash. */ - validTo: string; + costParallel: number; /** - * Signature type SN + * Length used to compute hash. */ - signatureTypeSN: string; + length: number; } /** - * Health Time + * AlgoScryptModified */ - export type HealthTime = { - /** - * Current unix timestamp on trustful remote server. - */ - remoteTime: number; + export type AlgoScryptModified = { /** - * Current unix timestamp of local server where Appwrite runs. + * Algo type. */ - localTime: number; + type: string; /** - * Difference of unix remote and local timestamps in milliseconds. + * Salt used to compute hash. */ - diff: number; - } - - /** - * Headers - */ - export type Headers = { + salt: string; /** - * Header name. + * Separator used to compute hash. */ - name: string; + saltSeparator: string; /** - * Header value. + * Key used to compute hash. */ - value: string; + signerKey: string; } /** - * Specification + * AlgoArgon2 */ - export type Specification = { + export type AlgoArgon2 = { /** - * Memory size in MB. + * Algo type. */ - memory: number; + type: string; /** - * Number of CPUs. + * Memory used to compute hash. */ - cpus: number; + memoryCost: number; /** - * Is size enabled. + * Amount of time consumed to compute hash */ - enabled: boolean; + timeCost: number; /** - * Size slug. + * Number of threads used to compute hash. */ - slug: string; + threads: number; + } + + /** + * Preferences + */ + export type Preferences = { } + export type DefaultPreferences = Preferences & { + [key: string]: any; + [__default]: true; + }; + /** - * Rule + * Session */ - export type ProxyRule = { + export type Session = { /** - * Rule ID. + * Session ID. */ $id: string; /** - * Rule creation date in ISO 8601 format. + * Session creation date in ISO 8601 format. */ $createdAt: string; /** - * Rule update date in ISO 8601 format. + * Session update date in ISO 8601 format. */ $updatedAt: string; /** - * Domain name. - */ - domain: string; - /** - * Action definition for the rule. Possible values are "api", "deployment", or "redirect" + * User ID. */ - type: string; + userId: string; /** - * Defines how the rule was created. Possible values are "manual" or "deployment" + * Session expiration date in ISO 8601 format. */ - trigger: string; + expire: string; /** - * URL to redirect to. Used if type is "redirect" + * Session Provider. */ - redirectUrl: string; + provider: string; /** - * Status code to apply during redirect. Used if type is "redirect" + * Session Provider User ID. */ - redirectStatusCode: number; + providerUid: string; /** - * ID of deployment. Used if type is "deployment" + * Session Provider Access Token. */ - deploymentId: string; + providerAccessToken: string; /** - * Type of deployment. Possible values are "function", "site". Used if rule's type is "deployment". + * The date of when the access token expires in ISO 8601 format. */ - deploymentResourceType?: ProxyRuleDeploymentResourceType; + providerAccessTokenExpiry: string; /** - * ID of deployment's resource (site or function ID). Used if type is "deployment" + * Session Provider Refresh Token. */ - deploymentResourceId: string; + providerRefreshToken: string; /** - * Name of Git branch that updates rule. Used if type is "deployment" + * IP in use when the session was created. */ - deploymentVcsProviderBranch: string; + ip: string; /** - * Domain verification status. Possible values are "unverified", "verifying", "verified" + * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). */ - status: ProxyRuleStatus; + osCode: string; /** - * Logs from rule verification or certificate generation. Certificate generation logs are prioritized if both are available. + * Operating system name. */ - logs: string; + osName: string; /** - * Certificate auto-renewal date in ISO 8601 format. + * Operating system version. */ - renewAt: string; - } - - /** - * EmailTemplate - */ - export type EmailTemplate = { + osVersion: string; /** - * Template type + * Client type. */ - templateId: string; + clientType: string; /** - * Template locale + * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). */ - locale: string; + clientCode: string; /** - * Template message + * Client name. */ - message: string; + clientName: string; /** - * Name of the sender + * Client version. */ - senderName: string; + clientVersion: string; /** - * Email of the sender + * Client engine name. */ - senderEmail: string; + clientEngine: string; /** - * Reply to email address + * Client engine name. */ - replyToEmail: string; + clientEngineVersion: string; /** - * Reply to name + * Device name. */ - replyToName: string; + deviceName: string; /** - * Email subject + * Device brand name. */ - subject: string; - } - - /** - * MFA Challenge - */ - export type MfaChallenge = { + deviceBrand: string; /** - * Token ID. + * Device model name. */ - $id: string; + deviceModel: string; /** - * Token creation date in ISO 8601 format. + * Country two-character ISO 3166-1 alpha code. */ - $createdAt: string; + countryCode: string; /** - * User ID. + * Country name. */ - userId: string; + countryName: string; /** - * Token expiration date in ISO 8601 format. + * Returns true if this the current user session. */ - expire: string; - } - - /** - * MFA Recovery Codes - */ - export type MfaRecoveryCodes = { + current: boolean; /** - * Recovery codes. + * Returns a list of active session factors. */ - recoveryCodes: string[]; - } - - /** - * MFAType - */ - export type MfaType = { + factors: string[]; /** - * Secret token used for TOTP factor. + * Secret used to authenticate the user. Only included if the request was made with an API key */ 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. + * Most recent date in ISO 8601 format when the session successfully passed MFA challenge. */ - recoveryCode: boolean; + mfaUpdatedAt: string; } /** - * Provider + * Identity */ - export type Provider = { + export type Identity = { /** - * Provider ID. + * Identity ID. */ $id: string; /** - * Provider creation time in ISO 8601 format. + * Identity creation date in ISO 8601 format. */ $createdAt: string; /** - * Provider update date in ISO 8601 format. + * Identity update date in ISO 8601 format. */ $updatedAt: string; /** - * The name for the provider instance. + * User ID. */ - name: string; + userId: string; /** - * The name of the provider service. + * Identity Provider. */ provider: string; /** - * Is provider enabled? + * ID of the User in the Identity Provider. */ - enabled: boolean; + providerUid: string; /** - * Type of provider. + * Email of the User in the Identity Provider. */ - type: string; + providerEmail: string; + /** + * Identity Provider Access Token. + */ + providerAccessToken: string; /** - * Provider credentials. + * The date of when the access token expires in ISO 8601 format. */ - credentials: object; + providerAccessTokenExpiry: string; /** - * Provider options. + * Identity Provider Refresh Token. */ - options?: object; + providerRefreshToken: string; } /** - * Message + * Token */ - export type Message = { + export type Token = { /** - * Message ID. + * Token ID. */ $id: string; /** - * Message creation time in ISO 8601 format. + * Token creation date 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. + * User ID. */ - deliveredAt?: string; + userId: string; /** - * Delivery errors if any. + * 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. */ - deliveryErrors?: string[]; + secret: string; /** - * Number of recipients the message was delivered to. + * Token expiration date in ISO 8601 format. */ - deliveredTotal: number; + expire: string; /** - * Data of the message. + * 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. */ - data: object; + phrase: string; + } + + /** + * JWT + */ + export type Jwt = { /** - * Status of delivery. + * JWT encoded string. */ - status: MessageStatus; + jwt: string; } /** - * Topic + * Locale */ - export type Topic = { + export type Locale = { + /** + * User IP address. + */ + ip: string; /** - * Topic ID. + * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format */ - $id: string; + countryCode: string; /** - * Topic creation time in ISO 8601 format. + * Country name. This field support localization. */ - $createdAt: string; + country: string; /** - * Topic update date in ISO 8601 format. + * 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. */ - $updatedAt: string; + continentCode: string; /** - * The name of the topic. + * Continent name. This field support localization. */ - name: string; + continent: string; /** - * Total count of email subscribers subscribed to the topic. + * True if country is part of the European Union. */ - emailTotal: number; + eu: boolean; /** - * Total count of SMS subscribers subscribed to the topic. + * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format */ - smsTotal: number; + currency: string; + } + + /** + * LocaleCode + */ + export type LocaleCode = { /** - * Total count of push subscribers subscribed to the topic. + * Locale codes in [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) */ - pushTotal: number; + code: string; /** - * Subscribe permissions. + * Locale name */ - subscribe: string[]; + name: string; } /** - * Transaction + * File */ - export type Transaction = { + export type File = { /** - * Transaction ID. + * File ID. */ $id: string; /** - * Transaction creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Transaction update date in ISO 8601 format. + * Bucket ID. */ - $updatedAt: string; + bucketId: string; /** - * Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. + * File creation date in ISO 8601 format. */ - status: string; + $createdAt: string; /** - * Number of operations in the transaction. + * File update date in ISO 8601 format. */ - operations: number; + $updatedAt: string; /** - * Expiration time in ISO 8601 format. + * File permissions. [Learn more about permissions](https://appwrite.io/docs/permissions). */ - expiresAt: string; - } - - /** - * Subscriber - */ - export type Subscriber = { + $permissions: string[]; /** - * Subscriber ID. + * File name. */ - $id: string; + name: string; /** - * Subscriber creation time in ISO 8601 format. + * File MD5 signature. */ - $createdAt: string; + signature: string; /** - * Subscriber update date in ISO 8601 format. + * File mime type. */ - $updatedAt: string; + mimeType: string; /** - * Target ID. + * File original size in bytes. */ - targetId: string; + sizeOriginal: number; /** - * Target. + * File actual stored size in bytes after compression and/or encryption. */ - target: Target; + sizeActual: number; /** - * Topic ID. + * Total number of chunks available */ - userId: string; + chunksTotal: number; /** - * User Name. + * Total number of chunks uploaded */ - userName: string; + chunksUploaded: number; /** - * Topic ID. + * Whether file contents are encrypted at rest. */ - topicId: string; + encryption: boolean; /** - * The target provider type. Can be one of the following: `email`, `sms` or `push`. + * 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). */ - providerType: string; + compression: string; } /** - * Target + * Team */ - export type Target = { + export type Team<Preferences extends Models.Preferences = Models.DefaultPreferences> = { /** - * Target ID. + * Team ID. */ $id: string; /** - * Target creation time in ISO 8601 format. + * Team creation date in ISO 8601 format. */ $createdAt: string; /** - * Target update date in ISO 8601 format. + * Team update date in ISO 8601 format. */ $updatedAt: string; /** - * Target Name. + * Team 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. + * Total number of team members. */ - identifier: string; + total: number; /** - * Is the target expired. + * Team preferences as a key-value object */ - expired: boolean; + prefs: Preferences; } /** - * Insight + * Membership */ - export type Insight = { + export type Membership = { /** - * Insight ID. + * Membership ID. */ $id: string; /** - * Insight creation date in ISO 8601 format. + * Membership creation date in ISO 8601 format. */ $createdAt: string; /** - * Insight update date in ISO 8601 format. + * Membership 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. + * User ID. */ - parentResourceType: string; + userId: string; /** - * ID of the parent resource. Empty when the resource has no parent. + * User name. Hide this attribute by toggling membership privacy in the Console. */ - parentResourceId: string; + userName: string; /** - * Insight title. + * User email address. Hide this attribute by toggling membership privacy in the Console. */ - title: string; + userEmail: string; /** - * Short markdown summary describing the insight. + * User phone number. Hide this attribute by toggling membership privacy in the Console. */ - summary: string; + userPhone: string; /** - * List of call-to-action buttons attached to this insight. + * Team ID. */ - ctas: InsightCTA[]; + teamId: string; /** - * Time the insight was analyzed in ISO 8601 format. + * Team name. */ - analyzedAt?: string; + teamName: string; /** - * Time the insight was dismissed in ISO 8601 format. Empty when not dismissed. + * Date, the user has been invited to join the team in ISO 8601 format. */ - dismissedAt?: string; + invited: string; /** - * User ID that dismissed the insight. Empty when not dismissed. + * Date, the user has accepted the invitation to join the team in ISO 8601 format. */ - dismissedBy?: string; - } - - /** - * InsightCTA - */ - export type InsightCTA = { + joined: string; /** - * Human-readable label for the CTA, used in UI. + * User confirmation status, true if the user has joined the team or false otherwise. */ - label: string; + confirm: boolean; /** - * 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. + * Multi factor authentication status, true if the user has MFA enabled or false otherwise. Hide this attribute by toggling membership privacy in the Console. */ - service: string; + mfa: boolean; /** - * Public API method on the chosen service the client should invoke when this CTA is triggered. + * Most recent access date in ISO 8601 format. Show this attribute by toggling membership privacy in the Console. */ - method: string; + userAccessedAt: 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). + * User list of roles */ - params: object; + roles: string[]; } /** - * Report + * Execution */ - export type Report = { + export type Execution = { /** - * Report ID. + * Execution ID. */ $id: string; /** - * Report creation date in ISO 8601 format. + * Execution creation date in ISO 8601 format. */ $createdAt: string; /** - * Report update date in ISO 8601 format. + * Execution 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. + * Execution roles. */ - title: string; + $permissions: string[]; /** - * Markdown summary describing the report. + * Function ID. */ - summary: string; + functionId: string; /** - * Plural noun describing what the report analyzes, e.g. databases, sites, urls. + * Function's deployment ID used to create the execution. */ - targetType: string; + deploymentId: string; /** - * Free-form target identifier (URL for lighthouse, resource ID for db). + * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. */ - target: string; + trigger: ExecutionTrigger; /** - * Categories covered by the report, e.g. performance, accessibility. + * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, `failed`, or `scheduled`. */ - categories: string[]; + status: ExecutionStatus; /** - * Insights nested under this report. + * HTTP request method type. */ - insights: Insight[]; + requestMethod: string; /** - * Time the report was analyzed in ISO 8601 format. + * HTTP request path and query. */ - analyzedAt?: string; - } - - /** - * ActivityEvent - */ - export type ActivityEvent = { + requestPath: string; /** - * Event ID. + * HTTP request headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. */ - $id: string; + requestHeaders: Headers[]; /** - * User type. + * HTTP response status code. */ - userType: string; + responseStatusCode: number; /** - * User ID. + * HTTP response body. This will return empty unless execution is created as synchronous. */ - userId: string; + responseBody: string; /** - * User Email. + * HTTP response headers as a key-value object. This will return only whitelisted headers. All headers are returned if execution is created as synchronous. */ - userEmail: string; + responseHeaders: Headers[]; /** - * User Name. + * 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. */ - userName: string; + logs: string; /** - * Resource parent. + * 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. */ - resourceParent: string; + errors: string; /** - * Resource type. + * Resource(function/site) execution duration in seconds. */ - resourceType: string; + duration: number; /** - * Resource ID. + * The scheduled time for execution. If left empty, execution will be queued immediately. */ - resourceId: string; + scheduledAt?: string; + } + + /** + * Country + */ + export type Country = { /** - * Resource. + * Country name. */ - resource: string; + name: string; /** - * Event name. + * Country two-character ISO 3166-1 alpha code. */ - event: string; + code: string; + } + + /** + * Continent + */ + export type Continent = { /** - * User agent. + * Continent name. */ - userAgent: string; + name: string; /** - * IP address. + * Continent two letter code. */ - ip: string; + code: string; + } + + /** + * Language + */ + export type Language = { /** - * API mode when event triggered. + * Language name. */ - mode: string; + name: string; /** - * Location. + * Language two-character ISO 639-1 codes. */ - country: string; + code: string; /** - * Log creation date in ISO 8601 format. + * Language native name. */ - time: string; + nativeName: string; + } + + /** + * Currency + */ + export type Currency = { /** - * Project ID. + * Currency symbol. */ - projectId: string; + symbol: string; /** - * Team ID. + * Currency name. */ - teamId: string; + name: string; /** - * Hostname. + * Currency native symbol. */ - hostname: string; + symbolNative: string; /** - * Operating system code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/os.json). + * Number of decimal digits. */ - osCode: string; + decimalDigits: number; /** - * Operating system name. + * Currency digit rounding. */ - osName: string; + rounding: number; /** - * Operating system version. + * Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format. */ - osVersion: string; + code: string; /** - * Client type. + * Currency plural name */ - clientType: string; + namePlural: string; + } + + /** + * Phone + */ + export type Phone = { /** - * Client code name. View list of [available options](https://github.com/appwrite/appwrite/blob/master/docs/lists/clients.json). + * Phone code. */ - clientCode: string; + code: string; /** - * Client name. + * Country two-character ISO 3166-1 alpha code. */ - clientName: string; + countryCode: string; /** - * Client version. + * Country name. */ - clientVersion: string; + countryName: string; + } + + /** + * Headers + */ + export type Headers = { /** - * Client engine name. + * Header name. */ - clientEngine: string; + name: string; /** - * Client engine name. + * Header value. */ - clientEngineVersion: string; + value: string; + } + + /** + * MFA Challenge + */ + export type MfaChallenge = { /** - * Device name. + * Token ID. */ - deviceName: string; + $id: string; /** - * Device brand name. + * Token creation date in ISO 8601 format. */ - deviceBrand: string; + $createdAt: string; /** - * Device model name. + * User ID. */ - deviceModel: string; + userId: string; /** - * Country two-character ISO 3166-1 alpha code. + * Token expiration date in ISO 8601 format. */ - countryCode: string; + expire: string; + } + + /** + * MFA Recovery Codes + */ + export type MfaRecoveryCodes = { /** - * Country name. + * Recovery codes. */ - countryName: string; + recoveryCodes: string[]; } /** - * Archive + * MFAType */ - export type BackupArchive = { + export type MfaType = { /** - * Archive ID. + * Secret token used for TOTP factor. */ - $id: string; + secret: string; /** - * Archive creation time in ISO 8601 format. + * URI for authenticator apps. */ - $createdAt: string; + uri: string; + } + + /** + * MFAFactors + */ + export type MfaFactors = { /** - * Archive update date in ISO 8601 format. + * Can TOTP be used for MFA challenge for this account. */ - $updatedAt: string; + totp: boolean; /** - * Archive policy ID. + * Can phone (SMS) be used for MFA challenge for this account. */ - policyId: string; + phone: boolean; /** - * Archive size in bytes. + * Can email be used for MFA challenge for this account. */ - size: number; + email: boolean; /** - * The status of the archive creation. Possible values: pending, processing, uploading, completed, failed, skipped. + * Can recovery code be used for MFA challenge for this account. */ - status: string; + recoveryCode: boolean; + } + + /** + * Transaction + */ + export type Transaction = { /** - * The backup start time. + * Transaction ID. */ - startedAt: string; + $id: string; /** - * Migration ID. + * Transaction creation time in ISO 8601 format. */ - migrationId: string; + $createdAt: string; /** - * The services that are backed up by this archive. + * Transaction update date in ISO 8601 format. */ - services: string[]; + $updatedAt: string; /** - * The resources that are backed up by this archive. + * Current status of the transaction. One of: pending, committing, committed, rolled_back, failed. */ - resources: string[]; + status: string; /** - * The resource ID to backup. Set only if this archive should backup a single resource. + * Number of operations in the transaction. */ - resourceId?: string; + operations: number; /** - * The resource type to backup. Set only if this archive should backup a single resource. + * Expiration time in ISO 8601 format. */ - resourceType?: string; + expiresAt: string; } /** - * BillingLimits + * Subscriber */ - export type BillingLimits = { + export type Subscriber = { + /** + * Subscriber ID. + */ + $id: string; /** - * Bandwidth limit + * Subscriber creation time in ISO 8601 format. */ - bandwidth?: number; + $createdAt: string; /** - * Storage limit + * Subscriber update date in ISO 8601 format. */ - storage?: number; + $updatedAt: string; /** - * Users limit + * Target ID. */ - users?: number; + targetId: string; /** - * Executions limit + * Target. */ - executions?: number; + target: Target; /** - * GBHours limit + * Topic ID. */ - GBHours?: number; + userId: string; /** - * Image transformations limit + * User Name. */ - imageTransformations?: number; + userName: string; /** - * Auth phone limit + * Topic ID. */ - authPhone?: number; + topicId: string; /** - * Budget limit percentage + * The target provider type. Can be one of the following: `email`, `sms` or `push`. */ - budgetLimit?: number; + providerType: string; } /** - * Block + * Target */ - export type Block = { - /** - * Block creation date in ISO 8601 format. - */ - $createdAt: string; + export type Target = { /** - * Resource type that is blocked + * Target ID. */ - resourceType: string; + $id: string; /** - * Resource identifier that is blocked + * Target creation time in ISO 8601 format. */ - resourceId: string; + $createdAt: string; /** - * Reason for the block. Can be null if no reason was provided. + * Target update date in ISO 8601 format. */ - reason?: string; + $updatedAt: string; /** - * Block expiration date in ISO 8601 format. Can be null if the block does not expire. + * Target Name. */ - expiredAt?: string; + name: string; /** - * Name of the project this block applies to. + * User ID. */ - projectName: string; + userId: string; /** - * Region of the project this block applies to. + * Provider ID. */ - region: string; + providerId?: string; /** - * Name of the organization that owns the project. + * The target provider type. Can be one of the following: `email`, `sms` or `push`. */ - organizationName: string; + providerType: string; /** - * ID of the organization that owns the project. + * The target identifier. */ - organizationId: string; + identifier: string; /** - * Billing plan of the organization that owns the project. + * Is the target expired. */ - billingPlan: string; + expired: boolean; } /** - * backup + * App */ - export type BackupPolicy = { + export type App = { /** - * Backup policy ID. + * App ID. */ $id: string; /** - * Backup policy name. - */ - name: string; - /** - * Policy creation date in ISO 8601 format. + * App creation time in ISO 8601 format. */ $createdAt: string; /** - * Policy update date in ISO 8601 format. + * App update date in ISO 8601 format. */ $updatedAt: string; /** - * The services that are backed up by this policy. + * Application name. */ - services: string[]; + name: string; + /** + * List of authorized redirect URIs. These URIs can be used to redirect users after they authenticate. + */ + redirectUris: string[]; /** - * The resources that are backed up by this policy. + * Whether the app is enabled or not. */ - resources: string[]; + enabled: boolean; /** - * The resource ID to backup. Set only if this policy should backup a single resource. + * OAuth2 client type. `public` for SPAs, mobile, and native apps that cannot keep a client secret (PKCE required); `confidential` for server-side clients that authenticate with a client secret. */ - resourceId?: string; + type: string; /** - * The resource type to backup. Set only if this policy should backup a single resource. + * Whether this client may use the OAuth2 Device Authorization Grant (RFC 8628). */ - resourceType?: string; + deviceFlow: boolean; /** - * How many days to keep the backup before it will be automatically deleted. + * ID of team that owns the application, if owned by team. Otherwise, user ID will be used. */ - retention: number; + teamId: string; /** - * Policy backup schedule in CRON format. + * ID of user who owns the application, if owned by user. Otherwise, team ID will be used. */ - schedule: string; + userId: string; /** - * Is this policy enabled. + * List of application secrets. */ - enabled: boolean; + secrets: AppSecret[]; } /** - * Restoration + * AppSecret */ - export type BackupRestoration = { + export type AppSecret = { /** - * Restoration ID. + * Secret ID. */ $id: string; /** - * Restoration creation time in ISO 8601 format. + * Secret creation time in ISO 8601 format. */ $createdAt: string; /** - * Restoration update date in ISO 8601 format. + * Secret update time in ISO 8601 format. */ $updatedAt: string; /** - * Backup archive ID. + * Application ID this secret belongs to. */ - archiveId: string; - /** - * Backup policy ID. - */ - policyId: string; - /** - * The status of the restoration. Possible values: pending, downloading, processing, completed, failed. - */ - status: string; + appId: string; /** - * The backup start time. + * Hashed application client secret. */ - startedAt: string; + secret: string; /** - * Migration ID. + * Last few characters of the client secret, used to help identify it. */ - migrationId: string; + hint: string; /** - * The services that are backed up by this policy. + * ID of the user who created the secret. */ - services: string[]; + createdById: string; /** - * The resources that are backed up by this policy. + * Name of the user who created the secret. */ - resources: string[]; + createdByName: string; /** - * Optional data in key-value object. + * Time the secret was last used for authentication in ISO 8601 format. Null if never used. */ - options: string; + lastAccessedAt?: string; } /** - * usageEvent + * AppSecretPlaintext */ - export type UsageEvent = { - /** - * The metric key. - */ - metric: string; + export type AppSecretPlaintext = { /** - * The metric value. + * Secret ID. */ - value: number; + $id: string; /** - * The event timestamp. + * Secret creation time in ISO 8601 format. */ - time: string; + $createdAt: string; /** - * The API endpoint path. + * Secret update time in ISO 8601 format. */ - path: string; + $updatedAt: string; /** - * The HTTP method. + * Application ID this secret belongs to. */ - method: string; + appId: string; /** - * HTTP status code. Stored as string to preserve unset state (empty string = not available). + * Application client secret. Returned in full only when the secret is created; subsequent reads return a masked value. */ - status: string; + secret: string; /** - * The resource type. + * Last few characters of the client secret, used to help identify it. */ - resourceType: string; + hint: string; /** - * The resource ID. + * ID of the user who created the secret. */ - resourceId: string; + createdById: string; /** - * Country code in [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) two-character format. + * Name of the user who created the secret. */ - countryCode: string; + createdByName: string; /** - * The user agent string. + * Time the secret was last used for authentication in ISO 8601 format. Null if never used. */ - userAgent: string; + lastAccessedAt?: string; } /** - * Usage events list + * OAuth2 Authorize */ - export type UsageEventList = { + export type Oauth2Authorize = { /** - * Total number of events that matched your query. + * OAuth2 grant ID. Set when the user must give explicit consent; pass it to the approve or reject endpoint. Empty when a redirect URL is returned instead. */ - total: number; + grantId: string; /** - * List of events. + * URL the end user should be redirected to when the flow can complete without consent. Empty when consent is still required. */ - events: UsageEvent[]; + redirectUrl: string; } /** - * usageGauge + * OAuth2 Approve */ - export type UsageGauge = { - /** - * The metric key. - */ - metric: string; - /** - * The current snapshot value. - */ - value: number; + export type Oauth2Approve = { /** - * The snapshot timestamp. + * URL the end user should be redirected to after the grant is approved, carrying the authorization `code` and/or `id_token` along with the original `state`. */ - time: string; + redirectUrl: string; } /** - * Usage gauges list + * OAuth2 Reject */ - export type UsageGaugeList = { - /** - * Total number of gauges that matched your query. - */ - total: number; + export type Oauth2Reject = { /** - * List of gauges. + * URL the end user should be redirected to after the grant is rejected, carrying an `access_denied` error. */ - gauges: UsageGauge[]; + redirectUrl: string; } /** - * Activity event list + * OAuth2 Grant */ - export type ActivityEventList = { + export type Oauth2Grant = { /** - * Total number of events that matched your query. + * Grant ID. */ - total: number; + $id: string; /** - * List of events. + * Grant creation time in ISO 8601 format. */ - events: ActivityEvent[]; - } - - /** - * Backup archive list - */ - export type BackupArchiveList = { + $createdAt: string; /** - * Total number of archives that matched your query. + * Grant update date in ISO 8601 format. */ - total: number; + $updatedAt: string; + /** + * ID of the user the grant belongs to. + */ + userId: string; + /** + * ID of the OAuth2 client (app) the grant was requested for. + */ + appId: string; + /** + * Requested OAuth2 scopes the user is being asked to consent to. + */ + scopes: string[]; + /** + * Requested authorization_details the user is being asked to consent to, as a JSON string. Each entry has a `type` plus project-defined fields. + */ + authorizationDetails: string; + /** + * OIDC prompt directive the consent screen should honor. Space-separated list of: login, consent, select_account. + */ + prompt: string; + /** + * Redirect URI the user will be sent to after the flow completes. + */ + redirectUri: string; + /** + * Unix timestamp of when the user last authenticated. + */ + authTime: number; /** - * List of archives. + * Grant expiration time in ISO 8601 format. */ - archives: BackupArchive[]; + expire: string; } /** - * Backup policy list + * Apps list */ - export type BackupPolicyList = { + export type AppsList = { /** - * Total number of policies that matched your query. + * Total number of apps that matched your query. */ total: number; /** - * List of policies. + * List of apps. */ - policies: BackupPolicy[]; + apps: App[]; } /** - * Backup restoration list + * App secrets list */ - export type BackupRestorationList = { + export type AppSecretList = { /** - * Total number of restorations that matched your query. + * Total number of secrets that matched your query. */ total: number; /** - * List of restorations. + * List of secrets. */ - restorations: BackupRestoration[]; + secrets: AppSecret[]; } } diff --git a/src/services/account.ts b/src/services/account.ts index e8985c25..896931c7 100644 --- a/src/services/account.ts +++ b/src/services/account.ts @@ -1,25 +1,15 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +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'; -type AccountServerOnlyMethod = never; -type AccountClientOnlyMethod = never; +export class Account { + client: Client; -export type Account<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<AccountRuntime<TAuth>, 'client' | AccountServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<AccountRuntime<TAuth>, 'client' | AccountClientOnlyMethod> - : Omit<AccountRuntime<TAuth>, 'client'>; - -class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -36,6 +26,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -118,7 +110,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -188,7 +182,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -248,6 +244,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -299,6 +297,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -351,7 +350,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -411,6 +412,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -465,7 +468,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -518,7 +523,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -570,7 +577,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -634,7 +643,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -697,7 +708,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -750,6 +763,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -802,6 +816,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -858,7 +873,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -913,7 +930,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -980,7 +999,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1046,7 +1067,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1071,6 +1094,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1094,6 +1119,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1118,6 +1145,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1141,6 +1170,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1165,7 +1196,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1189,7 +1222,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1214,7 +1249,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1238,7 +1275,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1293,7 +1332,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1308,7 +1349,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server * 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. + * @param {string} params.oldPassword - Current user password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise<Models.User<Preferences>>} */ @@ -1317,7 +1358,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server * 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. + * @param {string} oldPassword - Current user password. Max length: 256 chars. * @throws {AppwriteException} * @returns {Promise<Models.User<Preferences>>} * @deprecated Use the object parameter style method for a better developer experience. @@ -1356,7 +1397,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1422,7 +1465,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1446,6 +1491,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1500,7 +1547,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1566,7 +1615,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1646,7 +1697,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1670,6 +1723,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1693,6 +1748,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -1717,7 +1773,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1787,7 +1845,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1854,7 +1914,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -1938,12 +2000,16 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'text/html', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + if (typeof window !== 'undefined' && window?.location) { window.location.href = uri.toString(); return; @@ -2008,7 +2074,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2074,7 +2142,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2126,6 +2196,8 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -2177,7 +2249,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2229,6 +2303,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2253,7 +2328,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2326,7 +2403,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2389,7 +2468,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2441,6 +2522,7 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -2520,7 +2602,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2606,7 +2690,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2688,12 +2774,16 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'text/html', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + if (typeof window !== 'undefined' && window?.location) { window.location.href = uri.toString(); return; @@ -2761,7 +2851,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2822,7 +2914,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2884,7 +2978,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -2950,7 +3046,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3017,7 +3115,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3041,7 +3141,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3107,7 +3209,9 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -3118,9 +3222,3 @@ class AccountRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } } - -const Account = AccountRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Account<TAuth>; -}; - -export { Account }; diff --git a/src/services/activities.ts b/src/services/activities.ts deleted file mode 100644 index fa15e6dc..00000000 --- a/src/services/activities.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Activities = Omit<ActivitiesRuntime, 'client'>; - -class ActivitiesRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Activities = ActivitiesRuntime as unknown as { - new (client: Client<ServerAuth>): Activities; -}; - -export { Activities }; diff --git a/src/services/advisor.ts b/src/services/advisor.ts deleted file mode 100644 index ffba49d1..00000000 --- a/src/services/advisor.ts +++ /dev/null @@ -1,316 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Advisor = Omit<AdvisorRuntime, 'client'>; - -class AdvisorRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Advisor = AdvisorRuntime as unknown as { - new (client: Client<ServerAuth>): Advisor; -}; - -export { Advisor }; diff --git a/src/services/apps.ts b/src/services/apps.ts new file mode 100644 index 00000000..657e78ef --- /dev/null +++ b/src/services/apps.ts @@ -0,0 +1,743 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Apps { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * List applications. + * + * @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 {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.AppsList>} + */ + list(params?: { queries?: string[], total?: boolean }): Promise<Models.AppsList>; + /** + * List applications. + * + * @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 {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.AppsList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + list(queries?: string[], total?: boolean): Promise<Models.AppsList>; + list( + paramsOrFirst?: { queries?: string[], total?: boolean } | string[], + ...rest: [(boolean)?] + ): Promise<Models.AppsList> { + 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 = '/apps'; + 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 } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new application. + * + * @param {string} params.appId - Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid 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 - Application name. + * @param {string[]} params.redirectUris - Redirect URIs (array of valid URLs). + * @param {boolean} params.enabled - Is application enabled? + * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} params.deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @param {string} params.teamId - Team unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + */ + create(params: { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }): Promise<Models.App>; + /** + * Create a new application. + * + * @param {string} appId - Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid 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 - Application name. + * @param {string[]} redirectUris - Redirect URIs (array of valid URLs). + * @param {boolean} enabled - Is application enabled? + * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @param {string} teamId - Team unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + create(appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string): Promise<Models.App>; + create( + paramsOrFirst: { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string } | string, + ...rest: [(string)?, (string[])?, (boolean)?, (string)?, (boolean)?, (string)?] + ): Promise<Models.App> { + let params: { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; + } else { + params = { + appId: paramsOrFirst as string, + name: rest[0] as string, + redirectUris: rest[1] as string[], + enabled: rest[2] as boolean, + type: rest[3] as string, + deviceFlow: rest[4] as boolean, + teamId: rest[5] as string + }; + } + + const appId = params.appId; + const name = params.name; + const redirectUris = params.redirectUris; + const enabled = params.enabled; + const type = params.type; + const deviceFlow = params.deviceFlow; + const teamId = params.teamId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + if (typeof redirectUris === 'undefined') { + throw new AppwriteException('Missing required parameter: "redirectUris"'); + } + + const apiPath = '/apps'; + const payload: Payload = {}; + if (typeof appId !== 'undefined') { + payload['appId'] = appId; + } + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof redirectUris !== 'undefined') { + payload['redirectUris'] = redirectUris; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof deviceFlow !== 'undefined') { + payload['deviceFlow'] = deviceFlow; + } + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + */ + get(params: { appId: string }): Promise<Models.App>; + /** + * Get an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + get(appId: string): Promise<Models.App>; + get( + paramsOrFirst: { appId: string } | string + ): Promise<Models.App> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Update an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.name - Application name. + * @param {boolean} params.enabled - Is application enabled? + * @param {string[]} params.redirectUris - Redirect URIs (array of valid URLs). + * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} params.deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + */ + update(params: { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean }): Promise<Models.App>; + /** + * Update an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} name - Application name. + * @param {boolean} enabled - Is application enabled? + * @param {string[]} redirectUris - Redirect URIs (array of valid URLs). + * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. + * @param {boolean} deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + update(appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean): Promise<Models.App>; + update( + paramsOrFirst: { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean } | string, + ...rest: [(string)?, (boolean)?, (string[])?, (string)?, (boolean)?] + ): Promise<Models.App> { + let params: { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + name: rest[0] as string, + enabled: rest[1] as boolean, + redirectUris: rest[2] as string[], + type: rest[3] as string, + deviceFlow: rest[4] as boolean + }; + } + + const appId = params.appId; + const name = params.name; + const enabled = params.enabled; + const redirectUris = params.redirectUris; + const type = params.type; + const deviceFlow = params.deviceFlow; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof name === 'undefined') { + throw new AppwriteException('Missing required parameter: "name"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', appId); + const payload: Payload = {}; + if (typeof name !== 'undefined') { + payload['name'] = name; + } + if (typeof enabled !== 'undefined') { + payload['enabled'] = enabled; + } + if (typeof redirectUris !== 'undefined') { + payload['redirectUris'] = redirectUris; + } + if (typeof type !== 'undefined') { + payload['type'] = type; + } + if (typeof deviceFlow !== 'undefined') { + payload['deviceFlow'] = deviceFlow; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'put', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + delete(params: { appId: string }): Promise<{}>; + /** + * Delete an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + delete(appId: string): Promise<{}>; + delete( + paramsOrFirst: { appId: string } | string + ): Promise<{}> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * List client secrets for an application. + * + * @param {string} params.appId - Application 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. + * @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.AppSecretList>} + */ + listSecrets(params: { appId: string, queries?: string[], total?: boolean }): Promise<Models.AppSecretList>; + /** + * List client secrets for an application. + * + * @param {string} appId - Application 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. + * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. + * @throws {AppwriteException} + * @returns {Promise<Models.AppSecretList>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + listSecrets(appId: string, queries?: string[], total?: boolean): Promise<Models.AppSecretList>; + listSecrets( + paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, + ...rest: [(string[])?, (boolean)?] + ): Promise<Models.AppSecretList> { + let params: { appId: string, queries?: string[], total?: boolean }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; + } else { + params = { + appId: paramsOrFirst as string, + queries: rest[0] as string[], + total: rest[1] as boolean + }; + } + + const appId = params.appId; + const queries = params.queries; + const total = params.total; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/secrets'.replace('{appId}', appId); + 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 } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Create a new client secret for an application. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.AppSecretPlaintext>} + */ + createSecret(params: { appId: string }): Promise<Models.AppSecretPlaintext>; + /** + * Create a new client secret for an application. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.AppSecretPlaintext>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createSecret(appId: string): Promise<Models.AppSecretPlaintext>; + createSecret( + paramsOrFirst: { appId: string } | string + ): Promise<Models.AppSecretPlaintext> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/secrets'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an application client secret by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.AppSecret>} + */ + getSecret(params: { appId: string, secretId: string }): Promise<Models.AppSecret>; + /** + * Get an application client secret by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<Models.AppSecret>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getSecret(appId: string, secretId: string): Promise<Models.AppSecret>; + getSecret( + paramsOrFirst: { appId: string, secretId: string } | string, + ...rest: [(string)?] + ): Promise<Models.AppSecret> { + let params: { appId: string, secretId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + } else { + params = { + appId: paramsOrFirst as string, + secretId: rest[0] as string + }; + } + + const appId = params.appId; + const secretId = params.secretId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof secretId === 'undefined') { + throw new AppwriteException('Missing required parameter: "secretId"'); + } + + const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', appId).replace('{secretId}', secretId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Delete an application client secret by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteSecret(params: { appId: string, secretId: string }): Promise<{}>; + /** + * Delete an application client secret by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} secretId - Secret unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteSecret(appId: string, secretId: string): Promise<{}>; + deleteSecret( + paramsOrFirst: { appId: string, secretId: string } | string, + ...rest: [(string)?] + ): Promise<{}> { + let params: { appId: string, secretId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, secretId: string }; + } else { + params = { + appId: paramsOrFirst as string, + secretId: rest[0] as string + }; + } + + const appId = params.appId; + const secretId = params.secretId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof secretId === 'undefined') { + throw new AppwriteException('Missing required parameter: "secretId"'); + } + + const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', appId).replace('{secretId}', secretId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } + + /** + * Transfer an application to another team by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @param {string} params.teamId - Team ID of the team to transfer application to. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + */ + updateTeam(params: { appId: string, teamId: string }): Promise<Models.App>; + /** + * Transfer an application to another team by its unique ID. + * + * @param {string} appId - Application unique ID. + * @param {string} teamId - Team ID of the team to transfer application to. + * @throws {AppwriteException} + * @returns {Promise<Models.App>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + updateTeam(appId: string, teamId: string): Promise<Models.App>; + updateTeam( + paramsOrFirst: { appId: string, teamId: string } | string, + ...rest: [(string)?] + ): Promise<Models.App> { + let params: { appId: string, teamId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string, teamId: string }; + } else { + params = { + appId: paramsOrFirst as string, + teamId: rest[0] as string + }; + } + + const appId = params.appId; + const teamId = params.teamId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + if (typeof teamId === 'undefined') { + throw new AppwriteException('Missing required parameter: "teamId"'); + } + + const apiPath = '/apps/{appId}/team'.replace('{appId}', appId); + const payload: Payload = {}; + if (typeof teamId !== 'undefined') { + payload['teamId'] = teamId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'patch', + uri, + apiHeaders, + payload + ); + } + + /** + * Revoke all tokens for an application by its unique ID. + * + * @param {string} params.appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + */ + deleteTokens(params: { appId: string }): Promise<{}>; + /** + * Revoke all tokens for an application by its unique ID. + * + * @param {string} appId - Application unique ID. + * @throws {AppwriteException} + * @returns {Promise<{}>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + deleteTokens(appId: string): Promise<{}>; + deleteTokens( + paramsOrFirst: { appId: string } | string + ): Promise<{}> { + let params: { appId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { appId: string }; + } else { + params = { + appId: paramsOrFirst as string + }; + } + + const appId = params.appId; + + if (typeof appId === 'undefined') { + throw new AppwriteException('Missing required parameter: "appId"'); + } + + const apiPath = '/apps/{appId}/tokens'.replace('{appId}', appId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'delete', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/avatars.ts b/src/services/avatars.ts index cda9dfa6..90893900 100644 --- a/src/services/avatars.ts +++ b/src/services/avatars.ts @@ -1,29 +1,19 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +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 { BrowserTheme } from '../enums/browser-theme'; import { Timezone } from '../enums/timezone'; import { BrowserPermission } from '../enums/browser-permission'; import { ImageFormat } from '../enums/image-format'; -type AvatarsServerOnlyMethod = never; -type AvatarsClientOnlyMethod = never; +export class Avatars { + client: Client; -export type Avatars<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<AvatarsRuntime<TAuth>, 'client' | AvatarsClientOnlyMethod> - : Omit<AvatarsRuntime<TAuth>, 'client'>; - -class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -94,12 +84,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -172,12 +166,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -229,12 +227,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -307,12 +309,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -383,12 +389,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -465,12 +475,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -542,12 +556,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -563,7 +581,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server * @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. @@ -581,7 +599,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server * @throws {AppwriteException} * @returns {string} */ - 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 }): string; + 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 }): string; /** * 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. * @@ -594,7 +612,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server * @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. @@ -613,15 +631,15 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server * @returns {string} * @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): string; + 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): string; 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)?] ): string { - 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, @@ -629,7 +647,7 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server 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, @@ -737,18 +755,16 @@ class AvatarsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/png', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } } - -const Avatars = AvatarsRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Avatars<TAuth>; -}; - -export { Avatars }; diff --git a/src/services/backups.ts b/src/services/backups.ts deleted file mode 100644 index 29005f77..00000000 --- a/src/services/backups.ts +++ /dev/null @@ -1,761 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { BackupServices } from '../enums/backup-services'; - -export type Backups = Omit<BackupsRuntime, 'client'>; - -class BackupsRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Backups = BackupsRuntime as unknown as { - new (client: Client<ServerAuth>): Backups; -}; - -export { Backups }; diff --git a/src/services/databases.ts b/src/services/databases.ts index 334f3204..7421d142 100644 --- a/src/services/databases.ts +++ b/src/services/databases.ts @@ -1,171 +1,15 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +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'; -type DatabasesServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listCollections' | 'createCollection' | 'getCollection' | 'updateCollection' | 'deleteCollection' | 'listAttributes' | 'createBigIntAttribute' | 'updateBigIntAttribute' | 'createBooleanAttribute' | 'updateBooleanAttribute' | 'createDatetimeAttribute' | 'updateDatetimeAttribute' | 'createEmailAttribute' | 'updateEmailAttribute' | 'createEnumAttribute' | 'updateEnumAttribute' | 'createFloatAttribute' | 'updateFloatAttribute' | 'createIntegerAttribute' | 'updateIntegerAttribute' | 'createIpAttribute' | 'updateIpAttribute' | 'createLineAttribute' | 'updateLineAttribute' | 'createLongtextAttribute' | 'updateLongtextAttribute' | 'createMediumtextAttribute' | 'updateMediumtextAttribute' | 'createPointAttribute' | 'updatePointAttribute' | 'createPolygonAttribute' | 'updatePolygonAttribute' | 'createRelationshipAttribute' | 'updateRelationshipAttribute' | 'createStringAttribute' | 'updateStringAttribute' | 'createTextAttribute' | 'updateTextAttribute' | 'createUrlAttribute' | 'updateUrlAttribute' | 'createVarcharAttribute' | 'updateVarcharAttribute' | 'getAttribute' | 'deleteAttribute' | 'upsertDocuments' | 'updateDocuments' | 'deleteDocuments' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex'; -type DatabasesClientOnlyMethod = never; +export class Databases { + client: Client; -export type Databases<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<DatabasesRuntime<TAuth>, 'client' | DatabasesClientOnlyMethod> - : Omit<DatabasesRuntime<TAuth>, 'client'>; - -class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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. * @@ -207,6 +51,8 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -258,7 +104,9 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -310,6 +158,8 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -376,7 +226,9 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -428,6 +280,7 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -488,7 +341,9 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -500,242 +355,85 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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. + * 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.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 {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.CollectionList>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listTables` instead. + * @returns {Promise<Models.DocumentList<Document>>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.listRows` instead. */ - listCollections(this: Databases<ServerAuth>, params: { databaseId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.CollectionList>; + 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 collections that belong to the provided databaseId. You can use the search parameter to filter your results. + * 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[]} 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 {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.CollectionList>} + * @returns {Promise<Models.DocumentList<Document>>} * @deprecated Use the object parameter style method for a better developer experience. */ - listCollections(this: Databases<ServerAuth>, 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 }; + 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, queries?: string[], search?: string, total?: boolean }; + params = (paramsOrFirst || {}) as { databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number }; } else { params = { databaseId: paramsOrFirst as string, - queries: rest[0] as string[], - search: rest[1] as string, - total: rest[2] as boolean + 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 search = params.search; + 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'.replace('{databaseId}', databaseId); + 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 search !== 'undefined') { - payload['search'] = search; + 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 } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -747,4617 +445,57 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * 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. + * 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 - 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). + * @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<Models.Collection>} - * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createTable` instead. + * @returns {Promise<Document>} + * @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.createRow` instead. */ - createCollection(this: Databases<ServerAuth>, params: { databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean, attributes?: object[], indexes?: object[] }): Promise<Models.Collection>; + 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 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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>(this: Databases<ServerAuth>, 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. + * 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). - * @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} 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<Models.DocumentList<Document>>} + * @returns {Promise<Document>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteDocuments<Document extends Models.Document = Models.DefaultDocument>(this: Databases<ServerAuth>, 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 }; + 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, queries?: string[], transactionId?: string }; + 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, - queries: rest[1] as string[], - transactionId: rest[2] 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 queries = params.queries; + const documentId = params.documentId; + const data = params.data; + const permissions = params.permissions; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -5366,11 +504,23 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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 queries !== 'undefined') { - payload['queries'] = queries; + 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; @@ -5378,11 +528,13 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( - 'delete', + 'post', uri, apiHeaders, payload @@ -5460,6 +612,8 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5548,7 +702,9 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5637,7 +793,9 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5712,6 +870,7 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5808,7 +967,9 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5904,7 +1065,9 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5914,326 +1077,4 @@ class DatabasesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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(this: Databases<ServerAuth>, 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 - ); - } } - -const Databases = DatabasesRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Databases<TAuth>; -}; - -export { Databases }; diff --git a/src/services/functions.ts b/src/services/functions.ts index 16baceac..533a9313 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -1,1686 +1,41 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -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'; -type FunctionsServerOnlyMethod = 'list' | 'create' | 'listRuntimes' | 'listSpecifications' | 'get' | 'update' | 'delete' | 'updateFunctionDeployment' | 'listDeployments' | 'createDeployment' | 'createDuplicateDeployment' | 'createTemplateDeployment' | 'createVcsDeployment' | 'getDeployment' | 'deleteDeployment' | 'getDeploymentDownload' | 'updateDeploymentStatus' | 'deleteExecution' | 'listVariables' | 'createVariable' | 'getVariable' | 'updateVariable' | 'deleteVariable'; -type FunctionsClientOnlyMethod = never; +export class Functions { + client: Client; -export type Functions<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<FunctionsRuntime<TAuth>, 'client' | FunctionsClientOnlyMethod> - : Omit<FunctionsRuntime<TAuth>, 'client'>; - -class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { - 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, ): 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(this: Functions<ServerAuth>, ): 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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} 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(this: Functions<ServerAuth>, params: { functionId: string, code: File, 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} 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(this: Functions<ServerAuth>, functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; - createDeployment( - paramsOrFirst: { functionId: string, code: File, activate: boolean, entrypoint?: string, commands?: string, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File)?, (boolean)?, (string)?, (string)?,((progress: UploadProgress) => void)?] - ): Promise<Models.Deployment> { - let params: { functionId: string, code: File, 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, activate: boolean, entrypoint?: string, commands?: string }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); - } else { - params = { - functionId: paramsOrFirst as string, - code: rest[0] as File, - 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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 - ); + constructor(client: Client) { + this.client = client; } /** - * Delete a function execution by its unique ID. + * 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.executionId - Execution ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteExecution(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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 {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.VariableList>} + * @returns {Promise<Models.ExecutionList>} */ - listVariables(this: Functions<ServerAuth>, params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.VariableList>; + listExecutions(params: { functionId: string, queries?: string[], total?: boolean }): Promise<Models.ExecutionList>; /** - * Get a list of all variables of a specific function. + * 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 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 {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.VariableList>} + * @returns {Promise<Models.ExecutionList>} * @deprecated Use the object parameter style method for a better developer experience. */ - listVariables(this: Functions<ServerAuth>, functionId: string, queries?: string[], total?: boolean): Promise<Models.VariableList>; - listVariables( + listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>; + listExecutions( paramsOrFirst: { functionId: string, queries?: string[], total?: boolean } | string, ...rest: [(string[])?, (boolean)?] - ): Promise<Models.VariableList> { + ): Promise<Models.ExecutionList> { let params: { functionId: string, queries?: string[], total?: boolean }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { @@ -1701,7 +56,7 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv throw new AppwriteException('Missing required parameter: "functionId"'); } - const apiPath = '/functions/{functionId}/variables'.replace('{functionId}', functionId); + const apiPath = '/functions/{functionId}/executions'.replace('{functionId}', functionId); const payload: Payload = {}; if (typeof queries !== 'undefined') { payload['queries'] = queries; @@ -1712,6 +67,8 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -1723,229 +80,96 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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. + * 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 unique ID. - * @param {string} params.variableId - Variable unique ID. + * @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.Variable>} + * @returns {Promise<Models.Execution>} */ - getVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string }): Promise<Models.Variable>; + createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }): Promise<Models.Execution>; /** - * Get a variable by its unique ID. + * 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 unique ID. - * @param {string} variableId - Variable unique ID. + * @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.Variable>} + * @returns {Promise<Models.Execution>} * @deprecated Use the object parameter style method for a better developer experience. */ - getVariable(this: Functions<ServerAuth>, 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 }; + 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, variableId: string }; + params = (paramsOrFirst || {}) as { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; } else { params = { functionId: paramsOrFirst as string, - variableId: rest[0] 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 variableId = params.variableId; + 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"'); } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); - } - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + const apiPath = '/functions/{functionId}/executions'.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 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(this: Functions<ServerAuth>, 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(this: Functions<ServerAuth>, 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 - }; + if (typeof body !== 'undefined') { + payload['body'] = body; } - - 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 async !== 'undefined') { + payload['async'] = async; } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); + if (typeof xpath !== 'undefined') { + payload['path'] = xpath; } - - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); - const payload: Payload = {}; - if (typeof key !== 'undefined') { - payload['key'] = key; + if (typeof method !== 'undefined') { + payload['method'] = method; } - if (typeof value !== 'undefined') { - payload['value'] = value; + if (typeof headers !== 'undefined') { + payload['headers'] = headers; } - if (typeof secret !== 'undefined') { - payload['secret'] = secret; + if (typeof scheduledAt !== 'undefined') { + payload['scheduledAt'] = scheduledAt; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'multipart/form-data', } return this.client.call( - 'put', + 'post', uri, apiHeaders, payload @@ -1953,68 +177,63 @@ class FunctionsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv } /** - * Delete a variable by its unique ID. + * Get a function execution log by its unique ID. * - * @param {string} params.functionId - Function unique ID. - * @param {string} params.variableId - Variable unique ID. + * @param {string} params.functionId - Function ID. + * @param {string} params.executionId - Execution ID. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise<Models.Execution>} */ - deleteVariable(this: Functions<ServerAuth>, params: { functionId: string, variableId: string }): Promise<{}>; + getExecution(params: { functionId: string, executionId: string }): Promise<Models.Execution>; /** - * Delete a variable by its unique ID. + * Get a function execution log by its unique ID. * - * @param {string} functionId - Function unique ID. - * @param {string} variableId - Variable unique ID. + * @param {string} functionId - Function ID. + * @param {string} executionId - Execution ID. * @throws {AppwriteException} - * @returns {Promise<{}>} + * @returns {Promise<Models.Execution>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteVariable(this: Functions<ServerAuth>, functionId: string, variableId: string): Promise<{}>; - deleteVariable( - paramsOrFirst: { functionId: string, variableId: string } | string, + getExecution(functionId: string, executionId: string): Promise<Models.Execution>; + getExecution( + paramsOrFirst: { functionId: string, executionId: string } | string, ...rest: [(string)?] - ): Promise<{}> { - let params: { functionId: string, variableId: string }; + ): Promise<Models.Execution> { + let params: { functionId: string, executionId: string }; if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { functionId: string, variableId: string }; + params = (paramsOrFirst || {}) as { functionId: string, executionId: string }; } else { params = { functionId: paramsOrFirst as string, - variableId: rest[0] as string + executionId: rest[0] as string }; } const functionId = params.functionId; - const variableId = params.variableId; + const executionId = params.executionId; if (typeof functionId === 'undefined') { throw new AppwriteException('Missing required parameter: "functionId"'); } - if (typeof variableId === 'undefined') { - throw new AppwriteException('Missing required parameter: "variableId"'); + if (typeof executionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "executionId"'); } - const apiPath = '/functions/{functionId}/variables/{variableId}'.replace('{functionId}', functionId).replace('{variableId}', variableId); + 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', + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( - 'delete', + 'get', uri, apiHeaders, payload ); } } - -const Functions = FunctionsRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Functions<TAuth>; -}; - -export { Functions }; diff --git a/src/services/graphql.ts b/src/services/graphql.ts index 5068c21d..0823f622 100644 --- a/src/services/graphql.ts +++ b/src/services/graphql.ts @@ -1,21 +1,12 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -type GraphqlServerOnlyMethod = never; -type GraphqlClientOnlyMethod = never; +export class Graphql { + client: Client; -export type Graphql<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<GraphqlRuntime<TAuth>, 'client' | GraphqlClientOnlyMethod> - : Omit<GraphqlRuntime<TAuth>, 'client'>; - -class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -63,8 +54,10 @@ class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -119,8 +112,10 @@ class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'x-sdk-graphql': 'true', 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -131,9 +126,3 @@ class GraphqlRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server ); } } - -const Graphql = GraphqlRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Graphql<TAuth>; -}; - -export { Graphql }; diff --git a/src/services/health.ts b/src/services/health.ts deleted file mode 100644 index 32578a39..00000000 --- a/src/services/health.ts +++ /dev/null @@ -1,1050 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { Name } from '../enums/name'; - -export type Health = Omit<HealthRuntime, 'client'>; - -class HealthRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Health = HealthRuntime as unknown as { - new (client: Client<ServerAuth>): Health; -}; - -export { Health }; diff --git a/src/services/locale.ts b/src/services/locale.ts index c9a0b95f..41583e29 100644 --- a/src/services/locale.ts +++ b/src/services/locale.ts @@ -1,21 +1,12 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -type LocaleServerOnlyMethod = never; -type LocaleClientOnlyMethod = never; +export class Locale { + client: Client; -export type Locale<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<LocaleRuntime<TAuth>, 'client' | LocaleClientOnlyMethod> - : Omit<LocaleRuntime<TAuth>, 'client'>; - -class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -34,6 +25,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -57,6 +50,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -80,6 +75,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -103,6 +100,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -126,6 +125,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -149,6 +150,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -172,6 +175,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -195,6 +200,8 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -205,9 +212,3 @@ class LocaleRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerA ); } } - -const Locale = LocaleRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Locale<TAuth>; -}; - -export { Locale }; diff --git a/src/services/messaging.ts b/src/services/messaging.ts index 35acc289..8b3ef813 100644 --- a/src/services/messaging.ts +++ b/src/services/messaging.ts @@ -1,5010 +1,13 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +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'; -type MessagingServerOnlyMethod = 'listMessages' | 'createEmail' | 'updateEmail' | 'createPush' | 'updatePush' | 'createSms' | 'createSMS' | 'updateSms' | 'updateSMS' | 'getMessage' | 'delete' | 'listMessageLogs' | 'listTargets' | 'listProviders' | 'createApnsProvider' | 'createAPNSProvider' | 'updateApnsProvider' | 'updateAPNSProvider' | 'createFcmProvider' | 'createFCMProvider' | 'updateFcmProvider' | 'updateFCMProvider' | 'createMailgunProvider' | 'updateMailgunProvider' | 'createMsg91Provider' | 'updateMsg91Provider' | 'createResendProvider' | 'updateResendProvider' | 'createSendgridProvider' | 'updateSendgridProvider' | 'createSmtpProvider' | 'createSMTPProvider' | 'updateSmtpProvider' | 'updateSMTPProvider' | 'createTelesignProvider' | 'updateTelesignProvider' | 'createTextmagicProvider' | 'updateTextmagicProvider' | 'createTwilioProvider' | 'updateTwilioProvider' | 'createVonageProvider' | 'updateVonageProvider' | 'getProvider' | 'deleteProvider' | 'listProviderLogs' | 'listSubscriberLogs' | 'listTopics' | 'createTopic' | 'getTopic' | 'updateTopic' | 'deleteTopic' | 'listTopicLogs' | 'listSubscribers' | 'getSubscriber'; -type MessagingClientOnlyMethod = never; +export class Messaging { + client: Client; -export type Messaging<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<MessagingRuntime<TAuth>, 'client' | MessagingClientOnlyMethod> - : Omit<MessagingRuntime<TAuth>, 'client'>; - -class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { - 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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 - ); + constructor(client: Client) { + this.client = client; } /** @@ -5069,7 +72,9 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5080,67 +85,6 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } - /** - * 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(this: Messaging<ServerAuth>, 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(this: Messaging<ServerAuth>, 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. * @@ -5190,6 +134,7 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -5201,9 +146,3 @@ class MessagingRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } } - -const Messaging = MessagingRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Messaging<TAuth>; -}; - -export { Messaging }; diff --git a/src/services/oauth-2.ts b/src/services/oauth-2.ts new file mode 100644 index 00000000..d3f2b53b --- /dev/null +++ b/src/services/oauth-2.ts @@ -0,0 +1,418 @@ +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; +import type { Models } from '../models'; + + +export class Oauth2 { + client: Client; + + constructor(client: Client) { + this.client = client; + } + + /** + * Approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} params.projectId - Project ID in which OAuth2 client that created grant during authorization exists. + * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @param {string} params.authorizationDetails - Enriched `authorization_details` the user consented to, replacing what the client requested. Each entry must use a `type` the project accepts. Optional; omit to keep the originally requested details. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Approve>} + */ + approve(params: { projectId: string, grantId: string, authorizationDetails?: string }): Promise<Models.Oauth2Approve>; + /** + * Approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} projectId - Project ID in which OAuth2 client that created grant during authorization exists. + * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @param {string} authorizationDetails - Enriched `authorization_details` the user consented to, replacing what the client requested. Each entry must use a `type` the project accepts. Optional; omit to keep the originally requested details. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Approve>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + approve(projectId: string, grantId: string, authorizationDetails?: string): Promise<Models.Oauth2Approve>; + approve( + paramsOrFirst: { projectId: string, grantId: string, authorizationDetails?: string } | string, + ...rest: [(string)?, (string)?] + ): Promise<Models.Oauth2Approve> { + let params: { projectId: string, grantId: string, authorizationDetails?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, grantId: string, authorizationDetails?: string }; + } else { + params = { + projectId: paramsOrFirst as string, + grantId: rest[0] as string, + authorizationDetails: rest[1] as string + }; + } + + const projectId = params.projectId; + const grantId = params.grantId; + const authorizationDetails = params.authorizationDetails; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof grantId === 'undefined') { + throw new AppwriteException('Missing required parameter: "grantId"'); + } + + const apiPath = '/oauth2/{project_id}/approve'.replace('{project_id}', projectId); + const payload: Payload = {}; + if (typeof grantId !== 'undefined') { + payload['grant_id'] = grantId; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorization_details'] = authorizationDetails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + uri.searchParams.append('project', this.client.config.project); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} params.projectId - Project ID in which OAuth2 client exists. + * @param {string} params.clientId - OAuth2 client ID. + * @param {string} params.redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} params.responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + * @param {string} params.scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`. + * @param {string} params.state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} params.nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} params.codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} params.codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} params.prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} params.maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + * @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Authorize>} + */ + authorize(params: { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string }): Promise<Models.Oauth2Authorize>; + /** + * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} projectId - Project ID in which OAuth2 client exists. + * @param {string} clientId - OAuth2 client ID. + * @param {string} redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. + * @param {string} responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). + * @param {string} scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`. + * @param {string} state - OAuth2 state. You receive this back in the redirect URI. + * @param {string} nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. + * @param {string} codeChallenge - PKCE code challenge. Required when OAuth2 app is public. + * @param {string} codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. + * @param {string} prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. + * @param {number} maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. + * @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Authorize>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + authorize(projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string): Promise<Models.Oauth2Authorize>; + authorize( + paramsOrFirst: { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string } | string, + ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?] + ): Promise<Models.Oauth2Authorize> { + let params: { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string }; + } else { + params = { + projectId: paramsOrFirst as string, + clientId: rest[0] as string, + redirectUri: rest[1] as string, + responseType: rest[2] as string, + scope: rest[3] as string, + state: rest[4] as string, + nonce: rest[5] as string, + codeChallenge: rest[6] as string, + codeChallengeMethod: rest[7] as string, + prompt: rest[8] as string, + maxAge: rest[9] as number, + authorizationDetails: rest[10] as string + }; + } + + const projectId = params.projectId; + const clientId = params.clientId; + const redirectUri = params.redirectUri; + const responseType = params.responseType; + const scope = params.scope; + const state = params.state; + const nonce = params.nonce; + const codeChallenge = params.codeChallenge; + const codeChallengeMethod = params.codeChallengeMethod; + const prompt = params.prompt; + const maxAge = params.maxAge; + const authorizationDetails = params.authorizationDetails; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof clientId === 'undefined') { + throw new AppwriteException('Missing required parameter: "clientId"'); + } + if (typeof redirectUri === 'undefined') { + throw new AppwriteException('Missing required parameter: "redirectUri"'); + } + if (typeof responseType === 'undefined') { + throw new AppwriteException('Missing required parameter: "responseType"'); + } + if (typeof scope === 'undefined') { + throw new AppwriteException('Missing required parameter: "scope"'); + } + + const apiPath = '/oauth2/{project_id}/authorize'.replace('{project_id}', projectId); + const payload: Payload = {}; + if (typeof clientId !== 'undefined') { + payload['client_id'] = clientId; + } + if (typeof redirectUri !== 'undefined') { + payload['redirect_uri'] = redirectUri; + } + if (typeof responseType !== 'undefined') { + payload['response_type'] = responseType; + } + if (typeof scope !== 'undefined') { + payload['scope'] = scope; + } + if (typeof state !== 'undefined') { + payload['state'] = state; + } + if (typeof nonce !== 'undefined') { + payload['nonce'] = nonce; + } + if (typeof codeChallenge !== 'undefined') { + payload['code_challenge'] = codeChallenge; + } + if (typeof codeChallengeMethod !== 'undefined') { + payload['code_challenge_method'] = codeChallengeMethod; + } + if (typeof prompt !== 'undefined') { + payload['prompt'] = prompt; + } + if (typeof maxAge !== 'undefined') { + payload['max_age'] = maxAge; + } + if (typeof authorizationDetails !== 'undefined') { + payload['authorization_details'] = authorizationDetails; + } + const uri = new URL(this.client.config.endpoint + apiPath); + uri.searchParams.append('project', this.client.config.project); + + const apiHeaders: { [header: string]: string } = { + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow. + * + * @param {string} params.projectId - Project ID in which OAuth2 client exists. + * @param {string} params.userCode - User code displayed on the device. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Grant>} + */ + createGrant(params: { projectId: string, userCode: string }): Promise<Models.Oauth2Grant>; + /** + * Exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow. + * + * @param {string} projectId - Project ID in which OAuth2 client exists. + * @param {string} userCode - User code displayed on the device. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Grant>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + createGrant(projectId: string, userCode: string): Promise<Models.Oauth2Grant>; + createGrant( + paramsOrFirst: { projectId: string, userCode: string } | string, + ...rest: [(string)?] + ): Promise<Models.Oauth2Grant> { + let params: { projectId: string, userCode: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, userCode: string }; + } else { + params = { + projectId: paramsOrFirst as string, + userCode: rest[0] as string + }; + } + + const projectId = params.projectId; + const userCode = params.userCode; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof userCode === 'undefined') { + throw new AppwriteException('Missing required parameter: "userCode"'); + } + + const apiPath = '/oauth2/{project_id}/grants'.replace('{project_id}', projectId); + const payload: Payload = {}; + if (typeof userCode !== 'undefined') { + payload['user_code'] = userCode; + } + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } + + /** + * Get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK. + * + * @param {string} params.projectId - Project ID in which OAuth2 client that created grant during authorization exists. + * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Grant>} + */ + getGrant(params: { projectId: string, grantId: string }): Promise<Models.Oauth2Grant>; + /** + * Get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK. + * + * @param {string} projectId - Project ID in which OAuth2 client that created grant during authorization exists. + * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Grant>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + getGrant(projectId: string, grantId: string): Promise<Models.Oauth2Grant>; + getGrant( + paramsOrFirst: { projectId: string, grantId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Oauth2Grant> { + let params: { projectId: string, grantId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, grantId: string }; + } else { + params = { + projectId: paramsOrFirst as string, + grantId: rest[0] as string + }; + } + + const projectId = params.projectId; + const grantId = params.grantId; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof grantId === 'undefined') { + throw new AppwriteException('Missing required parameter: "grantId"'); + } + + const apiPath = '/oauth2/{project_id}/grants/{grant_id}'.replace('{project_id}', projectId).replace('{grant_id}', grantId); + const payload: Payload = {}; + const uri = new URL(this.client.config.endpoint + apiPath); + + const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', + } + + return this.client.call( + 'get', + uri, + apiHeaders, + payload + ); + } + + /** + * Reject an OAuth2 grant when the user denies consent. Returns the `redirectUrl` the end user should be sent to with an `access_denied` error. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} params.projectId - Project ID in which OAuth2 client that created grant during authorization exists. + * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Reject>} + */ + reject(params: { projectId: string, grantId: string }): Promise<Models.Oauth2Reject>; + /** + * Reject an OAuth2 grant when the user denies consent. Returns the `redirectUrl` the end user should be sent to with an `access_denied` error. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. + * + * @param {string} projectId - Project ID in which OAuth2 client that created grant during authorization exists. + * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. + * @throws {AppwriteException} + * @returns {Promise<Models.Oauth2Reject>} + * @deprecated Use the object parameter style method for a better developer experience. + */ + reject(projectId: string, grantId: string): Promise<Models.Oauth2Reject>; + reject( + paramsOrFirst: { projectId: string, grantId: string } | string, + ...rest: [(string)?] + ): Promise<Models.Oauth2Reject> { + let params: { projectId: string, grantId: string }; + + if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { + params = (paramsOrFirst || {}) as { projectId: string, grantId: string }; + } else { + params = { + projectId: paramsOrFirst as string, + grantId: rest[0] as string + }; + } + + const projectId = params.projectId; + const grantId = params.grantId; + + if (typeof projectId === 'undefined') { + throw new AppwriteException('Missing required parameter: "projectId"'); + } + if (typeof grantId === 'undefined') { + throw new AppwriteException('Missing required parameter: "grantId"'); + } + + const apiPath = '/oauth2/{project_id}/reject'.replace('{project_id}', projectId); + const payload: Payload = {}; + if (typeof grantId !== 'undefined') { + payload['grant_id'] = grantId; + } + const uri = new URL(this.client.config.endpoint + apiPath); + uri.searchParams.append('project', this.client.config.project); + + const apiHeaders: { [header: string]: string } = { + 'content-type': 'application/json', + 'accept': 'application/json', + } + + return this.client.call( + 'post', + uri, + apiHeaders, + payload + ); + } +} diff --git a/src/services/presences.ts b/src/services/presences.ts index d9ba50f5..46678203 100644 --- a/src/services/presences.ts +++ b/src/services/presences.ts @@ -1,21 +1,12 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -type PresencesServerOnlyMethod = never; -type PresencesClientOnlyMethod = 'upsert' | 'updatePresence'; +export class Presences { + client: Client; -export type Presences<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<PresencesRuntime<TAuth>, 'client' | PresencesServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<PresencesRuntime<TAuth>, 'client' | PresencesClientOnlyMethod> - : Omit<PresencesRuntime<TAuth>, 'client'>; - -class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -27,9 +18,9 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @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. * @@ -38,14 +29,14 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * @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))) { @@ -77,6 +68,8 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -93,22 +86,22 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * * @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))) { @@ -130,6 +123,8 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -145,51 +140,47 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * * * @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>} + * @returns {Promise<Models.Presence>} */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, params: { presenceId: string, userId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Presence>; + upsert(params: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object }): Promise<Models.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>} + * @returns {Promise<Models.Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsert<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, 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 }; + upsert(presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object): Promise<Models.Presence>; + upsert( + paramsOrFirst: { presenceId: string, status: string, permissions?: string[], expiresAt?: string, metadata?: object } | string, + ...rest: [(string)?, (string[])?, (string)?, (object)?] + ): Promise<Models.Presence> { + let params: { presenceId: 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 }; + params = (paramsOrFirst || {}) as { presenceId: 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 + status: rest[0] as string, + permissions: rest[1] as string[], + expiresAt: rest[2] as string, + metadata: rest[3] as object }; } const presenceId = params.presenceId; - const userId = params.userId; const status = params.status; const permissions = params.permissions; const expiresAt = params.expiresAt; @@ -198,18 +189,12 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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; } @@ -225,7 +210,9 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -241,54 +228,50 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv * * * @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>} + * @returns {Promise<Models.Presence>} */ - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, params: { presenceId: string, userId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean }): Promise<Presence>; + update(params: { presenceId: 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. * * * @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>} + * @returns {Promise<Models.Presence>} * @deprecated Use the object parameter style method for a better developer experience. */ - updatePresence<Presence extends Models.Presence = Models.DefaultPresence>(this: Presences<ClientAuth>, 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 }; + update(presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean): Promise<Models.Presence>; + update( + paramsOrFirst: { presenceId: string, status?: string, expiresAt?: string, metadata?: object, permissions?: string[], purge?: boolean } | string, + ...rest: [(string)?, (string)?, (object)?, (string[])?, (boolean)?] + ): Promise<Models.Presence> { + let params: { presenceId: 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 }; + params = (paramsOrFirst || {}) as { presenceId: 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 + status: rest[0] as string, + expiresAt: rest[1] as string, + metadata: rest[2] as object, + permissions: rest[3] as string[], + purge: rest[4] as boolean }; } const presenceId = params.presenceId; - const userId = params.userId; const status = params.status; const expiresAt = params.expiresAt; const metadata = params.metadata; @@ -298,15 +281,9 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv 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; } @@ -325,7 +302,9 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -379,6 +358,7 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -390,9 +370,3 @@ class PresencesRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serv ); } } - -const Presences = PresencesRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Presences<TAuth>; -}; - -export { Presences }; diff --git a/src/services/project.ts b/src/services/project.ts deleted file mode 100644 index 3f8bdd0e..00000000 --- a/src/services/project.ts +++ /dev/null @@ -1,6466 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } 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 type Project = Omit<ProjectRuntime, 'client'>; - -class ProjectRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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: GOCSPX-2k8gsR0000000000000000VNahJj - * @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: GOCSPX-2k8gsR0000000000000000VNahJj - * @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: WPL_AP1.2Bf0000000000000./HtlYw== - * @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: WPL_AP1.2Bf0000000000000./HtlYw== - * @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 - ); - } -} - -const Project = ProjectRuntime as unknown as { - new (client: Client<ServerAuth>): Project; -}; - -export { Project }; diff --git a/src/services/proxy.ts b/src/services/proxy.ts deleted file mode 100644 index 6e8e0919..00000000 --- a/src/services/proxy.ts +++ /dev/null @@ -1,548 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - -import { StatusCode } from '../enums/status-code'; -import { ProxyResourceType } from '../enums/proxy-resource-type'; - -export type Proxy = Omit<ProxyRuntime, 'client'>; - -class ProxyRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Proxy = ProxyRuntime as unknown as { - new (client: Client<ServerAuth>): Proxy; -}; - -export { Proxy }; diff --git a/src/services/realtime.ts b/src/services/realtime.ts index a5eb07ef..7aebdaa6 100644 --- a/src/services/realtime.ts +++ b/src/services/realtime.ts @@ -1,4 +1,4 @@ -import { AppwriteException, Client, JSONbig, type ClientAuth } from '../client'; +import { AppwriteException, Client, JSONbig } from '../client'; import { Channel, ActionableChannel, ResolvedChannel } from '../channel'; import { Query } from '../query'; import { ID } from '../id'; @@ -96,7 +96,7 @@ export class Realtime { private readonly DEBOUNCE_MS = 1; private readonly HEARTBEAT_INTERVAL = 20000; // 20 seconds in milliseconds - private client: Client<ClientAuth>; + private client: Client; private socket?: WebSocket; private activeSubscriptions = new Map<string, RealtimeCallback<any>>(); private pendingSubscribes = new Map<string, RealtimeRequestSubscribeRow>(); @@ -117,7 +117,7 @@ export class Realtime { private onCloseCallbacks: Array<() => void> = []; private onOpenCallbacks: Array<() => void> = []; - constructor(client: Client<ClientAuth>) { + constructor(client: Client) { this.client = client; } @@ -153,26 +153,16 @@ export class Realtime { private startHeartbeat(): void { this.stopHeartbeat(); - this.heartbeatTimer = typeof window !== 'undefined' - ? window.setInterval(() => { - if (this.socket && this.socket.readyState === WebSocket.OPEN) { - this.socket.send(JSONbig.stringify({ type: 'ping' })); - } - }, this.HEARTBEAT_INTERVAL) - : setInterval(() => { - if (this.socket && this.socket.readyState === WebSocket.OPEN) { - this.socket.send(JSONbig.stringify({ type: 'ping' })); - } - }, this.HEARTBEAT_INTERVAL) as unknown as number; + this.heartbeatTimer = window?.setInterval(() => { + if (this.socket && this.socket.readyState === WebSocket.OPEN) { + this.socket.send(JSONbig.stringify({ type: 'ping' })); + } + }, this.HEARTBEAT_INTERVAL); } private stopHeartbeat(): void { if (this.heartbeatTimer) { - if (typeof window !== 'undefined') { - window.clearInterval(this.heartbeatTimer); - } else { - clearInterval(this.heartbeatTimer as any); - } + window?.clearInterval(this.heartbeatTimer); this.heartbeatTimer = undefined; } } @@ -717,10 +707,8 @@ export class Realtime { let session = this.client.config.session; if (!session) { try { - if (typeof window !== 'undefined' && window.localStorage) { - const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); - session = cookie?.[`a_session_${this.client.config.project}`]; - } + const cookie = JSONbig.parse(window.localStorage.getItem('cookieFallback') ?? '{}'); + session = cookie?.[`a_session_${this.client.config.project}`]; } catch (error) { console.error('Failed to parse cookie fallback:', error); } diff --git a/src/services/sites.ts b/src/services/sites.ts deleted file mode 100644 index e17da317..00000000 --- a/src/services/sites.ts +++ /dev/null @@ -1,1924 +0,0 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type ServerAuth, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - -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 type Sites = Omit<SitesRuntime, 'client'>; - -class SitesRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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} 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, 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} 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, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void): Promise<Models.Deployment>; - createDeployment( - paramsOrFirst: { siteId: string, code: File, installCommand?: string, buildCommand?: string, outputDirectory?: string, activate?: boolean, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(File)?, (string)?, (string)?, (string)?, (boolean)?,((progress: UploadProgress) => void)?] - ): Promise<Models.Deployment> { - let params: { siteId: string, code: File, 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, 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, - 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 - ); - } -} - -const Sites = SitesRuntime as unknown as { - new (client: Client<ServerAuth>): Sites; -}; - -export { Sites }; diff --git a/src/services/storage.ts b/src/services/storage.ts index b0586c78..485f59de 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -1,452 +1,17 @@ import { Service } from '../service'; -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload, UploadProgress } from '../client'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -import { Compression } from '../enums/compression'; import { ImageGravity } from '../enums/image-gravity'; import { ImageFormat } from '../enums/image-format'; -type StorageServerOnlyMethod = 'listBuckets' | 'createBucket' | 'getBucket' | 'updateBucket' | 'deleteBucket'; -type StorageClientOnlyMethod = never; +export class Storage { + client: Client; -export type Storage<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<StorageRuntime<TAuth>, 'client' | StorageServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<StorageRuntime<TAuth>, 'client' | StorageClientOnlyMethod> - : Omit<StorageRuntime<TAuth>, 'client'>; - -class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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(this: Storage<ServerAuth>, 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. * @@ -510,6 +75,8 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -606,7 +173,9 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'multipart/form-data', + 'accept': 'application/json', } return this.client.chunkedUpload( @@ -667,6 +236,8 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -740,7 +311,9 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -800,6 +373,7 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -867,12 +441,16 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -1009,12 +587,16 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'image/*', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } @@ -1074,18 +656,16 @@ class StorageRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Server const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': '*/*', } - payload['project'] = (this.client.config as unknown as Record<string, string>)['project']; + payload['project'] = this.client.config.project; + for (const [key, value] of Object.entries(Service.flatten(payload))) { uri.searchParams.append(key, value); } + return uri.toString(); } } - -const Storage = StorageRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Storage<TAuth>; -}; - -export { Storage }; diff --git a/src/services/tables-db.ts b/src/services/tables-db.ts index 3e351951..06a034a2 100644 --- a/src/services/tables-db.ts +++ b/src/services/tables-db.ts @@ -1,169 +1,15 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +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'; -type TablesDBServerOnlyMethod = 'list' | 'create' | 'get' | 'update' | 'delete' | 'listTables' | 'createTable' | 'getTable' | 'updateTable' | 'deleteTable' | 'listColumns' | 'createBigIntColumn' | 'updateBigIntColumn' | 'createBooleanColumn' | 'updateBooleanColumn' | 'createDatetimeColumn' | 'updateDatetimeColumn' | 'createEmailColumn' | 'updateEmailColumn' | 'createEnumColumn' | 'updateEnumColumn' | 'createFloatColumn' | 'updateFloatColumn' | 'createIntegerColumn' | 'updateIntegerColumn' | 'createIpColumn' | 'updateIpColumn' | 'createLineColumn' | 'updateLineColumn' | 'createLongtextColumn' | 'updateLongtextColumn' | 'createMediumtextColumn' | 'updateMediumtextColumn' | 'createPointColumn' | 'updatePointColumn' | 'createPolygonColumn' | 'updatePolygonColumn' | 'createRelationshipColumn' | 'createStringColumn' | 'updateStringColumn' | 'createTextColumn' | 'updateTextColumn' | 'createUrlColumn' | 'updateUrlColumn' | 'createVarcharColumn' | 'updateVarcharColumn' | 'getColumn' | 'deleteColumn' | 'updateRelationshipColumn' | 'listIndexes' | 'createIndex' | 'getIndex' | 'deleteIndex' | 'upsertRows' | 'updateRows' | 'deleteRows'; -type TablesDBClientOnlyMethod = never; +export class TablesDB { + client: Client; -export type TablesDB<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<TablesDBRuntime<TAuth>, 'client' | TablesDBClientOnlyMethod> - : Omit<TablesDBRuntime<TAuth>, 'client'>; - -class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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. * @@ -205,6 +51,8 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -256,7 +104,9 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -308,6 +158,8 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -335,5008 +187,52 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve * @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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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(this: TablesDB<ServerAuth>, 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>} + * @returns {Promise<Models.Transaction>} * @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 }; + 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 { 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 }; + params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean }; } 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 + transactionId: paramsOrFirst as string, + commit: rest[0] as boolean, + rollback: rest[1] as boolean }; } - const databaseId = params.databaseId; - const tableId = params.tableId; - const rowId = params.rowId; - const data = params.data; - const permissions = params.permissions; const transactionId = params.transactionId; + const commit = params.commit; + const rollback = params.rollback; - 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"'); + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); 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 commit !== 'undefined') { + payload['commit'] = commit; } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + if (typeof rollback !== 'undefined') { + payload['rollback'] = rollback; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( - 'post', + 'patch', uri, apiHeaders, payload @@ -5344,76 +240,52 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * 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. + * Delete a transaction 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). 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. + * @param {string} params.transactionId - Transaction ID. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<{}>} */ - createRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + deleteTransaction(params: { transactionId: string }): Promise<{}>; /** - * 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. + * Delete a transaction 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). 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. + * @param {string} transactionId - Transaction ID. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<{}>} * @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 }; + 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 { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + params = (paramsOrFirst || {}) as { transactionId: string }; } else { params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rows: rest[1] as object[], - transactionId: rest[2] as string + transactionId: paramsOrFirst 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"'); + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId); 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 } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } return this.client.call( - 'post', + 'delete', uri, apiHeaders, payload @@ -5421,78 +293,61 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * 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. - * + * Create multiple operations in a single transaction. * - * @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. + * @param {string} params.transactionId - Transaction ID. + * @param {object[]} params.operations - Array of staged operations. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Models.Transaction>} */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, rows: object[], transactionId?: string }): Promise<Models.RowList<Row>>; + createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>; /** - * 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. - * + * Create multiple operations in a single transaction. * - * @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. + * @param {string} transactionId - Transaction ID. + * @param {object[]} operations - Array of staged operations. * @throws {AppwriteException} - * @returns {Promise<Models.RowList<Row>>} + * @returns {Promise<Models.Transaction>} * @deprecated Use the object parameter style method for a better developer experience. */ - upsertRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, 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 }; + 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 { databaseId: string, tableId: string, rows: object[], transactionId?: string }; + params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] }; } else { params = { - databaseId: paramsOrFirst as string, - tableId: rest[0] as string, - rows: rest[1] as object[], - transactionId: rest[2] as string + transactionId: paramsOrFirst as string, + operations: rest[0] as object[] }; } - const databaseId = params.databaseId; - const tableId = params.tableId; - const rows = params.rows; const transactionId = params.transactionId; + const operations = params.operations; - 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"'); + if (typeof transactionId === 'undefined') { + throw new AppwriteException('Missing required parameter: "transactionId"'); } - const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId); + const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId); const payload: Payload = {}; - if (typeof rows !== 'undefined') { - payload['rows'] = rows; - } - if (typeof transactionId !== 'undefined') { - payload['transactionId'] = transactionId; + if (typeof operations !== 'undefined') { + payload['operations'] = operations; } const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( - 'put', + 'post', uri, apiHeaders, payload @@ -5500,53 +355,57 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * 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. + * 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. - * @param {object} params.data - Row data as JSON object. Include only column and value pairs to be updated. + * @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 for staging the operation. + * @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>>} */ - updateRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, data?: object, queries?: string[], transactionId?: string }): 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>>; /** - * 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. + * 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. - * @param {object} data - Row data as JSON object. Include only column and value pairs to be updated. + * @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 for staging the operation. + * @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. */ - updateRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, 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)?] + 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, data?: object, queries?: string[], transactionId?: string }; + 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, data?: object, queries?: string[], transactionId?: string }; + 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, - data: rest[1] as object, - queries: rest[2] as string[], - transactionId: rest[3] 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 data = params.data; 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"'); @@ -5557,23 +416,27 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve 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; } + 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 } = { - 'content-type': 'application/json', + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( - 'patch', + 'get', uri, apiHeaders, payload @@ -5581,48 +444,56 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve } /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * 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). - * @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.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<Models.RowList<Row>>} + * @returns {Promise<Row>} */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<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>; /** - * Bulk delete rows using queries, if no queries are passed then all rows are deleted. + * 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). - * @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} 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<Models.RowList<Row>>} + * @returns {Promise<Row>} * @deprecated Use the object parameter style method for a better developer experience. */ - deleteRows<Row extends Models.Row = Models.DefaultRow>(this: TablesDB<ServerAuth>, 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 }; + 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, queries?: string[], transactionId?: string }; + 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, - queries: rest[1] as string[], - transactionId: rest[2] 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 queries = params.queries; + const rowId = params.rowId; + const data = params.data; + const permissions = params.permissions; const transactionId = params.transactionId; if (typeof databaseId === 'undefined') { @@ -5631,11 +502,23 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve 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 queries !== 'undefined') { - payload['queries'] = queries; + 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; @@ -5643,11 +526,13 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( - 'delete', + 'post', uri, apiHeaders, payload @@ -5724,6 +609,8 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -5811,7 +698,9 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5899,7 +788,9 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -5973,6 +864,7 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -6068,7 +960,9 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6163,7 +1057,9 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -6174,9 +1070,3 @@ class TablesDBRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | Serve ); } } - -const TablesDB = TablesDBRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): TablesDB<TAuth>; -}; - -export { TablesDB }; diff --git a/src/services/teams.ts b/src/services/teams.ts index cdcf75ca..7d169454 100644 --- a/src/services/teams.ts +++ b/src/services/teams.ts @@ -1,21 +1,12 @@ -import { AppwriteException, Client, type ClientAuth, type ServerAuth, type Payload } from '../client'; +import { Service } from '../service'; +import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; import type { Models } from '../models'; -type TeamsServerOnlyMethod = never; -type TeamsClientOnlyMethod = never; +export class Teams { + client: Client; -export type Teams<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> = - TAuth extends ClientAuth - ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsServerOnlyMethod> - : TAuth extends ServerAuth - ? Omit<TeamsRuntime<TAuth>, 'client' | TeamsClientOnlyMethod> - : Omit<TeamsRuntime<TAuth>, 'client'>; - -class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth> { - client: Client<TAuth>; - - constructor(client: Client<TAuth>) { + constructor(client: Client) { this.client = client; } @@ -75,6 +66,8 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -147,7 +140,9 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -199,6 +194,8 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -261,7 +258,9 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -313,6 +312,7 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -387,6 +387,8 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -498,7 +500,9 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -558,6 +562,8 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -629,7 +635,9 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -689,6 +697,7 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', } @@ -775,7 +784,9 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -827,6 +838,8 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, + 'accept': 'application/json', } return this.client.call( @@ -889,7 +902,9 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu const uri = new URL(this.client.config.endpoint + apiPath); const apiHeaders: { [header: string]: string } = { + 'X-Appwrite-Project': this.client.config.project, 'content-type': 'application/json', + 'accept': 'application/json', } return this.client.call( @@ -900,9 +915,3 @@ class TeamsRuntime<TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAu ); } } - -const Teams = TeamsRuntime as unknown as { - new <TAuth extends ClientAuth | ServerAuth = ClientAuth | ServerAuth>(client: Client<TAuth>): Teams<TAuth>; -}; - -export { Teams }; diff --git a/src/services/tokens.ts b/src/services/tokens.ts deleted file mode 100644 index eb904d5c..00000000 --- a/src/services/tokens.ts +++ /dev/null @@ -1,322 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Tokens = Omit<TokensRuntime, 'client'>; - -class TokensRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Tokens = TokensRuntime as unknown as { - new (client: Client<ServerAuth>): Tokens; -}; - -export { Tokens }; diff --git a/src/services/usage.ts b/src/services/usage.ts deleted file mode 100644 index faadcdb5..00000000 --- a/src/services/usage.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Usage = Omit<UsageRuntime, 'client'>; - -class UsageRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Usage = UsageRuntime as unknown as { - new (client: Client<ServerAuth>): Usage; -}; - -export { Usage }; diff --git a/src/services/users.ts b/src/services/users.ts deleted file mode 100644 index 46e89596..00000000 --- a/src/services/users.ts +++ /dev/null @@ -1,3277 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } 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 type Users = Omit<UsersRuntime, 'client'>; - -class UsersRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Users = UsersRuntime as unknown as { - new (client: Client<ServerAuth>): Users; -}; - -export { Users }; diff --git a/src/services/webhooks.ts b/src/services/webhooks.ts deleted file mode 100644 index 4347018b..00000000 --- a/src/services/webhooks.ts +++ /dev/null @@ -1,473 +0,0 @@ -import { AppwriteException, Client, type ServerAuth, type Payload } from '../client'; -import type { Models } from '../models'; - - -export type Webhooks = Omit<WebhooksRuntime, 'client'>; - -class WebhooksRuntime { - client: Client<ServerAuth>; - - constructor(client: Client<ServerAuth>) { - 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 - ); - } -} - -const Webhooks = WebhooksRuntime as unknown as { - new (client: Client<ServerAuth>): Webhooks; -}; - -export { Webhooks }; From cebf61a40f591ec05f0266feaeb5730c5713728f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Mon, 8 Jun 2026 11:25:43 +0530 Subject: [PATCH 08/12] chore: update Web SDK to 26.0.0 --- CHANGELOG.md | 3 - docs/examples/apps/create-secret.md | 15 - docs/examples/apps/create.md | 21 - docs/examples/apps/delete-secret.md | 16 - docs/examples/apps/delete-tokens.md | 15 - docs/examples/apps/delete.md | 15 - docs/examples/apps/get-secret.md | 16 - docs/examples/apps/get.md | 15 - docs/examples/apps/list-secrets.md | 17 - docs/examples/apps/list.md | 16 - docs/examples/apps/update-team.md | 16 - docs/examples/apps/update.md | 20 - docs/examples/oauth2/approve.md | 17 - docs/examples/oauth2/authorize.md | 26 - docs/examples/oauth2/create-grant.md | 16 - docs/examples/oauth2/get-grant.md | 16 - docs/examples/oauth2/reject.md | 16 - src/index.ts | 2 - src/models.ts | 246 --------- src/services/apps.ts | 743 --------------------------- src/services/oauth-2.ts | 418 --------------- 21 files changed, 1685 deletions(-) delete mode 100644 docs/examples/apps/create-secret.md delete mode 100644 docs/examples/apps/create.md delete mode 100644 docs/examples/apps/delete-secret.md delete mode 100644 docs/examples/apps/delete-tokens.md delete mode 100644 docs/examples/apps/delete.md delete mode 100644 docs/examples/apps/get-secret.md delete mode 100644 docs/examples/apps/get.md delete mode 100644 docs/examples/apps/list-secrets.md delete mode 100644 docs/examples/apps/list.md delete mode 100644 docs/examples/apps/update-team.md delete mode 100644 docs/examples/apps/update.md delete mode 100644 docs/examples/oauth2/approve.md delete mode 100644 docs/examples/oauth2/authorize.md delete mode 100644 docs/examples/oauth2/create-grant.md delete mode 100644 docs/examples/oauth2/get-grant.md delete mode 100644 docs/examples/oauth2/reject.md delete mode 100644 src/services/apps.ts delete mode 100644 src/services/oauth-2.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index c4df246d..adf929ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,6 @@ * Breaking: Removed `Client.setKey()` and `Client.setForwardedUserAgent()` methods. * Breaking: Renamed `Theme` enum to `BrowserTheme`, changing `avatars.getScreenshot()` `theme` param type. * Breaking: Made `presences` `list`/`get`/`upsert`/`update` non-generic and removed `Models.DefaultPresence`. -* Added: `apps` and `oauth2` services for application and OAuth2 management. -* Added: `App`, `AppSecret`, `AppSecretPlaintext`, `AppsList`, and `AppSecretList` models. -* Added: `Oauth2Authorize`, `Oauth2Approve`, `Oauth2Reject`, and `Oauth2Grant` models. * Added: Email metadata fields to `User` (`emailCanonical`, `emailIsFree`, `emailIsDisposable`, `emailIsCorporate`, `emailIsCanonical`). * Added: `Membership.userAccessedAt` and `Presence.metadata` fields. diff --git a/docs/examples/apps/create-secret.md b/docs/examples/apps/create-secret.md deleted file mode 100644 index 05d0e230..00000000 --- a/docs/examples/apps/create-secret.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.createSecret({ - appId: '<APP_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/apps/create.md b/docs/examples/apps/create.md deleted file mode 100644 index 411ae776..00000000 --- a/docs/examples/apps/create.md +++ /dev/null @@ -1,21 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.create({ - appId: '<APP_ID>', - name: '<NAME>', - redirectUris: [], - enabled: false, // optional - type: 'public', // optional - deviceFlow: false, // optional - teamId: '<TEAM_ID>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/apps/delete-secret.md b/docs/examples/apps/delete-secret.md deleted file mode 100644 index 7f69d060..00000000 --- a/docs/examples/apps/delete-secret.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.deleteSecret({ - appId: '<APP_ID>', - secretId: '<SECRET_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/apps/delete-tokens.md b/docs/examples/apps/delete-tokens.md deleted file mode 100644 index 8058f32b..00000000 --- a/docs/examples/apps/delete-tokens.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.deleteTokens({ - appId: '<APP_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/apps/delete.md b/docs/examples/apps/delete.md deleted file mode 100644 index 80b9d75f..00000000 --- a/docs/examples/apps/delete.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.delete({ - appId: '<APP_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/apps/get-secret.md b/docs/examples/apps/get-secret.md deleted file mode 100644 index aceb0f8f..00000000 --- a/docs/examples/apps/get-secret.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.getSecret({ - appId: '<APP_ID>', - secretId: '<SECRET_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/apps/get.md b/docs/examples/apps/get.md deleted file mode 100644 index 140f43c4..00000000 --- a/docs/examples/apps/get.md +++ /dev/null @@ -1,15 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.get({ - appId: '<APP_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/apps/list-secrets.md b/docs/examples/apps/list-secrets.md deleted file mode 100644 index a536aeec..00000000 --- a/docs/examples/apps/list-secrets.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.listSecrets({ - appId: '<APP_ID>', - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/apps/list.md b/docs/examples/apps/list.md deleted file mode 100644 index cb64b923..00000000 --- a/docs/examples/apps/list.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.list({ - queries: [], // optional - total: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/apps/update-team.md b/docs/examples/apps/update-team.md deleted file mode 100644 index 6dcdb5db..00000000 --- a/docs/examples/apps/update-team.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.updateTeam({ - appId: '<APP_ID>', - teamId: '<TEAM_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/apps/update.md b/docs/examples/apps/update.md deleted file mode 100644 index 54e42c3f..00000000 --- a/docs/examples/apps/update.md +++ /dev/null @@ -1,20 +0,0 @@ -```javascript -import { Client, Apps } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const apps = new Apps(client); - -const result = await apps.update({ - appId: '<APP_ID>', - name: '<NAME>', - enabled: false, // optional - redirectUris: [], // optional - type: 'public', // optional - deviceFlow: false // optional -}); - -console.log(result); -``` diff --git a/docs/examples/oauth2/approve.md b/docs/examples/oauth2/approve.md deleted file mode 100644 index 4027d587..00000000 --- a/docs/examples/oauth2/approve.md +++ /dev/null @@ -1,17 +0,0 @@ -```javascript -import { Client, Oauth2 } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProjectQuery('<YOUR_PROJECT_ID>'); // Your project ID - -const oauth2 = new Oauth2(client); - -const result = await oauth2.approve({ - projectId: '<PROJECT_ID>', - grantId: '<GRANT_ID>', - authorizationDetails: '<AUTHORIZATION_DETAILS>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/oauth2/authorize.md b/docs/examples/oauth2/authorize.md deleted file mode 100644 index 0b9fec46..00000000 --- a/docs/examples/oauth2/authorize.md +++ /dev/null @@ -1,26 +0,0 @@ -```javascript -import { Client, Oauth2 } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProjectQuery('<YOUR_PROJECT_ID>'); // Your project ID - -const oauth2 = new Oauth2(client); - -const result = await oauth2.authorize({ - projectId: '<PROJECT_ID>', - clientId: '<CLIENT_ID>', - redirectUri: 'https://example.com', - responseType: 'code', - scope: '<SCOPE>', - state: '<STATE>', // optional - nonce: '<NONCE>', // optional - codeChallenge: '<CODE_CHALLENGE>', // optional - codeChallengeMethod: 's256', // optional - prompt: '<PROMPT>', // optional - maxAge: 0, // optional - authorizationDetails: '<AUTHORIZATION_DETAILS>' // optional -}); - -console.log(result); -``` diff --git a/docs/examples/oauth2/create-grant.md b/docs/examples/oauth2/create-grant.md deleted file mode 100644 index f29fd88a..00000000 --- a/docs/examples/oauth2/create-grant.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Oauth2 } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const oauth2 = new Oauth2(client); - -const result = await oauth2.createGrant({ - projectId: '<PROJECT_ID>', - userCode: '<USER_CODE>' -}); - -console.log(result); -``` diff --git a/docs/examples/oauth2/get-grant.md b/docs/examples/oauth2/get-grant.md deleted file mode 100644 index fcbe915d..00000000 --- a/docs/examples/oauth2/get-grant.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Oauth2 } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProject('<YOUR_PROJECT_ID>'); // Your project ID - -const oauth2 = new Oauth2(client); - -const result = await oauth2.getGrant({ - projectId: '<PROJECT_ID>', - grantId: '<GRANT_ID>' -}); - -console.log(result); -``` diff --git a/docs/examples/oauth2/reject.md b/docs/examples/oauth2/reject.md deleted file mode 100644 index 4f4644d4..00000000 --- a/docs/examples/oauth2/reject.md +++ /dev/null @@ -1,16 +0,0 @@ -```javascript -import { Client, Oauth2 } from "appwrite"; - -const client = new Client() - .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint - .setProjectQuery('<YOUR_PROJECT_ID>'); // Your project ID - -const oauth2 = new Oauth2(client); - -const result = await oauth2.reject({ - projectId: '<PROJECT_ID>', - grantId: '<GRANT_ID>' -}); - -console.log(result); -``` diff --git a/src/index.ts b/src/index.ts index eddcb150..ab6c1550 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,14 +7,12 @@ */ export { Client, Query, AppwriteException } from './client'; export { Account } from './services/account'; -export { Apps } from './services/apps'; export { Avatars } from './services/avatars'; export { Databases } from './services/databases'; export { Functions } from './services/functions'; export { Graphql } from './services/graphql'; export { Locale } from './services/locale'; export { Messaging } from './services/messaging'; -export { Oauth2 } from './services/oauth-2'; export { Presences } from './services/presences'; export { Storage } from './services/storage'; export { TablesDB } from './services/tables-db'; diff --git a/src/models.ts b/src/models.ts index 5ae75f25..3eb788c4 100644 --- a/src/models.ts +++ b/src/models.ts @@ -1476,250 +1476,4 @@ export namespace Models { */ expired: boolean; } - - /** - * App - */ - export type App = { - /** - * App ID. - */ - $id: string; - /** - * App creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * App update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * Application name. - */ - name: string; - /** - * List of authorized redirect URIs. These URIs can be used to redirect users after they authenticate. - */ - redirectUris: string[]; - /** - * Whether the app is enabled or not. - */ - enabled: boolean; - /** - * OAuth2 client type. `public` for SPAs, mobile, and native apps that cannot keep a client secret (PKCE required); `confidential` for server-side clients that authenticate with a client secret. - */ - type: string; - /** - * Whether this client may use the OAuth2 Device Authorization Grant (RFC 8628). - */ - deviceFlow: boolean; - /** - * ID of team that owns the application, if owned by team. Otherwise, user ID will be used. - */ - teamId: string; - /** - * ID of user who owns the application, if owned by user. Otherwise, team ID will be used. - */ - userId: string; - /** - * List of application secrets. - */ - secrets: AppSecret[]; - } - - /** - * AppSecret - */ - export type AppSecret = { - /** - * Secret ID. - */ - $id: string; - /** - * Secret creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Secret update time in ISO 8601 format. - */ - $updatedAt: string; - /** - * Application ID this secret belongs to. - */ - appId: string; - /** - * Hashed application client secret. - */ - secret: string; - /** - * Last few characters of the client secret, used to help identify it. - */ - hint: string; - /** - * ID of the user who created the secret. - */ - createdById: string; - /** - * Name of the user who created the secret. - */ - createdByName: string; - /** - * Time the secret was last used for authentication in ISO 8601 format. Null if never used. - */ - lastAccessedAt?: string; - } - - /** - * AppSecretPlaintext - */ - export type AppSecretPlaintext = { - /** - * Secret ID. - */ - $id: string; - /** - * Secret creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Secret update time in ISO 8601 format. - */ - $updatedAt: string; - /** - * Application ID this secret belongs to. - */ - appId: string; - /** - * Application client secret. Returned in full only when the secret is created; subsequent reads return a masked value. - */ - secret: string; - /** - * Last few characters of the client secret, used to help identify it. - */ - hint: string; - /** - * ID of the user who created the secret. - */ - createdById: string; - /** - * Name of the user who created the secret. - */ - createdByName: string; - /** - * Time the secret was last used for authentication in ISO 8601 format. Null if never used. - */ - lastAccessedAt?: string; - } - - /** - * OAuth2 Authorize - */ - export type Oauth2Authorize = { - /** - * OAuth2 grant ID. Set when the user must give explicit consent; pass it to the approve or reject endpoint. Empty when a redirect URL is returned instead. - */ - grantId: string; - /** - * URL the end user should be redirected to when the flow can complete without consent. Empty when consent is still required. - */ - redirectUrl: string; - } - - /** - * OAuth2 Approve - */ - export type Oauth2Approve = { - /** - * URL the end user should be redirected to after the grant is approved, carrying the authorization `code` and/or `id_token` along with the original `state`. - */ - redirectUrl: string; - } - - /** - * OAuth2 Reject - */ - export type Oauth2Reject = { - /** - * URL the end user should be redirected to after the grant is rejected, carrying an `access_denied` error. - */ - redirectUrl: string; - } - - /** - * OAuth2 Grant - */ - export type Oauth2Grant = { - /** - * Grant ID. - */ - $id: string; - /** - * Grant creation time in ISO 8601 format. - */ - $createdAt: string; - /** - * Grant update date in ISO 8601 format. - */ - $updatedAt: string; - /** - * ID of the user the grant belongs to. - */ - userId: string; - /** - * ID of the OAuth2 client (app) the grant was requested for. - */ - appId: string; - /** - * Requested OAuth2 scopes the user is being asked to consent to. - */ - scopes: string[]; - /** - * Requested authorization_details the user is being asked to consent to, as a JSON string. Each entry has a `type` plus project-defined fields. - */ - authorizationDetails: string; - /** - * OIDC prompt directive the consent screen should honor. Space-separated list of: login, consent, select_account. - */ - prompt: string; - /** - * Redirect URI the user will be sent to after the flow completes. - */ - redirectUri: string; - /** - * Unix timestamp of when the user last authenticated. - */ - authTime: number; - /** - * Grant expiration time in ISO 8601 format. - */ - expire: string; - } - - /** - * Apps list - */ - export type AppsList = { - /** - * Total number of apps that matched your query. - */ - total: number; - /** - * List of apps. - */ - apps: App[]; - } - - /** - * App secrets list - */ - export type AppSecretList = { - /** - * Total number of secrets that matched your query. - */ - total: number; - /** - * List of secrets. - */ - secrets: AppSecret[]; - } } diff --git a/src/services/apps.ts b/src/services/apps.ts deleted file mode 100644 index 657e78ef..00000000 --- a/src/services/apps.ts +++ /dev/null @@ -1,743 +0,0 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -export class Apps { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * List applications. - * - * @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 {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.AppsList>} - */ - list(params?: { queries?: string[], total?: boolean }): Promise<Models.AppsList>; - /** - * List applications. - * - * @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 {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.AppsList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - list(queries?: string[], total?: boolean): Promise<Models.AppsList>; - list( - paramsOrFirst?: { queries?: string[], total?: boolean } | string[], - ...rest: [(boolean)?] - ): Promise<Models.AppsList> { - 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 = '/apps'; - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new application. - * - * @param {string} params.appId - Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid 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 - Application name. - * @param {string[]} params.redirectUris - Redirect URIs (array of valid URLs). - * @param {boolean} params.enabled - Is application enabled? - * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. - * @param {boolean} params.deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - * @param {string} params.teamId - Team unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - */ - create(params: { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }): Promise<Models.App>; - /** - * Create a new application. - * - * @param {string} appId - Application ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid 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 - Application name. - * @param {string[]} redirectUris - Redirect URIs (array of valid URLs). - * @param {boolean} enabled - Is application enabled? - * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. - * @param {boolean} deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - * @param {string} teamId - Team unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - create(appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string): Promise<Models.App>; - create( - paramsOrFirst: { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string } | string, - ...rest: [(string)?, (string[])?, (boolean)?, (string)?, (boolean)?, (string)?] - ): Promise<Models.App> { - let params: { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, name: string, redirectUris: string[], enabled?: boolean, type?: string, deviceFlow?: boolean, teamId?: string }; - } else { - params = { - appId: paramsOrFirst as string, - name: rest[0] as string, - redirectUris: rest[1] as string[], - enabled: rest[2] as boolean, - type: rest[3] as string, - deviceFlow: rest[4] as boolean, - teamId: rest[5] as string - }; - } - - const appId = params.appId; - const name = params.name; - const redirectUris = params.redirectUris; - const enabled = params.enabled; - const type = params.type; - const deviceFlow = params.deviceFlow; - const teamId = params.teamId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - if (typeof redirectUris === 'undefined') { - throw new AppwriteException('Missing required parameter: "redirectUris"'); - } - - const apiPath = '/apps'; - const payload: Payload = {}; - if (typeof appId !== 'undefined') { - payload['appId'] = appId; - } - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof redirectUris !== 'undefined') { - payload['redirectUris'] = redirectUris; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof deviceFlow !== 'undefined') { - payload['deviceFlow'] = deviceFlow; - } - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get an application by its unique ID. - * - * @param {string} params.appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - */ - get(params: { appId: string }): Promise<Models.App>; - /** - * Get an application by its unique ID. - * - * @param {string} appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - get(appId: string): Promise<Models.App>; - get( - paramsOrFirst: { appId: string } | string - ): Promise<Models.App> { - let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string }; - } else { - params = { - appId: paramsOrFirst as string - }; - } - - const appId = params.appId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - - const apiPath = '/apps/{appId}'.replace('{appId}', appId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Update an application by its unique ID. - * - * @param {string} params.appId - Application unique ID. - * @param {string} params.name - Application name. - * @param {boolean} params.enabled - Is application enabled? - * @param {string[]} params.redirectUris - Redirect URIs (array of valid URLs). - * @param {string} params.type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. - * @param {boolean} params.deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - */ - update(params: { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean }): Promise<Models.App>; - /** - * Update an application by its unique ID. - * - * @param {string} appId - Application unique ID. - * @param {string} name - Application name. - * @param {boolean} enabled - Is application enabled? - * @param {string[]} redirectUris - Redirect URIs (array of valid URLs). - * @param {string} type - OAuth2 client type. Use `public` for SPAs, mobile, and native apps that cannot keep a `client_secret` — PKCE is then required at the token endpoint. Use `confidential` for server-side clients that present a `client_secret`. Defaults to `confidential`. - * @param {boolean} deviceFlow - Allow this client to use the OAuth2 Device Authorization Grant (RFC 8628) for input-constrained devices such as TVs and CLIs. Defaults to false. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - update(appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean): Promise<Models.App>; - update( - paramsOrFirst: { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean } | string, - ...rest: [(string)?, (boolean)?, (string[])?, (string)?, (boolean)?] - ): Promise<Models.App> { - let params: { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, name: string, enabled?: boolean, redirectUris?: string[], type?: string, deviceFlow?: boolean }; - } else { - params = { - appId: paramsOrFirst as string, - name: rest[0] as string, - enabled: rest[1] as boolean, - redirectUris: rest[2] as string[], - type: rest[3] as string, - deviceFlow: rest[4] as boolean - }; - } - - const appId = params.appId; - const name = params.name; - const enabled = params.enabled; - const redirectUris = params.redirectUris; - const type = params.type; - const deviceFlow = params.deviceFlow; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - if (typeof name === 'undefined') { - throw new AppwriteException('Missing required parameter: "name"'); - } - - const apiPath = '/apps/{appId}'.replace('{appId}', appId); - const payload: Payload = {}; - if (typeof name !== 'undefined') { - payload['name'] = name; - } - if (typeof enabled !== 'undefined') { - payload['enabled'] = enabled; - } - if (typeof redirectUris !== 'undefined') { - payload['redirectUris'] = redirectUris; - } - if (typeof type !== 'undefined') { - payload['type'] = type; - } - if (typeof deviceFlow !== 'undefined') { - payload['deviceFlow'] = deviceFlow; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'put', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete an application by its unique ID. - * - * @param {string} params.appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - delete(params: { appId: string }): Promise<{}>; - /** - * Delete an application by its unique ID. - * - * @param {string} appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - delete(appId: string): Promise<{}>; - delete( - paramsOrFirst: { appId: string } | string - ): Promise<{}> { - let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string }; - } else { - params = { - appId: paramsOrFirst as string - }; - } - - const appId = params.appId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - - const apiPath = '/apps/{appId}'.replace('{appId}', appId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * List client secrets for an application. - * - * @param {string} params.appId - Application 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. - * @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.AppSecretList>} - */ - listSecrets(params: { appId: string, queries?: string[], total?: boolean }): Promise<Models.AppSecretList>; - /** - * List client secrets for an application. - * - * @param {string} appId - Application 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. - * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated. - * @throws {AppwriteException} - * @returns {Promise<Models.AppSecretList>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - listSecrets(appId: string, queries?: string[], total?: boolean): Promise<Models.AppSecretList>; - listSecrets( - paramsOrFirst: { appId: string, queries?: string[], total?: boolean } | string, - ...rest: [(string[])?, (boolean)?] - ): Promise<Models.AppSecretList> { - let params: { appId: string, queries?: string[], total?: boolean }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, queries?: string[], total?: boolean }; - } else { - params = { - appId: paramsOrFirst as string, - queries: rest[0] as string[], - total: rest[1] as boolean - }; - } - - const appId = params.appId; - const queries = params.queries; - const total = params.total; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - - const apiPath = '/apps/{appId}/secrets'.replace('{appId}', appId); - 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 } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Create a new client secret for an application. - * - * @param {string} params.appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.AppSecretPlaintext>} - */ - createSecret(params: { appId: string }): Promise<Models.AppSecretPlaintext>; - /** - * Create a new client secret for an application. - * - * @param {string} appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.AppSecretPlaintext>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createSecret(appId: string): Promise<Models.AppSecretPlaintext>; - createSecret( - paramsOrFirst: { appId: string } | string - ): Promise<Models.AppSecretPlaintext> { - let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string }; - } else { - params = { - appId: paramsOrFirst as string - }; - } - - const appId = params.appId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - - const apiPath = '/apps/{appId}/secrets'.replace('{appId}', appId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get an application client secret by its unique ID. - * - * @param {string} params.appId - Application unique ID. - * @param {string} params.secretId - Secret unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.AppSecret>} - */ - getSecret(params: { appId: string, secretId: string }): Promise<Models.AppSecret>; - /** - * Get an application client secret by its unique ID. - * - * @param {string} appId - Application unique ID. - * @param {string} secretId - Secret unique ID. - * @throws {AppwriteException} - * @returns {Promise<Models.AppSecret>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getSecret(appId: string, secretId: string): Promise<Models.AppSecret>; - getSecret( - paramsOrFirst: { appId: string, secretId: string } | string, - ...rest: [(string)?] - ): Promise<Models.AppSecret> { - let params: { appId: string, secretId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, secretId: string }; - } else { - params = { - appId: paramsOrFirst as string, - secretId: rest[0] as string - }; - } - - const appId = params.appId; - const secretId = params.secretId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - if (typeof secretId === 'undefined') { - throw new AppwriteException('Missing required parameter: "secretId"'); - } - - const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', appId).replace('{secretId}', secretId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Delete an application client secret by its unique ID. - * - * @param {string} params.appId - Application unique ID. - * @param {string} params.secretId - Secret unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteSecret(params: { appId: string, secretId: string }): Promise<{}>; - /** - * Delete an application client secret by its unique ID. - * - * @param {string} appId - Application unique ID. - * @param {string} secretId - Secret unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteSecret(appId: string, secretId: string): Promise<{}>; - deleteSecret( - paramsOrFirst: { appId: string, secretId: string } | string, - ...rest: [(string)?] - ): Promise<{}> { - let params: { appId: string, secretId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, secretId: string }; - } else { - params = { - appId: paramsOrFirst as string, - secretId: rest[0] as string - }; - } - - const appId = params.appId; - const secretId = params.secretId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - if (typeof secretId === 'undefined') { - throw new AppwriteException('Missing required parameter: "secretId"'); - } - - const apiPath = '/apps/{appId}/secrets/{secretId}'.replace('{appId}', appId).replace('{secretId}', secretId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } - - /** - * Transfer an application to another team by its unique ID. - * - * @param {string} params.appId - Application unique ID. - * @param {string} params.teamId - Team ID of the team to transfer application to. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - */ - updateTeam(params: { appId: string, teamId: string }): Promise<Models.App>; - /** - * Transfer an application to another team by its unique ID. - * - * @param {string} appId - Application unique ID. - * @param {string} teamId - Team ID of the team to transfer application to. - * @throws {AppwriteException} - * @returns {Promise<Models.App>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - updateTeam(appId: string, teamId: string): Promise<Models.App>; - updateTeam( - paramsOrFirst: { appId: string, teamId: string } | string, - ...rest: [(string)?] - ): Promise<Models.App> { - let params: { appId: string, teamId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string, teamId: string }; - } else { - params = { - appId: paramsOrFirst as string, - teamId: rest[0] as string - }; - } - - const appId = params.appId; - const teamId = params.teamId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - if (typeof teamId === 'undefined') { - throw new AppwriteException('Missing required parameter: "teamId"'); - } - - const apiPath = '/apps/{appId}/team'.replace('{appId}', appId); - const payload: Payload = {}; - if (typeof teamId !== 'undefined') { - payload['teamId'] = teamId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'patch', - uri, - apiHeaders, - payload - ); - } - - /** - * Revoke all tokens for an application by its unique ID. - * - * @param {string} params.appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - */ - deleteTokens(params: { appId: string }): Promise<{}>; - /** - * Revoke all tokens for an application by its unique ID. - * - * @param {string} appId - Application unique ID. - * @throws {AppwriteException} - * @returns {Promise<{}>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - deleteTokens(appId: string): Promise<{}>; - deleteTokens( - paramsOrFirst: { appId: string } | string - ): Promise<{}> { - let params: { appId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { appId: string }; - } else { - params = { - appId: paramsOrFirst as string - }; - } - - const appId = params.appId; - - if (typeof appId === 'undefined') { - throw new AppwriteException('Missing required parameter: "appId"'); - } - - const apiPath = '/apps/{appId}/tokens'.replace('{appId}', appId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'delete', - uri, - apiHeaders, - payload - ); - } -} diff --git a/src/services/oauth-2.ts b/src/services/oauth-2.ts deleted file mode 100644 index d3f2b53b..00000000 --- a/src/services/oauth-2.ts +++ /dev/null @@ -1,418 +0,0 @@ -import { Service } from '../service'; -import { AppwriteException, Client, type Payload, UploadProgress } from '../client'; -import type { Models } from '../models'; - - -export class Oauth2 { - client: Client; - - constructor(client: Client) { - this.client = client; - } - - /** - * Approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. - * - * @param {string} params.projectId - Project ID in which OAuth2 client that created grant during authorization exists. - * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. - * @param {string} params.authorizationDetails - Enriched `authorization_details` the user consented to, replacing what the client requested. Each entry must use a `type` the project accepts. Optional; omit to keep the originally requested details. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Approve>} - */ - approve(params: { projectId: string, grantId: string, authorizationDetails?: string }): Promise<Models.Oauth2Approve>; - /** - * Approve an OAuth2 grant after the user gives consent. Returns the `redirectUrl` the end user should be sent to. The consent screen may optionally pass enriched `authorization_details` to record the concrete resources the user selected. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. - * - * @param {string} projectId - Project ID in which OAuth2 client that created grant during authorization exists. - * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. - * @param {string} authorizationDetails - Enriched `authorization_details` the user consented to, replacing what the client requested. Each entry must use a `type` the project accepts. Optional; omit to keep the originally requested details. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Approve>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - approve(projectId: string, grantId: string, authorizationDetails?: string): Promise<Models.Oauth2Approve>; - approve( - paramsOrFirst: { projectId: string, grantId: string, authorizationDetails?: string } | string, - ...rest: [(string)?, (string)?] - ): Promise<Models.Oauth2Approve> { - let params: { projectId: string, grantId: string, authorizationDetails?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, grantId: string, authorizationDetails?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - grantId: rest[0] as string, - authorizationDetails: rest[1] as string - }; - } - - const projectId = params.projectId; - const grantId = params.grantId; - const authorizationDetails = params.authorizationDetails; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof grantId === 'undefined') { - throw new AppwriteException('Missing required parameter: "grantId"'); - } - - const apiPath = '/oauth2/{project_id}/approve'.replace('{project_id}', projectId); - const payload: Payload = {}; - if (typeof grantId !== 'undefined') { - payload['grant_id'] = grantId; - } - if (typeof authorizationDetails !== 'undefined') { - payload['authorization_details'] = authorizationDetails; - } - const uri = new URL(this.client.config.endpoint + apiPath); - uri.searchParams.append('project', this.client.config.project); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. - * - * @param {string} params.projectId - Project ID in which OAuth2 client exists. - * @param {string} params.clientId - OAuth2 client ID. - * @param {string} params.redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. - * @param {string} params.responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). - * @param {string} params.scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`. - * @param {string} params.state - OAuth2 state. You receive this back in the redirect URI. - * @param {string} params.nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. - * @param {string} params.codeChallenge - PKCE code challenge. Required when OAuth2 app is public. - * @param {string} params.codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. - * @param {string} params.prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. - * @param {number} params.maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. - * @param {string} params.authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Authorize>} - */ - authorize(params: { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string }): Promise<Models.Oauth2Authorize>; - /** - * Begin the OAuth2 authorization flow. When called without a session, the user is redirected to the consent screen without grant ID. When called with a session, the redirect URL includes param for grant ID. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. - * - * @param {string} projectId - Project ID in which OAuth2 client exists. - * @param {string} clientId - OAuth2 client ID. - * @param {string} redirectUri - Redirect URI where visitor will be redirected after authorization, whether successful or not. - * @param {string} responseType - OAuth2 / OIDC response type. One of `code` (Authorization Code Flow), `id_token` (Implicit Flow, OIDC login only), or `code id_token` (Hybrid Flow). - * @param {string} scope - Space-separated OAuth2 scopes. Can include project scopes, and built-in scopes: `openid`, `email`, `profile`. - * @param {string} state - OAuth2 state. You receive this back in the redirect URI. - * @param {string} nonce - OIDC nonce parameter to prevent replay attacks. Required when response_type includes `id_token`. - * @param {string} codeChallenge - PKCE code challenge. Required when OAuth2 app is public. - * @param {string} codeChallengeMethod - PKCE code challenge method. Required when OAuth2 app is public. - * @param {string} prompt - OIDC prompt parameter for customization of consent screen. Space-separated list of: none, login, consent, select_account. - * @param {number} maxAge - OIDC max_age paraleter for customization of consent screen. Maximum allowable elapsed time in seconds since the user last authenticated. If exceeded, re-authentication is required. - * @param {string} authorizationDetails - Rich authorization request. JSON array of objects, each with a `type` and project-defined fields - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Authorize>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - authorize(projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string): Promise<Models.Oauth2Authorize>; - authorize( - paramsOrFirst: { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string } | string, - ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (string)?, (number)?, (string)?] - ): Promise<Models.Oauth2Authorize> { - let params: { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, clientId: string, redirectUri: string, responseType: string, scope: string, state?: string, nonce?: string, codeChallenge?: string, codeChallengeMethod?: string, prompt?: string, maxAge?: number, authorizationDetails?: string }; - } else { - params = { - projectId: paramsOrFirst as string, - clientId: rest[0] as string, - redirectUri: rest[1] as string, - responseType: rest[2] as string, - scope: rest[3] as string, - state: rest[4] as string, - nonce: rest[5] as string, - codeChallenge: rest[6] as string, - codeChallengeMethod: rest[7] as string, - prompt: rest[8] as string, - maxAge: rest[9] as number, - authorizationDetails: rest[10] as string - }; - } - - const projectId = params.projectId; - const clientId = params.clientId; - const redirectUri = params.redirectUri; - const responseType = params.responseType; - const scope = params.scope; - const state = params.state; - const nonce = params.nonce; - const codeChallenge = params.codeChallenge; - const codeChallengeMethod = params.codeChallengeMethod; - const prompt = params.prompt; - const maxAge = params.maxAge; - const authorizationDetails = params.authorizationDetails; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof clientId === 'undefined') { - throw new AppwriteException('Missing required parameter: "clientId"'); - } - if (typeof redirectUri === 'undefined') { - throw new AppwriteException('Missing required parameter: "redirectUri"'); - } - if (typeof responseType === 'undefined') { - throw new AppwriteException('Missing required parameter: "responseType"'); - } - if (typeof scope === 'undefined') { - throw new AppwriteException('Missing required parameter: "scope"'); - } - - const apiPath = '/oauth2/{project_id}/authorize'.replace('{project_id}', projectId); - const payload: Payload = {}; - if (typeof clientId !== 'undefined') { - payload['client_id'] = clientId; - } - if (typeof redirectUri !== 'undefined') { - payload['redirect_uri'] = redirectUri; - } - if (typeof responseType !== 'undefined') { - payload['response_type'] = responseType; - } - if (typeof scope !== 'undefined') { - payload['scope'] = scope; - } - if (typeof state !== 'undefined') { - payload['state'] = state; - } - if (typeof nonce !== 'undefined') { - payload['nonce'] = nonce; - } - if (typeof codeChallenge !== 'undefined') { - payload['code_challenge'] = codeChallenge; - } - if (typeof codeChallengeMethod !== 'undefined') { - payload['code_challenge_method'] = codeChallengeMethod; - } - if (typeof prompt !== 'undefined') { - payload['prompt'] = prompt; - } - if (typeof maxAge !== 'undefined') { - payload['max_age'] = maxAge; - } - if (typeof authorizationDetails !== 'undefined') { - payload['authorization_details'] = authorizationDetails; - } - const uri = new URL(this.client.config.endpoint + apiPath); - uri.searchParams.append('project', this.client.config.project); - - const apiHeaders: { [header: string]: string } = { - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow. - * - * @param {string} params.projectId - Project ID in which OAuth2 client exists. - * @param {string} params.userCode - User code displayed on the device. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Grant>} - */ - createGrant(params: { projectId: string, userCode: string }): Promise<Models.Oauth2Grant>; - /** - * Exchange a device flow user code for an OAuth2 grant. The authenticated user is bound to the pending grant. Pass the returned grant ID to the get grant endpoint to render the consent screen, then to the approve or reject endpoint to complete the flow. - * - * @param {string} projectId - Project ID in which OAuth2 client exists. - * @param {string} userCode - User code displayed on the device. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Grant>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - createGrant(projectId: string, userCode: string): Promise<Models.Oauth2Grant>; - createGrant( - paramsOrFirst: { projectId: string, userCode: string } | string, - ...rest: [(string)?] - ): Promise<Models.Oauth2Grant> { - let params: { projectId: string, userCode: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, userCode: string }; - } else { - params = { - projectId: paramsOrFirst as string, - userCode: rest[0] as string - }; - } - - const projectId = params.projectId; - const userCode = params.userCode; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof userCode === 'undefined') { - throw new AppwriteException('Missing required parameter: "userCode"'); - } - - const apiPath = '/oauth2/{project_id}/grants'.replace('{project_id}', projectId); - const payload: Payload = {}; - if (typeof userCode !== 'undefined') { - payload['user_code'] = userCode; - } - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } - - /** - * Get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK. - * - * @param {string} params.projectId - Project ID in which OAuth2 client that created grant during authorization exists. - * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Grant>} - */ - getGrant(params: { projectId: string, grantId: string }): Promise<Models.Oauth2Grant>; - /** - * Get an OAuth2 grant by its ID. Used by the consent screen to display the details of the authorization the user is being asked to approve. A grant can only be read by the user it belongs to, or by server SDK. - * - * @param {string} projectId - Project ID in which OAuth2 client that created grant during authorization exists. - * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Grant>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - getGrant(projectId: string, grantId: string): Promise<Models.Oauth2Grant>; - getGrant( - paramsOrFirst: { projectId: string, grantId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Oauth2Grant> { - let params: { projectId: string, grantId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, grantId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - grantId: rest[0] as string - }; - } - - const projectId = params.projectId; - const grantId = params.grantId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof grantId === 'undefined') { - throw new AppwriteException('Missing required parameter: "grantId"'); - } - - const apiPath = '/oauth2/{project_id}/grants/{grant_id}'.replace('{project_id}', projectId).replace('{grant_id}', grantId); - const payload: Payload = {}; - const uri = new URL(this.client.config.endpoint + apiPath); - - const apiHeaders: { [header: string]: string } = { - 'X-Appwrite-Project': this.client.config.project, - 'accept': 'application/json', - } - - return this.client.call( - 'get', - uri, - apiHeaders, - payload - ); - } - - /** - * Reject an OAuth2 grant when the user denies consent. Returns the `redirectUrl` the end user should be sent to with an `access_denied` error. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. - * - * @param {string} params.projectId - Project ID in which OAuth2 client that created grant during authorization exists. - * @param {string} params.grantId - Grant ID made during authorization, provided to consent screen in URL search params. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Reject>} - */ - reject(params: { projectId: string, grantId: string }): Promise<Models.Oauth2Reject>; - /** - * Reject an OAuth2 grant when the user denies consent. Returns the `redirectUrl` the end user should be sent to with an `access_denied` error. You can pass Accept header of `application/json` to receive a JSON response instead of a redirect. - * - * @param {string} projectId - Project ID in which OAuth2 client that created grant during authorization exists. - * @param {string} grantId - Grant ID made during authorization, provided to consent screen in URL search params. - * @throws {AppwriteException} - * @returns {Promise<Models.Oauth2Reject>} - * @deprecated Use the object parameter style method for a better developer experience. - */ - reject(projectId: string, grantId: string): Promise<Models.Oauth2Reject>; - reject( - paramsOrFirst: { projectId: string, grantId: string } | string, - ...rest: [(string)?] - ): Promise<Models.Oauth2Reject> { - let params: { projectId: string, grantId: string }; - - if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) { - params = (paramsOrFirst || {}) as { projectId: string, grantId: string }; - } else { - params = { - projectId: paramsOrFirst as string, - grantId: rest[0] as string - }; - } - - const projectId = params.projectId; - const grantId = params.grantId; - - if (typeof projectId === 'undefined') { - throw new AppwriteException('Missing required parameter: "projectId"'); - } - if (typeof grantId === 'undefined') { - throw new AppwriteException('Missing required parameter: "grantId"'); - } - - const apiPath = '/oauth2/{project_id}/reject'.replace('{project_id}', projectId); - const payload: Payload = {}; - if (typeof grantId !== 'undefined') { - payload['grant_id'] = grantId; - } - const uri = new URL(this.client.config.endpoint + apiPath); - uri.searchParams.append('project', this.client.config.project); - - const apiHeaders: { [header: string]: string } = { - 'content-type': 'application/json', - 'accept': 'application/json', - } - - return this.client.call( - 'post', - uri, - apiHeaders, - payload - ); - } -} From ac59872f3046289716fa2dd6a4ebccc82ed9b58e Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Mon, 8 Jun 2026 11:36:58 +0530 Subject: [PATCH 09/12] docs: add accept header and toString notes to changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index adf929ae..e9da9a96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ * Breaking: Made `presences` `list`/`get`/`upsert`/`update` non-generic and removed `Models.DefaultPresence`. * Added: Email metadata fields to `User` (`emailCanonical`, `emailIsFree`, `emailIsDisposable`, `emailIsCorporate`, `emailIsCanonical`). * Added: `Membership.userAccessedAt` and `Presence.metadata` fields. +* Fixed: `toString()` on response objects now returns valid JSON via `JSONbig.stringify`, preserving large integers. +* Updated: Requests now send an explicit `accept` header matching each endpoint's response type. ## 25.1.1 From 23e05494b6fc7ccbdd46a207f9e09170cc8a591a Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Mon, 8 Jun 2026 11:58:38 +0530 Subject: [PATCH 10/12] chore: update Web SDK to 26.0.0 --- src/client.ts | 34 +--------------------------------- src/services/functions.ts | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 41 deletions(-) diff --git a/src/client.ts b/src/client.ts index c93439a0..15a03579 100644 --- a/src/client.ts +++ b/src/client.ts @@ -354,11 +354,9 @@ class Client { endpoint: string; endpointRealtime: string; project: string; - key: string; jwt: string; locale: string; session: string; - forwardeduseragent: string; devkey: string; cookie: string; impersonateuserid: string; @@ -368,11 +366,9 @@ class Client { endpoint: 'https://cloud.appwrite.io/v1', endpointRealtime: '', project: '', - key: '', jwt: '', locale: '', session: '', - forwardeduseragent: '', devkey: '', cookie: '', impersonateuserid: '', @@ -384,7 +380,7 @@ class Client { */ headers: Headers = { 'x-sdk-name': 'Web', - 'x-sdk-platform': 'server', + 'x-sdk-platform': 'client', 'x-sdk-language': 'web', 'x-sdk-version': '26.0.0', 'X-Appwrite-Response-Format': '1.9.5', @@ -459,20 +455,6 @@ class Client { 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 * @@ -513,20 +495,6 @@ class Client { 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 * diff --git a/src/services/functions.ts b/src/services/functions.ts index 533a9313..3bd9c928 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -92,7 +92,7 @@ export class Functions { * @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>; + createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string, onProgress?: (progress: UploadProgress) => void }): 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. * @@ -107,15 +107,17 @@ export class Functions { * @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(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string, onProgress?: (progress: UploadProgress) => void): 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)?] + paramsOrFirst: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string, onProgress?: (progress: UploadProgress) => void } | string, + ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?,((progress: UploadProgress) => void)?] ): Promise<Models.Execution> { let params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string }; + let onProgress: ((progress: UploadProgress) => void); 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 }; + onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); } else { params = { functionId: paramsOrFirst as string, @@ -126,6 +128,7 @@ export class Functions { headers: rest[4] as object, scheduledAt: rest[5] as string }; + onProgress = rest[6] as ((progress: UploadProgress) => void); } const functionId = params.functionId; @@ -164,15 +167,16 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'application/json', - 'accept': 'multipart/form-data', + 'content-type': 'multipart/form-data', + 'accept': 'application/json', } - return this.client.call( + return this.client.chunkedUpload( 'post', uri, apiHeaders, - payload + payload, + onProgress ); } From b3ae42d93369705508850d7fc2d9ea3b26f94709 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Mon, 8 Jun 2026 12:01:50 +0530 Subject: [PATCH 11/12] (docs): reclassify setKey removal as a fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9da9a96..fe57112a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,11 @@ ## 26.0.0 -* Breaking: Removed `Client.setKey()` and `Client.setForwardedUserAgent()` methods. * Breaking: Renamed `Theme` enum to `BrowserTheme`, changing `avatars.getScreenshot()` `theme` param type. * Breaking: Made `presences` `list`/`get`/`upsert`/`update` non-generic and removed `Models.DefaultPresence`. * Added: Email metadata fields to `User` (`emailCanonical`, `emailIsFree`, `emailIsDisposable`, `emailIsCorporate`, `emailIsCanonical`). * Added: `Membership.userAccessedAt` and `Presence.metadata` fields. +* Fixed: Removed `Client.setKey()` and `Client.setForwardedUserAgent()` methods that were exposed on the client SDK by mistake. * Fixed: `toString()` on response objects now returns valid JSON via `JSONbig.stringify`, preserving large integers. * Updated: Requests now send an explicit `accept` header matching each endpoint's response type. From eb4c2cb561ff4fc06fc3c0c56867284c44b8f401 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal <chiragaggarwal5k@gmail.com> Date: Mon, 8 Jun 2026 12:53:00 +0530 Subject: [PATCH 12/12] chore: update Web SDK to 26.0.0 --- src/services/functions.ts | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/services/functions.ts b/src/services/functions.ts index 3bd9c928..14864b79 100644 --- a/src/services/functions.ts +++ b/src/services/functions.ts @@ -92,7 +92,7 @@ export class Functions { * @throws {AppwriteException} * @returns {Promise<Models.Execution>} */ - createExecution(params: { functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string, onProgress?: (progress: UploadProgress) => void }): 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. * @@ -107,17 +107,15 @@ export class Functions { * @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, onProgress?: (progress: UploadProgress) => void): Promise<Models.Execution>; + 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, onProgress?: (progress: UploadProgress) => void } | string, - ...rest: [(string)?, (boolean)?, (string)?, (ExecutionMethod)?, (object)?, (string)?,((progress: UploadProgress) => void)?] + 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 }; - let onProgress: ((progress: UploadProgress) => void); 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 }; - onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void); } else { params = { functionId: paramsOrFirst as string, @@ -128,7 +126,6 @@ export class Functions { headers: rest[4] as object, scheduledAt: rest[5] as string }; - onProgress = rest[6] as ((progress: UploadProgress) => void); } const functionId = params.functionId; @@ -167,16 +164,15 @@ export class Functions { const apiHeaders: { [header: string]: string } = { 'X-Appwrite-Project': this.client.config.project, - 'content-type': 'multipart/form-data', + 'content-type': 'application/json', 'accept': 'application/json', } - return this.client.chunkedUpload( + return this.client.call( 'post', uri, apiHeaders, - payload, - onProgress + payload ); }