@appconda/nextjs 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/autoclose.yml +11 -0
- package/.github/workflows/publish.yml +42 -0
- package/.travis.yml +32 -0
- package/CHANGELOG.md +1 -0
- package/LICENSE +12 -0
- package/README.md +0 -0
- package/dist/cjs/sdk.js +10608 -0
- package/dist/cjs/sdk.js.map +1 -0
- package/dist/esm/sdk.js +10589 -0
- package/dist/esm/sdk.js.map +1 -0
- package/dist/iife/sdk.js +10609 -0
- package/docs/examples/account/create-anonymous-session.md +11 -0
- package/docs/examples/account/create-email-password-session.md +14 -0
- package/docs/examples/account/create-email-token.md +15 -0
- package/docs/examples/account/create-j-w-t.md +11 -0
- package/docs/examples/account/create-magic-u-r-l-token.md +16 -0
- package/docs/examples/account/create-mfa-authenticator.md +13 -0
- package/docs/examples/account/create-mfa-challenge.md +13 -0
- package/docs/examples/account/create-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/create-o-auth2session.md +15 -0
- package/docs/examples/account/create-o-auth2token.md +15 -0
- package/docs/examples/account/create-phone-token.md +14 -0
- package/docs/examples/account/create-phone-verification.md +11 -0
- package/docs/examples/account/create-push-target.md +15 -0
- package/docs/examples/account/create-recovery.md +14 -0
- package/docs/examples/account/create-session.md +14 -0
- package/docs/examples/account/create-verification.md +13 -0
- package/docs/examples/account/create.md +16 -0
- package/docs/examples/account/delete-identity.md +13 -0
- package/docs/examples/account/delete-mfa-authenticator.md +13 -0
- package/docs/examples/account/delete-push-target.md +13 -0
- package/docs/examples/account/delete-session.md +13 -0
- package/docs/examples/account/delete-sessions.md +11 -0
- package/docs/examples/account/delete.md +11 -0
- package/docs/examples/account/get-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/get-prefs.md +11 -0
- package/docs/examples/account/get-session.md +13 -0
- package/docs/examples/account/get.md +11 -0
- package/docs/examples/account/list-identities.md +13 -0
- package/docs/examples/account/list-logs.md +13 -0
- package/docs/examples/account/list-mfa-factors.md +11 -0
- package/docs/examples/account/list-sessions.md +11 -0
- package/docs/examples/account/update-email.md +14 -0
- package/docs/examples/account/update-m-f-a.md +13 -0
- package/docs/examples/account/update-magic-u-r-l-session.md +14 -0
- package/docs/examples/account/update-mfa-authenticator.md +14 -0
- package/docs/examples/account/update-mfa-challenge.md +14 -0
- package/docs/examples/account/update-mfa-recovery-codes.md +11 -0
- package/docs/examples/account/update-name.md +13 -0
- package/docs/examples/account/update-password.md +14 -0
- package/docs/examples/account/update-phone-session.md +14 -0
- package/docs/examples/account/update-phone-verification.md +14 -0
- package/docs/examples/account/update-phone.md +14 -0
- package/docs/examples/account/update-prefs.md +13 -0
- package/docs/examples/account/update-push-target.md +14 -0
- package/docs/examples/account/update-recovery.md +15 -0
- package/docs/examples/account/update-session.md +13 -0
- package/docs/examples/account/update-status.md +11 -0
- package/docs/examples/account/update-verification.md +14 -0
- package/docs/examples/assistant/chat.md +13 -0
- package/docs/examples/avatars/get-browser.md +16 -0
- package/docs/examples/avatars/get-credit-card.md +16 -0
- package/docs/examples/avatars/get-favicon.md +13 -0
- package/docs/examples/avatars/get-flag.md +16 -0
- package/docs/examples/avatars/get-image.md +15 -0
- package/docs/examples/avatars/get-initials.md +16 -0
- package/docs/examples/avatars/get-q-r.md +16 -0
- package/docs/examples/console/variables.md +11 -0
- package/docs/examples/databases/create-boolean-attribute.md +18 -0
- package/docs/examples/databases/create-collection.md +18 -0
- package/docs/examples/databases/create-datetime-attribute.md +18 -0
- package/docs/examples/databases/create-document.md +17 -0
- package/docs/examples/databases/create-email-attribute.md +18 -0
- package/docs/examples/databases/create-enum-attribute.md +19 -0
- package/docs/examples/databases/create-float-attribute.md +20 -0
- package/docs/examples/databases/create-index.md +18 -0
- package/docs/examples/databases/create-integer-attribute.md +20 -0
- package/docs/examples/databases/create-ip-attribute.md +18 -0
- package/docs/examples/databases/create-relationship-attribute.md +20 -0
- package/docs/examples/databases/create-string-attribute.md +20 -0
- package/docs/examples/databases/create-url-attribute.md +18 -0
- package/docs/examples/databases/create.md +15 -0
- package/docs/examples/databases/delete-attribute.md +15 -0
- package/docs/examples/databases/delete-collection.md +14 -0
- package/docs/examples/databases/delete-document.md +15 -0
- package/docs/examples/databases/delete-index.md +15 -0
- package/docs/examples/databases/delete.md +13 -0
- package/docs/examples/databases/get-attribute.md +15 -0
- package/docs/examples/databases/get-collection-usage.md +15 -0
- package/docs/examples/databases/get-collection.md +14 -0
- package/docs/examples/databases/get-database-usage.md +14 -0
- package/docs/examples/databases/get-document.md +16 -0
- package/docs/examples/databases/get-index.md +15 -0
- package/docs/examples/databases/get-usage.md +13 -0
- package/docs/examples/databases/get.md +13 -0
- package/docs/examples/databases/list-attributes.md +15 -0
- package/docs/examples/databases/list-collection-logs.md +15 -0
- package/docs/examples/databases/list-collections.md +15 -0
- package/docs/examples/databases/list-document-logs.md +16 -0
- package/docs/examples/databases/list-documents.md +15 -0
- package/docs/examples/databases/list-indexes.md +15 -0
- package/docs/examples/databases/list-logs.md +14 -0
- package/docs/examples/databases/list.md +14 -0
- package/docs/examples/databases/update-boolean-attribute.md +17 -0
- package/docs/examples/databases/update-collection.md +18 -0
- package/docs/examples/databases/update-datetime-attribute.md +17 -0
- package/docs/examples/databases/update-document.md +17 -0
- package/docs/examples/databases/update-email-attribute.md +17 -0
- package/docs/examples/databases/update-enum-attribute.md +18 -0
- package/docs/examples/databases/update-float-attribute.md +19 -0
- package/docs/examples/databases/update-integer-attribute.md +19 -0
- package/docs/examples/databases/update-ip-attribute.md +17 -0
- package/docs/examples/databases/update-relationship-attribute.md +16 -0
- package/docs/examples/databases/update-string-attribute.md +17 -0
- package/docs/examples/databases/update-url-attribute.md +17 -0
- package/docs/examples/databases/update.md +15 -0
- package/docs/examples/functions/create-build.md +15 -0
- package/docs/examples/functions/create-deployment.md +17 -0
- package/docs/examples/functions/create-execution.md +19 -0
- package/docs/examples/functions/create-variable.md +15 -0
- package/docs/examples/functions/create.md +34 -0
- package/docs/examples/functions/delete-deployment.md +14 -0
- package/docs/examples/functions/delete-execution.md +14 -0
- package/docs/examples/functions/delete-variable.md +14 -0
- package/docs/examples/functions/delete.md +13 -0
- package/docs/examples/functions/get-deployment-download.md +14 -0
- package/docs/examples/functions/get-deployment.md +14 -0
- package/docs/examples/functions/get-execution.md +14 -0
- package/docs/examples/functions/get-function-usage.md +14 -0
- package/docs/examples/functions/get-template.md +13 -0
- package/docs/examples/functions/get-usage.md +13 -0
- package/docs/examples/functions/get-variable.md +14 -0
- package/docs/examples/functions/get.md +13 -0
- package/docs/examples/functions/list-deployments.md +15 -0
- package/docs/examples/functions/list-executions.md +15 -0
- package/docs/examples/functions/list-runtimes.md +11 -0
- package/docs/examples/functions/list-specifications.md +11 -0
- package/docs/examples/functions/list-templates.md +16 -0
- package/docs/examples/functions/list-variables.md +13 -0
- package/docs/examples/functions/list.md +14 -0
- package/docs/examples/functions/update-deployment-build.md +14 -0
- package/docs/examples/functions/update-deployment.md +14 -0
- package/docs/examples/functions/update-variable.md +16 -0
- package/docs/examples/functions/update.md +30 -0
- package/docs/examples/graphql/mutation.md +13 -0
- package/docs/examples/graphql/query.md +13 -0
- package/docs/examples/health/get-antivirus.md +11 -0
- package/docs/examples/health/get-cache.md +11 -0
- package/docs/examples/health/get-certificate.md +13 -0
- package/docs/examples/health/get-d-b.md +11 -0
- package/docs/examples/health/get-failed-jobs.md +14 -0
- package/docs/examples/health/get-pub-sub.md +11 -0
- package/docs/examples/health/get-queue-builds.md +13 -0
- package/docs/examples/health/get-queue-certificates.md +13 -0
- package/docs/examples/health/get-queue-databases.md +14 -0
- package/docs/examples/health/get-queue-deletes.md +13 -0
- package/docs/examples/health/get-queue-functions.md +13 -0
- package/docs/examples/health/get-queue-logs.md +13 -0
- package/docs/examples/health/get-queue-mails.md +13 -0
- package/docs/examples/health/get-queue-messaging.md +13 -0
- package/docs/examples/health/get-queue-migrations.md +13 -0
- package/docs/examples/health/get-queue-usage-dump.md +13 -0
- package/docs/examples/health/get-queue-usage.md +13 -0
- package/docs/examples/health/get-queue-webhooks.md +13 -0
- package/docs/examples/health/get-queue.md +11 -0
- package/docs/examples/health/get-storage-local.md +11 -0
- package/docs/examples/health/get-storage.md +11 -0
- package/docs/examples/health/get-time.md +11 -0
- package/docs/examples/health/get.md +11 -0
- package/docs/examples/locale/get.md +11 -0
- package/docs/examples/locale/list-codes.md +11 -0
- package/docs/examples/locale/list-continents.md +11 -0
- package/docs/examples/locale/list-countries-e-u.md +11 -0
- package/docs/examples/locale/list-countries-phones.md +11 -0
- package/docs/examples/locale/list-countries.md +11 -0
- package/docs/examples/locale/list-currencies.md +11 -0
- package/docs/examples/locale/list-languages.md +11 -0
- package/docs/examples/messaging/create-apns-provider.md +20 -0
- package/docs/examples/messaging/create-email.md +24 -0
- package/docs/examples/messaging/create-fcm-provider.md +16 -0
- package/docs/examples/messaging/create-mailgun-provider.md +22 -0
- package/docs/examples/messaging/create-msg91provider.md +18 -0
- package/docs/examples/messaging/create-push.md +28 -0
- package/docs/examples/messaging/create-sendgrid-provider.md +20 -0
- package/docs/examples/messaging/create-sms.md +19 -0
- package/docs/examples/messaging/create-smtp-provider.md +26 -0
- package/docs/examples/messaging/create-subscriber.md +15 -0
- package/docs/examples/messaging/create-telesign-provider.md +18 -0
- package/docs/examples/messaging/create-textmagic-provider.md +18 -0
- package/docs/examples/messaging/create-topic.md +15 -0
- package/docs/examples/messaging/create-twilio-provider.md +18 -0
- package/docs/examples/messaging/create-vonage-provider.md +18 -0
- package/docs/examples/messaging/delete-provider.md +13 -0
- package/docs/examples/messaging/delete-subscriber.md +14 -0
- package/docs/examples/messaging/delete-topic.md +13 -0
- package/docs/examples/messaging/delete.md +13 -0
- package/docs/examples/messaging/get-message.md +13 -0
- package/docs/examples/messaging/get-provider.md +13 -0
- package/docs/examples/messaging/get-subscriber.md +14 -0
- package/docs/examples/messaging/get-topic.md +13 -0
- package/docs/examples/messaging/list-message-logs.md +14 -0
- package/docs/examples/messaging/list-messages.md +14 -0
- package/docs/examples/messaging/list-provider-logs.md +14 -0
- package/docs/examples/messaging/list-providers.md +14 -0
- package/docs/examples/messaging/list-subscriber-logs.md +14 -0
- package/docs/examples/messaging/list-subscribers.md +15 -0
- package/docs/examples/messaging/list-targets.md +14 -0
- package/docs/examples/messaging/list-topic-logs.md +14 -0
- package/docs/examples/messaging/list-topics.md +14 -0
- package/docs/examples/messaging/update-apns-provider.md +20 -0
- package/docs/examples/messaging/update-email.md +24 -0
- package/docs/examples/messaging/update-fcm-provider.md +16 -0
- package/docs/examples/messaging/update-mailgun-provider.md +22 -0
- package/docs/examples/messaging/update-msg91provider.md +18 -0
- package/docs/examples/messaging/update-push.md +28 -0
- package/docs/examples/messaging/update-sendgrid-provider.md +20 -0
- package/docs/examples/messaging/update-sms.md +19 -0
- package/docs/examples/messaging/update-smtp-provider.md +26 -0
- package/docs/examples/messaging/update-telesign-provider.md +18 -0
- package/docs/examples/messaging/update-textmagic-provider.md +18 -0
- package/docs/examples/messaging/update-topic.md +15 -0
- package/docs/examples/messaging/update-twilio-provider.md +18 -0
- package/docs/examples/messaging/update-vonage-provider.md +18 -0
- package/docs/examples/migrations/create-appwrite-migration.md +16 -0
- package/docs/examples/migrations/create-firebase-migration.md +14 -0
- package/docs/examples/migrations/create-firebase-o-auth-migration.md +14 -0
- package/docs/examples/migrations/create-n-host-migration.md +20 -0
- package/docs/examples/migrations/create-supabase-migration.md +19 -0
- package/docs/examples/migrations/delete-firebase-auth.md +11 -0
- package/docs/examples/migrations/delete.md +13 -0
- package/docs/examples/migrations/get-appwrite-report.md +16 -0
- package/docs/examples/migrations/get-firebase-report-o-auth.md +14 -0
- package/docs/examples/migrations/get-firebase-report.md +14 -0
- package/docs/examples/migrations/get-n-host-report.md +20 -0
- package/docs/examples/migrations/get-supabase-report.md +19 -0
- package/docs/examples/migrations/get.md +13 -0
- package/docs/examples/migrations/list-firebase-projects.md +11 -0
- package/docs/examples/migrations/list.md +14 -0
- package/docs/examples/migrations/retry.md +13 -0
- package/docs/examples/project/create-variable.md +14 -0
- package/docs/examples/project/delete-variable.md +13 -0
- package/docs/examples/project/get-usage.md +15 -0
- package/docs/examples/project/get-variable.md +13 -0
- package/docs/examples/project/list-variables.md +11 -0
- package/docs/examples/project/update-variable.md +15 -0
- package/docs/examples/projects/create-j-w-t.md +15 -0
- package/docs/examples/projects/create-key.md +16 -0
- package/docs/examples/projects/create-platform.md +18 -0
- package/docs/examples/projects/create-smtp-test.md +22 -0
- package/docs/examples/projects/create-webhook.md +20 -0
- package/docs/examples/projects/create.md +25 -0
- package/docs/examples/projects/delete-email-template.md +15 -0
- package/docs/examples/projects/delete-key.md +14 -0
- package/docs/examples/projects/delete-platform.md +14 -0
- package/docs/examples/projects/delete-sms-template.md +15 -0
- package/docs/examples/projects/delete-webhook.md +14 -0
- package/docs/examples/projects/delete.md +13 -0
- package/docs/examples/projects/get-email-template.md +15 -0
- package/docs/examples/projects/get-key.md +14 -0
- package/docs/examples/projects/get-platform.md +14 -0
- package/docs/examples/projects/get-sms-template.md +15 -0
- package/docs/examples/projects/get-webhook.md +14 -0
- package/docs/examples/projects/get.md +13 -0
- package/docs/examples/projects/list-keys.md +13 -0
- package/docs/examples/projects/list-platforms.md +13 -0
- package/docs/examples/projects/list-webhooks.md +13 -0
- package/docs/examples/projects/list.md +14 -0
- package/docs/examples/projects/update-api-status-all.md +14 -0
- package/docs/examples/projects/update-api-status.md +15 -0
- package/docs/examples/projects/update-auth-duration.md +14 -0
- package/docs/examples/projects/update-auth-limit.md +14 -0
- package/docs/examples/projects/update-auth-password-dictionary.md +14 -0
- package/docs/examples/projects/update-auth-password-history.md +14 -0
- package/docs/examples/projects/update-auth-sessions-limit.md +14 -0
- package/docs/examples/projects/update-auth-status.md +15 -0
- package/docs/examples/projects/update-email-template.md +20 -0
- package/docs/examples/projects/update-key.md +17 -0
- package/docs/examples/projects/update-mock-numbers.md +14 -0
- package/docs/examples/projects/update-o-auth2.md +17 -0
- package/docs/examples/projects/update-personal-data-check.md +14 -0
- package/docs/examples/projects/update-platform.md +18 -0
- package/docs/examples/projects/update-service-status-all.md +14 -0
- package/docs/examples/projects/update-service-status.md +15 -0
- package/docs/examples/projects/update-session-alerts.md +14 -0
- package/docs/examples/projects/update-sms-template.md +16 -0
- package/docs/examples/projects/update-smtp.md +22 -0
- package/docs/examples/projects/update-team.md +14 -0
- package/docs/examples/projects/update-webhook-signature.md +14 -0
- package/docs/examples/projects/update-webhook.md +21 -0
- package/docs/examples/projects/update.md +23 -0
- package/docs/examples/proxy/create-rule.md +15 -0
- package/docs/examples/proxy/delete-rule.md +13 -0
- package/docs/examples/proxy/get-rule.md +13 -0
- package/docs/examples/proxy/list-rules.md +14 -0
- package/docs/examples/proxy/update-rule-verification.md +13 -0
- package/docs/examples/storage/create-bucket.md +22 -0
- package/docs/examples/storage/create-file.md +16 -0
- package/docs/examples/storage/delete-bucket.md +13 -0
- package/docs/examples/storage/delete-file.md +14 -0
- package/docs/examples/storage/get-bucket-usage.md +14 -0
- package/docs/examples/storage/get-bucket.md +13 -0
- package/docs/examples/storage/get-file-download.md +14 -0
- package/docs/examples/storage/get-file-preview.md +25 -0
- package/docs/examples/storage/get-file-view.md +14 -0
- package/docs/examples/storage/get-file.md +14 -0
- package/docs/examples/storage/get-usage.md +13 -0
- package/docs/examples/storage/list-buckets.md +14 -0
- package/docs/examples/storage/list-files.md +15 -0
- package/docs/examples/storage/update-bucket.md +22 -0
- package/docs/examples/storage/update-file.md +16 -0
- package/docs/examples/teams/create-membership.md +19 -0
- package/docs/examples/teams/create.md +15 -0
- package/docs/examples/teams/delete-membership.md +14 -0
- package/docs/examples/teams/delete.md +13 -0
- package/docs/examples/teams/get-membership.md +14 -0
- package/docs/examples/teams/get-prefs.md +13 -0
- package/docs/examples/teams/get.md +13 -0
- package/docs/examples/teams/list-logs.md +14 -0
- package/docs/examples/teams/list-memberships.md +15 -0
- package/docs/examples/teams/list.md +14 -0
- package/docs/examples/teams/update-membership-status.md +16 -0
- package/docs/examples/teams/update-membership.md +15 -0
- package/docs/examples/teams/update-name.md +14 -0
- package/docs/examples/teams/update-prefs.md +14 -0
- package/docs/examples/users/create-argon2user.md +16 -0
- package/docs/examples/users/create-bcrypt-user.md +16 -0
- package/docs/examples/users/create-j-w-t.md +15 -0
- package/docs/examples/users/create-m-d5user.md +16 -0
- package/docs/examples/users/create-mfa-recovery-codes.md +13 -0
- package/docs/examples/users/create-p-h-pass-user.md +16 -0
- package/docs/examples/users/create-s-h-a-user.md +17 -0
- package/docs/examples/users/create-scrypt-modified-user.md +19 -0
- package/docs/examples/users/create-scrypt-user.md +21 -0
- package/docs/examples/users/create-session.md +13 -0
- package/docs/examples/users/create-target.md +18 -0
- package/docs/examples/users/create-token.md +15 -0
- package/docs/examples/users/create.md +17 -0
- package/docs/examples/users/delete-identity.md +13 -0
- package/docs/examples/users/delete-mfa-authenticator.md +14 -0
- package/docs/examples/users/delete-session.md +14 -0
- package/docs/examples/users/delete-sessions.md +13 -0
- package/docs/examples/users/delete-target.md +14 -0
- package/docs/examples/users/delete.md +13 -0
- package/docs/examples/users/get-mfa-recovery-codes.md +13 -0
- package/docs/examples/users/get-prefs.md +13 -0
- package/docs/examples/users/get-target.md +14 -0
- package/docs/examples/users/get-usage.md +13 -0
- package/docs/examples/users/get.md +13 -0
- package/docs/examples/users/list-identities.md +14 -0
- package/docs/examples/users/list-logs.md +14 -0
- package/docs/examples/users/list-memberships.md +13 -0
- package/docs/examples/users/list-mfa-factors.md +13 -0
- package/docs/examples/users/list-sessions.md +13 -0
- package/docs/examples/users/list-targets.md +14 -0
- package/docs/examples/users/list.md +14 -0
- package/docs/examples/users/update-email-verification.md +14 -0
- package/docs/examples/users/update-email.md +14 -0
- package/docs/examples/users/update-labels.md +14 -0
- package/docs/examples/users/update-mfa-recovery-codes.md +13 -0
- package/docs/examples/users/update-mfa.md +14 -0
- package/docs/examples/users/update-name.md +14 -0
- package/docs/examples/users/update-password.md +14 -0
- package/docs/examples/users/update-phone-verification.md +14 -0
- package/docs/examples/users/update-phone.md +14 -0
- package/docs/examples/users/update-prefs.md +14 -0
- package/docs/examples/users/update-status.md +14 -0
- package/docs/examples/users/update-target.md +17 -0
- package/docs/examples/vcs/create-repository-detection.md +15 -0
- package/docs/examples/vcs/create-repository.md +15 -0
- package/docs/examples/vcs/delete-installation.md +13 -0
- package/docs/examples/vcs/get-installation.md +13 -0
- package/docs/examples/vcs/get-repository-contents.md +15 -0
- package/docs/examples/vcs/get-repository.md +14 -0
- package/docs/examples/vcs/list-installations.md +14 -0
- package/docs/examples/vcs/list-repositories.md +14 -0
- package/docs/examples/vcs/list-repository-branches.md +14 -0
- package/docs/examples/vcs/update-external-deployments.md +15 -0
- package/package.json +42 -0
- package/publish.sh +4 -0
- package/rollup.config.js +27 -0
- package/src/Cache/Adapter.ts +11 -0
- package/src/Cache/Adapters/Filesystem.ts +126 -0
- package/src/Cache/Adapters/Memory.ts +57 -0
- package/src/Cache/Adapters/None.ts +36 -0
- package/src/Cache/Adapters/Redis.ts +106 -0
- package/src/Cache/Adapters/Sharding.ts +87 -0
- package/src/Cache/Cache.ts +75 -0
- package/src/Cache/index.ts +5 -0
- package/src/Cache/test.ts +0 -0
- package/src/Services.ts +41 -0
- package/src/client.ts +397 -0
- package/src/decorators/Cache.ts +102 -0
- package/src/decorators/CacheKey.ts +9 -0
- package/src/decorators/Invalidate.ts +68 -0
- package/src/enums/api-service.ts +13 -0
- package/src/enums/api.ts +5 -0
- package/src/enums/auth-method.ts +9 -0
- package/src/enums/authentication-factor.ts +6 -0
- package/src/enums/authenticator-type.ts +3 -0
- package/src/enums/browser.ts +16 -0
- package/src/enums/compression.ts +5 -0
- package/src/enums/credit-card.ts +18 -0
- package/src/enums/database-usage-range.ts +5 -0
- package/src/enums/email-template-locale.ts +133 -0
- package/src/enums/email-template-type.ts +9 -0
- package/src/enums/entities/EntityLimitType.ts +4 -0
- package/src/enums/entities/PropertyAttributeName.ts +27 -0
- package/src/enums/entities/PropertyCondition.ts +8 -0
- package/src/enums/entities/PropertyType.ts +16 -0
- package/src/enums/entities/PropertyValueType.ts +6 -0
- package/src/enums/entities/RowAccess.ts +2 -0
- package/src/enums/entities/ViewFilterCondition.ts +12 -0
- package/src/enums/execution-method.ts +8 -0
- package/src/enums/flag.ts +197 -0
- package/src/enums/function-usage-range.ts +5 -0
- package/src/enums/image-format.ts +7 -0
- package/src/enums/image-gravity.ts +11 -0
- package/src/enums/index-type.ts +5 -0
- package/src/enums/messaging-provider-type.ts +5 -0
- package/src/enums/name.ts +14 -0
- package/src/enums/o-auth-provider copy.ts +41 -0
- package/src/enums/o-auth-provider.ts +41 -0
- package/src/enums/password-hash.ts +13 -0
- package/src/enums/platform-type.ts +17 -0
- package/src/enums/project-usage-range.ts +4 -0
- package/src/enums/region.ts +4 -0
- package/src/enums/relation-mutate.ts +5 -0
- package/src/enums/relationship-type.ts +6 -0
- package/src/enums/resource-type.ts +4 -0
- package/src/enums/runtime.ts +48 -0
- package/src/enums/s-m-t-p-secure.ts +3 -0
- package/src/enums/shared/ApplicationLayout.ts +4 -0
- package/src/enums/shared/Colors.ts +24 -0
- package/src/enums/shared/InputType.ts +6 -0
- package/src/enums/shared/Periodicity.ts +7 -0
- package/src/enums/shared/SvgIcon.ts +37 -0
- package/src/enums/shared/Theme.ts +4 -0
- package/src/enums/sms-template-locale.ts +133 -0
- package/src/enums/sms-template-type.ts +6 -0
- package/src/enums/smtp-encryption.ts +5 -0
- package/src/enums/storage-usage-range.ts +5 -0
- package/src/enums/subscriptions/PricingModel.ts +14 -0
- package/src/enums/subscriptions/SubscriptionBillingPeriod.ts +15 -0
- package/src/enums/subscriptions/SubscriptionFeatureLimitType.ts +16 -0
- package/src/enums/subscriptions/SubscriptionPriceType.ts +10 -0
- package/src/enums/tenants/LinkedAccountStatus.ts +5 -0
- package/src/enums/tenants/TenantUserJoined.ts +6 -0
- package/src/enums/tenants/TenantUserStatus.ts +6 -0
- package/src/enums/tenants/TenantUserType.ts +5 -0
- package/src/enums/user-usage-range.ts +5 -0
- package/src/id.ts +47 -0
- package/src/index.ts +36 -0
- package/src/inputFile.ts +23 -0
- package/src/lib/Registry/Registry.ts +66 -0
- package/src/lib/Registry/index.ts +1 -0
- package/src/models.ts +3339 -0
- package/src/permission.ts +57 -0
- package/src/query.ts +261 -0
- package/src/role.ts +100 -0
- package/src/service-client.ts +29 -0
- package/src/service.ts +30 -0
- package/src/services/account.ts +1643 -0
- package/src/services/applets.ts +75 -0
- package/src/services/avatars.ts +314 -0
- package/src/services/community.ts +102 -0
- package/src/services/configuration.ts +15 -0
- package/src/services/databases.ts +2037 -0
- package/src/services/functions.ts +986 -0
- package/src/services/graphql.ts +75 -0
- package/src/services/health.ts +629 -0
- package/src/services/locale.ts +205 -0
- package/src/services/messaging.ts +2247 -0
- package/src/services/node.ts +15 -0
- package/src/services/permissions.ts +131 -0
- package/src/services/pricing.ts +30 -0
- package/src/services/projects.ts +1901 -0
- package/src/services/roles.ts +101 -0
- package/src/services/schema.ts +65 -0
- package/src/services/storage.ts +576 -0
- package/src/services/subscription.ts +40 -0
- package/src/services/teams.ts +490 -0
- package/src/services/tenant-subscription.ts +93 -0
- package/src/services/tenant.ts +194 -0
- package/src/services/users.ts +1584 -0
- package/tsconfig.json +29 -0
- package/types/Cache/Adapter.d.ts +10 -0
- package/types/Cache/Adapters/Filesystem.d.ts +16 -0
- package/types/Cache/Adapters/Memory.d.ts +18 -0
- package/types/Cache/Adapters/None.d.ts +12 -0
- package/types/Cache/Adapters/Redis.d.ts +14 -0
- package/types/Cache/Adapters/Sharding.d.ts +17 -0
- package/types/Cache/Cache.d.ts +16 -0
- package/types/Cache/index.d.ts +5 -0
- package/types/Cache/test.d.ts +0 -0
- package/types/Services.d.ts +6 -0
- package/types/client.d.ts +141 -0
- package/types/decorators/Cache.d.ts +1 -0
- package/types/decorators/CacheKey.d.ts +1 -0
- package/types/decorators/Invalidate.d.ts +1 -0
- package/types/enums/api-service.d.ts +13 -0
- package/types/enums/api.d.ts +5 -0
- package/types/enums/auth-method.d.ts +9 -0
- package/types/enums/authentication-factor.d.ts +6 -0
- package/types/enums/authenticator-type.d.ts +3 -0
- package/types/enums/browser.d.ts +16 -0
- package/types/enums/compression.d.ts +5 -0
- package/types/enums/credit-card.d.ts +18 -0
- package/types/enums/database-usage-range.d.ts +5 -0
- package/types/enums/email-template-locale.d.ts +133 -0
- package/types/enums/email-template-type.d.ts +9 -0
- package/types/enums/entities/EntityLimitType.d.ts +4 -0
- package/types/enums/entities/PropertyAttributeName.d.ts +27 -0
- package/types/enums/entities/PropertyCondition.d.ts +7 -0
- package/types/enums/entities/PropertyType.d.ts +12 -0
- package/types/enums/entities/PropertyValueType.d.ts +6 -0
- package/types/enums/entities/RowAccess.d.ts +2 -0
- package/types/enums/entities/ViewFilterCondition.d.ts +12 -0
- package/types/enums/execution-method.d.ts +8 -0
- package/types/enums/flag.d.ts +197 -0
- package/types/enums/function-usage-range.d.ts +5 -0
- package/types/enums/image-format.d.ts +7 -0
- package/types/enums/image-gravity.d.ts +11 -0
- package/types/enums/index-type.d.ts +5 -0
- package/types/enums/messaging-provider-type.d.ts +5 -0
- package/types/enums/name.d.ts +14 -0
- package/types/enums/o-auth-provider copy.d.ts +41 -0
- package/types/enums/o-auth-provider.d.ts +41 -0
- package/types/enums/password-hash.d.ts +13 -0
- package/types/enums/platform-type.d.ts +17 -0
- package/types/enums/project-usage-range.d.ts +4 -0
- package/types/enums/region.d.ts +4 -0
- package/types/enums/relation-mutate.d.ts +5 -0
- package/types/enums/relationship-type.d.ts +6 -0
- package/types/enums/resource-type.d.ts +4 -0
- package/types/enums/runtime.d.ts +48 -0
- package/types/enums/s-m-t-p-secure.d.ts +3 -0
- package/types/enums/shared/ApplicationLayout.d.ts +4 -0
- package/types/enums/shared/Colors.d.ts +24 -0
- package/types/enums/shared/InputType.d.ts +6 -0
- package/types/enums/shared/Periodicity.d.ts +7 -0
- package/types/enums/shared/SvgIcon.d.ts +37 -0
- package/types/enums/shared/Theme.d.ts +4 -0
- package/types/enums/sms-template-locale.d.ts +133 -0
- package/types/enums/sms-template-type.d.ts +6 -0
- package/types/enums/smtp-encryption.d.ts +5 -0
- package/types/enums/storage-usage-range.d.ts +5 -0
- package/types/enums/subscriptions/PricingModel.d.ts +11 -0
- package/types/enums/subscriptions/SubscriptionBillingPeriod.d.ts +10 -0
- package/types/enums/subscriptions/SubscriptionFeatureLimitType.d.ts +10 -0
- package/types/enums/subscriptions/SubscriptionPriceType.d.ts +7 -0
- package/types/enums/tenants/LinkedAccountStatus.d.ts +5 -0
- package/types/enums/tenants/TenantUserJoined.d.ts +6 -0
- package/types/enums/tenants/TenantUserStatus.d.ts +6 -0
- package/types/enums/tenants/TenantUserType.d.ts +5 -0
- package/types/enums/user-usage-range.d.ts +5 -0
- package/types/id.d.ts +20 -0
- package/types/index.d.ts +36 -0
- package/types/inputFile.d.ts +6 -0
- package/types/lib/Registry/Registry.d.ts +38 -0
- package/types/lib/Registry/index.d.ts +1 -0
- package/types/models.d.ts +3272 -0
- package/types/permission.d.ts +43 -0
- package/types/query.d.ts +194 -0
- package/types/role.d.ts +70 -0
- package/types/service-client.d.ts +7 -0
- package/types/service.d.ts +11 -0
- package/types/services/account.d.ts +530 -0
- package/types/services/acl.d.ts +28 -0
- package/types/services/applets.d.ts +9 -0
- package/types/services/assistant.d.ts +14 -0
- package/types/services/avatars.d.ts +115 -0
- package/types/services/community.d.ts +19 -0
- package/types/services/configuration.d.ts +5 -0
- package/types/services/console.d.ts +15 -0
- package/types/services/databases.d.ts +613 -0
- package/types/services/functions.d.ts +319 -0
- package/types/services/graphql.d.ts +25 -0
- package/types/services/health.d.ts +231 -0
- package/types/services/locale.d.ts +80 -0
- package/types/services/messaging.d.ts +685 -0
- package/types/services/migrations.d.ts +185 -0
- package/types/services/node.d.ts +5 -0
- package/types/services/permissions.d.ts +20 -0
- package/types/services/pricing.d.ts +15 -0
- package/types/services/project.d.ts +70 -0
- package/types/services/projects.d.ts +542 -0
- package/types/services/proxy.d.ts +59 -0
- package/types/services/roles.d.ts +19 -0
- package/types/services/schema.d.ts +17 -0
- package/types/services/storage.d.ts +189 -0
- package/types/services/subscription-product.d.ts +77 -0
- package/types/services/subscription.d.ts +15 -0
- package/types/services/teams.d.ts +167 -0
- package/types/services/tenant-subscription.d.ts +12 -0
- package/types/services/tenant.d.ts +32 -0
- package/types/services/users.d.ts +499 -0
- package/types/services/vcs.d.ts +108 -0
@@ -0,0 +1,2037 @@
|
|
1
|
+
import { AppcondaException, Client, type Payload, UploadProgress } from '../client';
|
2
|
+
import type { Models } from '../models';
|
3
|
+
import { RelationshipType } from '../enums/relationship-type';
|
4
|
+
import { RelationMutate } from '../enums/relation-mutate';
|
5
|
+
import { IndexType } from '../enums/index-type';
|
6
|
+
|
7
|
+
export class Databases {
|
8
|
+
client: Client;
|
9
|
+
|
10
|
+
constructor(client: Client) {
|
11
|
+
this.client = client;
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* List databases
|
16
|
+
*
|
17
|
+
* Get a list of all databases from the current Appconda project. You can use the search parameter to filter your results.
|
18
|
+
*
|
19
|
+
* @param {string[]} queries
|
20
|
+
* @param {string} search
|
21
|
+
* @throws {AppcondaException}
|
22
|
+
* @returns {Promise<Models.DatabaseList>}
|
23
|
+
*/
|
24
|
+
async list(queries?: string[], search?: string): Promise<Models.DatabaseList> {
|
25
|
+
const apiPath = '/databases';
|
26
|
+
const payload: Payload = {};
|
27
|
+
if (typeof queries !== 'undefined') {
|
28
|
+
payload['queries'] = queries;
|
29
|
+
}
|
30
|
+
if (typeof search !== 'undefined') {
|
31
|
+
payload['search'] = search;
|
32
|
+
}
|
33
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
34
|
+
|
35
|
+
const apiHeaders: { [header: string]: string } = {
|
36
|
+
'content-type': 'application/json',
|
37
|
+
}
|
38
|
+
|
39
|
+
return await this.client.call(
|
40
|
+
'get',
|
41
|
+
uri,
|
42
|
+
apiHeaders,
|
43
|
+
payload,
|
44
|
+
);
|
45
|
+
}
|
46
|
+
/**
|
47
|
+
* Create database
|
48
|
+
*
|
49
|
+
* Create a new Database.
|
50
|
+
|
51
|
+
*
|
52
|
+
* @param {string} databaseId
|
53
|
+
* @param {string} name
|
54
|
+
* @param {boolean} enabled
|
55
|
+
* @throws {AppcondaException}
|
56
|
+
* @returns {Promise<Models.Database>}
|
57
|
+
*/
|
58
|
+
async create(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database> {
|
59
|
+
if (typeof databaseId === 'undefined') {
|
60
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
61
|
+
}
|
62
|
+
if (typeof name === 'undefined') {
|
63
|
+
throw new AppcondaException('Missing required parameter: "name"');
|
64
|
+
}
|
65
|
+
const apiPath = '/databases';
|
66
|
+
const payload: Payload = {};
|
67
|
+
if (typeof databaseId !== 'undefined') {
|
68
|
+
payload['databaseId'] = databaseId;
|
69
|
+
}
|
70
|
+
if (typeof name !== 'undefined') {
|
71
|
+
payload['name'] = name;
|
72
|
+
}
|
73
|
+
if (typeof enabled !== 'undefined') {
|
74
|
+
payload['enabled'] = enabled;
|
75
|
+
}
|
76
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
77
|
+
|
78
|
+
const apiHeaders: { [header: string]: string } = {
|
79
|
+
'content-type': 'application/json',
|
80
|
+
}
|
81
|
+
|
82
|
+
return await this.client.call(
|
83
|
+
'post',
|
84
|
+
uri,
|
85
|
+
apiHeaders,
|
86
|
+
payload,
|
87
|
+
);
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* Get database
|
91
|
+
*
|
92
|
+
* Get a database by its unique ID. This endpoint response returns a JSON object with the database metadata.
|
93
|
+
*
|
94
|
+
* @param {string} databaseId
|
95
|
+
* @throws {AppcondaException}
|
96
|
+
* @returns {Promise<Models.Database>}
|
97
|
+
*/
|
98
|
+
async get(databaseId: string): Promise<Models.Database> {
|
99
|
+
if (typeof databaseId === 'undefined') {
|
100
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
101
|
+
}
|
102
|
+
const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
103
|
+
const payload: Payload = {};
|
104
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
105
|
+
|
106
|
+
const apiHeaders: { [header: string]: string } = {
|
107
|
+
'content-type': 'application/json',
|
108
|
+
}
|
109
|
+
|
110
|
+
return await this.client.call(
|
111
|
+
'get',
|
112
|
+
uri,
|
113
|
+
apiHeaders,
|
114
|
+
payload,
|
115
|
+
);
|
116
|
+
}
|
117
|
+
/**
|
118
|
+
* Update database
|
119
|
+
*
|
120
|
+
* Update a database by its unique ID.
|
121
|
+
*
|
122
|
+
* @param {string} databaseId
|
123
|
+
* @param {string} name
|
124
|
+
* @param {boolean} enabled
|
125
|
+
* @throws {AppcondaException}
|
126
|
+
* @returns {Promise<Models.Database>}
|
127
|
+
*/
|
128
|
+
async update(databaseId: string, name: string, enabled?: boolean): Promise<Models.Database> {
|
129
|
+
if (typeof databaseId === 'undefined') {
|
130
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
131
|
+
}
|
132
|
+
if (typeof name === 'undefined') {
|
133
|
+
throw new AppcondaException('Missing required parameter: "name"');
|
134
|
+
}
|
135
|
+
const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
136
|
+
const payload: Payload = {};
|
137
|
+
if (typeof name !== 'undefined') {
|
138
|
+
payload['name'] = name;
|
139
|
+
}
|
140
|
+
if (typeof enabled !== 'undefined') {
|
141
|
+
payload['enabled'] = enabled;
|
142
|
+
}
|
143
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
144
|
+
|
145
|
+
const apiHeaders: { [header: string]: string } = {
|
146
|
+
'content-type': 'application/json',
|
147
|
+
}
|
148
|
+
|
149
|
+
return await this.client.call(
|
150
|
+
'put',
|
151
|
+
uri,
|
152
|
+
apiHeaders,
|
153
|
+
payload,
|
154
|
+
);
|
155
|
+
}
|
156
|
+
/**
|
157
|
+
* Delete database
|
158
|
+
*
|
159
|
+
* Delete a database by its unique ID. Only API keys with with databases.write scope can delete a database.
|
160
|
+
*
|
161
|
+
* @param {string} databaseId
|
162
|
+
* @throws {AppcondaException}
|
163
|
+
* @returns {Promise<{}>}
|
164
|
+
*/
|
165
|
+
async delete(databaseId: string): Promise<{}> {
|
166
|
+
if (typeof databaseId === 'undefined') {
|
167
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
168
|
+
}
|
169
|
+
const apiPath = '/databases/{databaseId}'.replace('{databaseId}', databaseId);
|
170
|
+
const payload: Payload = {};
|
171
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
172
|
+
|
173
|
+
const apiHeaders: { [header: string]: string } = {
|
174
|
+
'content-type': 'application/json',
|
175
|
+
}
|
176
|
+
|
177
|
+
return await this.client.call(
|
178
|
+
'delete',
|
179
|
+
uri,
|
180
|
+
apiHeaders,
|
181
|
+
payload,
|
182
|
+
);
|
183
|
+
}
|
184
|
+
/**
|
185
|
+
* List collections
|
186
|
+
*
|
187
|
+
* Get a list of all collections that belong to the provided databaseId. You can use the search parameter to filter your results.
|
188
|
+
*
|
189
|
+
* @param {string} databaseId
|
190
|
+
* @param {string[]} queries
|
191
|
+
* @param {string} search
|
192
|
+
* @throws {AppcondaException}
|
193
|
+
* @returns {Promise<Models.CollectionList>}
|
194
|
+
*/
|
195
|
+
async listCollections(databaseId: string, queries?: string[], search?: string): Promise<Models.CollectionList> {
|
196
|
+
if (typeof databaseId === 'undefined') {
|
197
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
198
|
+
}
|
199
|
+
const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
200
|
+
const payload: Payload = {};
|
201
|
+
if (typeof queries !== 'undefined') {
|
202
|
+
payload['queries'] = queries;
|
203
|
+
}
|
204
|
+
if (typeof search !== 'undefined') {
|
205
|
+
payload['search'] = search;
|
206
|
+
}
|
207
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
208
|
+
|
209
|
+
const apiHeaders: { [header: string]: string } = {
|
210
|
+
'content-type': 'application/json',
|
211
|
+
}
|
212
|
+
|
213
|
+
return await this.client.call(
|
214
|
+
'get',
|
215
|
+
uri,
|
216
|
+
apiHeaders,
|
217
|
+
payload,
|
218
|
+
);
|
219
|
+
}
|
220
|
+
/**
|
221
|
+
* Create collection
|
222
|
+
*
|
223
|
+
* Create a new Collection. Before using this route, you should create a new database resource using either a [server integration](https://appconda.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
224
|
+
*
|
225
|
+
* @param {string} databaseId
|
226
|
+
* @param {string} collectionId
|
227
|
+
* @param {string} name
|
228
|
+
* @param {string[]} permissions
|
229
|
+
* @param {boolean} documentSecurity
|
230
|
+
* @param {boolean} enabled
|
231
|
+
* @throws {AppcondaException}
|
232
|
+
* @returns {Promise<Models.Collection>}
|
233
|
+
*/
|
234
|
+
async createCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection> {
|
235
|
+
if (typeof databaseId === 'undefined') {
|
236
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
237
|
+
}
|
238
|
+
if (typeof collectionId === 'undefined') {
|
239
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
240
|
+
}
|
241
|
+
if (typeof name === 'undefined') {
|
242
|
+
throw new AppcondaException('Missing required parameter: "name"');
|
243
|
+
}
|
244
|
+
const apiPath = '/databases/{databaseId}/collections'.replace('{databaseId}', databaseId);
|
245
|
+
const payload: Payload = {};
|
246
|
+
if (typeof collectionId !== 'undefined') {
|
247
|
+
payload['collectionId'] = collectionId;
|
248
|
+
}
|
249
|
+
if (typeof name !== 'undefined') {
|
250
|
+
payload['name'] = name;
|
251
|
+
}
|
252
|
+
if (typeof permissions !== 'undefined') {
|
253
|
+
payload['permissions'] = permissions;
|
254
|
+
}
|
255
|
+
if (typeof documentSecurity !== 'undefined') {
|
256
|
+
payload['documentSecurity'] = documentSecurity;
|
257
|
+
}
|
258
|
+
if (typeof enabled !== 'undefined') {
|
259
|
+
payload['enabled'] = enabled;
|
260
|
+
}
|
261
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
262
|
+
|
263
|
+
const apiHeaders: { [header: string]: string } = {
|
264
|
+
'content-type': 'application/json',
|
265
|
+
}
|
266
|
+
|
267
|
+
return await this.client.call(
|
268
|
+
'post',
|
269
|
+
uri,
|
270
|
+
apiHeaders,
|
271
|
+
payload,
|
272
|
+
);
|
273
|
+
}
|
274
|
+
/**
|
275
|
+
* Get collection
|
276
|
+
*
|
277
|
+
* Get a collection by its unique ID. This endpoint response returns a JSON object with the collection metadata.
|
278
|
+
*
|
279
|
+
* @param {string} databaseId
|
280
|
+
* @param {string} collectionId
|
281
|
+
* @throws {AppcondaException}
|
282
|
+
* @returns {Promise<Models.Collection>}
|
283
|
+
*/
|
284
|
+
async getCollection(databaseId: string, collectionId: string): Promise<Models.Collection> {
|
285
|
+
if (typeof databaseId === 'undefined') {
|
286
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
287
|
+
}
|
288
|
+
if (typeof collectionId === 'undefined') {
|
289
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
290
|
+
}
|
291
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
292
|
+
const payload: Payload = {};
|
293
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
294
|
+
|
295
|
+
const apiHeaders: { [header: string]: string } = {
|
296
|
+
'content-type': 'application/json',
|
297
|
+
}
|
298
|
+
|
299
|
+
return await this.client.call(
|
300
|
+
'get',
|
301
|
+
uri,
|
302
|
+
apiHeaders,
|
303
|
+
payload,
|
304
|
+
);
|
305
|
+
}
|
306
|
+
/**
|
307
|
+
* Update collection
|
308
|
+
*
|
309
|
+
* Update a collection by its unique ID.
|
310
|
+
*
|
311
|
+
* @param {string} databaseId
|
312
|
+
* @param {string} collectionId
|
313
|
+
* @param {string} name
|
314
|
+
* @param {string[]} permissions
|
315
|
+
* @param {boolean} documentSecurity
|
316
|
+
* @param {boolean} enabled
|
317
|
+
* @throws {AppcondaException}
|
318
|
+
* @returns {Promise<Models.Collection>}
|
319
|
+
*/
|
320
|
+
async updateCollection(databaseId: string, collectionId: string, name: string, permissions?: string[], documentSecurity?: boolean, enabled?: boolean): Promise<Models.Collection> {
|
321
|
+
if (typeof databaseId === 'undefined') {
|
322
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
323
|
+
}
|
324
|
+
if (typeof collectionId === 'undefined') {
|
325
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
326
|
+
}
|
327
|
+
if (typeof name === 'undefined') {
|
328
|
+
throw new AppcondaException('Missing required parameter: "name"');
|
329
|
+
}
|
330
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
331
|
+
const payload: Payload = {};
|
332
|
+
if (typeof name !== 'undefined') {
|
333
|
+
payload['name'] = name;
|
334
|
+
}
|
335
|
+
if (typeof permissions !== 'undefined') {
|
336
|
+
payload['permissions'] = permissions;
|
337
|
+
}
|
338
|
+
if (typeof documentSecurity !== 'undefined') {
|
339
|
+
payload['documentSecurity'] = documentSecurity;
|
340
|
+
}
|
341
|
+
if (typeof enabled !== 'undefined') {
|
342
|
+
payload['enabled'] = enabled;
|
343
|
+
}
|
344
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
345
|
+
|
346
|
+
const apiHeaders: { [header: string]: string } = {
|
347
|
+
'content-type': 'application/json',
|
348
|
+
}
|
349
|
+
|
350
|
+
return await this.client.call(
|
351
|
+
'put',
|
352
|
+
uri,
|
353
|
+
apiHeaders,
|
354
|
+
payload,
|
355
|
+
);
|
356
|
+
}
|
357
|
+
/**
|
358
|
+
* Delete collection
|
359
|
+
*
|
360
|
+
* Delete a collection by its unique ID. Only users with write permissions have access to delete this resource.
|
361
|
+
*
|
362
|
+
* @param {string} databaseId
|
363
|
+
* @param {string} collectionId
|
364
|
+
* @throws {AppcondaException}
|
365
|
+
* @returns {Promise<{}>}
|
366
|
+
*/
|
367
|
+
async deleteCollection(databaseId: string, collectionId: string): Promise<{}> {
|
368
|
+
if (typeof databaseId === 'undefined') {
|
369
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
370
|
+
}
|
371
|
+
if (typeof collectionId === 'undefined') {
|
372
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
373
|
+
}
|
374
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
375
|
+
const payload: Payload = {};
|
376
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
377
|
+
|
378
|
+
const apiHeaders: { [header: string]: string } = {
|
379
|
+
'content-type': 'application/json',
|
380
|
+
}
|
381
|
+
|
382
|
+
return await this.client.call(
|
383
|
+
'delete',
|
384
|
+
uri,
|
385
|
+
apiHeaders,
|
386
|
+
payload,
|
387
|
+
);
|
388
|
+
}
|
389
|
+
/**
|
390
|
+
* List attributes
|
391
|
+
*
|
392
|
+
* List attributes in the collection.
|
393
|
+
*
|
394
|
+
* @param {string} databaseId
|
395
|
+
* @param {string} collectionId
|
396
|
+
* @param {string[]} queries
|
397
|
+
* @throws {AppcondaException}
|
398
|
+
* @returns {Promise<Models.AttributeList>}
|
399
|
+
*/
|
400
|
+
async listAttributes(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.AttributeList> {
|
401
|
+
if (typeof databaseId === 'undefined') {
|
402
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
403
|
+
}
|
404
|
+
if (typeof collectionId === 'undefined') {
|
405
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
406
|
+
}
|
407
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
408
|
+
const payload: Payload = {};
|
409
|
+
if (typeof queries !== 'undefined') {
|
410
|
+
payload['queries'] = queries;
|
411
|
+
}
|
412
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
413
|
+
|
414
|
+
const apiHeaders: { [header: string]: string } = {
|
415
|
+
'content-type': 'application/json',
|
416
|
+
}
|
417
|
+
|
418
|
+
return await this.client.call(
|
419
|
+
'get',
|
420
|
+
uri,
|
421
|
+
apiHeaders,
|
422
|
+
payload,
|
423
|
+
);
|
424
|
+
}
|
425
|
+
/**
|
426
|
+
* Create boolean attribute
|
427
|
+
*
|
428
|
+
* Create a boolean attribute.
|
429
|
+
|
430
|
+
*
|
431
|
+
* @param {string} databaseId
|
432
|
+
* @param {string} collectionId
|
433
|
+
* @param {string} key
|
434
|
+
* @param {boolean} required
|
435
|
+
* @param {boolean} xdefault
|
436
|
+
* @param {boolean} array
|
437
|
+
* @throws {AppcondaException}
|
438
|
+
* @returns {Promise<Models.AttributeBoolean>}
|
439
|
+
*/
|
440
|
+
async createBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, array?: boolean): Promise<Models.AttributeBoolean> {
|
441
|
+
if (typeof databaseId === 'undefined') {
|
442
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
443
|
+
}
|
444
|
+
if (typeof collectionId === 'undefined') {
|
445
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
446
|
+
}
|
447
|
+
if (typeof key === 'undefined') {
|
448
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
449
|
+
}
|
450
|
+
if (typeof required === 'undefined') {
|
451
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
452
|
+
}
|
453
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
454
|
+
const payload: Payload = {};
|
455
|
+
if (typeof key !== 'undefined') {
|
456
|
+
payload['key'] = key;
|
457
|
+
}
|
458
|
+
if (typeof required !== 'undefined') {
|
459
|
+
payload['required'] = required;
|
460
|
+
}
|
461
|
+
if (typeof xdefault !== 'undefined') {
|
462
|
+
payload['default'] = xdefault;
|
463
|
+
}
|
464
|
+
if (typeof array !== 'undefined') {
|
465
|
+
payload['array'] = array;
|
466
|
+
}
|
467
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
468
|
+
|
469
|
+
const apiHeaders: { [header: string]: string } = {
|
470
|
+
'content-type': 'application/json',
|
471
|
+
}
|
472
|
+
|
473
|
+
return await this.client.call(
|
474
|
+
'post',
|
475
|
+
uri,
|
476
|
+
apiHeaders,
|
477
|
+
payload,
|
478
|
+
);
|
479
|
+
}
|
480
|
+
/**
|
481
|
+
* Update boolean attribute
|
482
|
+
*
|
483
|
+
* Update a boolean attribute. Changing the `default` value will not update already existing documents.
|
484
|
+
*
|
485
|
+
* @param {string} databaseId
|
486
|
+
* @param {string} collectionId
|
487
|
+
* @param {string} key
|
488
|
+
* @param {boolean} required
|
489
|
+
* @param {boolean} xdefault
|
490
|
+
* @param {string} newKey
|
491
|
+
* @throws {AppcondaException}
|
492
|
+
* @returns {Promise<Models.AttributeBoolean>}
|
493
|
+
*/
|
494
|
+
async updateBooleanAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: boolean, newKey?: string): Promise<Models.AttributeBoolean> {
|
495
|
+
if (typeof databaseId === 'undefined') {
|
496
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
497
|
+
}
|
498
|
+
if (typeof collectionId === 'undefined') {
|
499
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
500
|
+
}
|
501
|
+
if (typeof key === 'undefined') {
|
502
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
503
|
+
}
|
504
|
+
if (typeof required === 'undefined') {
|
505
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
506
|
+
}
|
507
|
+
if (typeof xdefault === 'undefined') {
|
508
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
509
|
+
}
|
510
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
511
|
+
const payload: Payload = {};
|
512
|
+
if (typeof required !== 'undefined') {
|
513
|
+
payload['required'] = required;
|
514
|
+
}
|
515
|
+
if (typeof xdefault !== 'undefined') {
|
516
|
+
payload['default'] = xdefault;
|
517
|
+
}
|
518
|
+
if (typeof newKey !== 'undefined') {
|
519
|
+
payload['newKey'] = newKey;
|
520
|
+
}
|
521
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
522
|
+
|
523
|
+
const apiHeaders: { [header: string]: string } = {
|
524
|
+
'content-type': 'application/json',
|
525
|
+
}
|
526
|
+
|
527
|
+
return await this.client.call(
|
528
|
+
'patch',
|
529
|
+
uri,
|
530
|
+
apiHeaders,
|
531
|
+
payload,
|
532
|
+
);
|
533
|
+
}
|
534
|
+
/**
|
535
|
+
* Create datetime attribute
|
536
|
+
*
|
537
|
+
* Create a date time attribute according to the ISO 8601 standard.
|
538
|
+
*
|
539
|
+
* @param {string} databaseId
|
540
|
+
* @param {string} collectionId
|
541
|
+
* @param {string} key
|
542
|
+
* @param {boolean} required
|
543
|
+
* @param {string} xdefault
|
544
|
+
* @param {boolean} array
|
545
|
+
* @throws {AppcondaException}
|
546
|
+
* @returns {Promise<Models.AttributeDatetime>}
|
547
|
+
*/
|
548
|
+
async createDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeDatetime> {
|
549
|
+
if (typeof databaseId === 'undefined') {
|
550
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
551
|
+
}
|
552
|
+
if (typeof collectionId === 'undefined') {
|
553
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
554
|
+
}
|
555
|
+
if (typeof key === 'undefined') {
|
556
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
557
|
+
}
|
558
|
+
if (typeof required === 'undefined') {
|
559
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
560
|
+
}
|
561
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
562
|
+
const payload: Payload = {};
|
563
|
+
if (typeof key !== 'undefined') {
|
564
|
+
payload['key'] = key;
|
565
|
+
}
|
566
|
+
if (typeof required !== 'undefined') {
|
567
|
+
payload['required'] = required;
|
568
|
+
}
|
569
|
+
if (typeof xdefault !== 'undefined') {
|
570
|
+
payload['default'] = xdefault;
|
571
|
+
}
|
572
|
+
if (typeof array !== 'undefined') {
|
573
|
+
payload['array'] = array;
|
574
|
+
}
|
575
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
576
|
+
|
577
|
+
const apiHeaders: { [header: string]: string } = {
|
578
|
+
'content-type': 'application/json',
|
579
|
+
}
|
580
|
+
|
581
|
+
return await this.client.call(
|
582
|
+
'post',
|
583
|
+
uri,
|
584
|
+
apiHeaders,
|
585
|
+
payload,
|
586
|
+
);
|
587
|
+
}
|
588
|
+
/**
|
589
|
+
* Update dateTime attribute
|
590
|
+
*
|
591
|
+
* Update a date time attribute. Changing the `default` value will not update already existing documents.
|
592
|
+
*
|
593
|
+
* @param {string} databaseId
|
594
|
+
* @param {string} collectionId
|
595
|
+
* @param {string} key
|
596
|
+
* @param {boolean} required
|
597
|
+
* @param {string} xdefault
|
598
|
+
* @param {string} newKey
|
599
|
+
* @throws {AppcondaException}
|
600
|
+
* @returns {Promise<Models.AttributeDatetime>}
|
601
|
+
*/
|
602
|
+
async updateDatetimeAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeDatetime> {
|
603
|
+
if (typeof databaseId === 'undefined') {
|
604
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
605
|
+
}
|
606
|
+
if (typeof collectionId === 'undefined') {
|
607
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
608
|
+
}
|
609
|
+
if (typeof key === 'undefined') {
|
610
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
611
|
+
}
|
612
|
+
if (typeof required === 'undefined') {
|
613
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
614
|
+
}
|
615
|
+
if (typeof xdefault === 'undefined') {
|
616
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
617
|
+
}
|
618
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
619
|
+
const payload: Payload = {};
|
620
|
+
if (typeof required !== 'undefined') {
|
621
|
+
payload['required'] = required;
|
622
|
+
}
|
623
|
+
if (typeof xdefault !== 'undefined') {
|
624
|
+
payload['default'] = xdefault;
|
625
|
+
}
|
626
|
+
if (typeof newKey !== 'undefined') {
|
627
|
+
payload['newKey'] = newKey;
|
628
|
+
}
|
629
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
630
|
+
|
631
|
+
const apiHeaders: { [header: string]: string } = {
|
632
|
+
'content-type': 'application/json',
|
633
|
+
}
|
634
|
+
|
635
|
+
return await this.client.call(
|
636
|
+
'patch',
|
637
|
+
uri,
|
638
|
+
apiHeaders,
|
639
|
+
payload,
|
640
|
+
);
|
641
|
+
}
|
642
|
+
/**
|
643
|
+
* Create email attribute
|
644
|
+
*
|
645
|
+
* Create an email attribute.
|
646
|
+
|
647
|
+
*
|
648
|
+
* @param {string} databaseId
|
649
|
+
* @param {string} collectionId
|
650
|
+
* @param {string} key
|
651
|
+
* @param {boolean} required
|
652
|
+
* @param {string} xdefault
|
653
|
+
* @param {boolean} array
|
654
|
+
* @throws {AppcondaException}
|
655
|
+
* @returns {Promise<Models.AttributeEmail>}
|
656
|
+
*/
|
657
|
+
async createEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEmail> {
|
658
|
+
if (typeof databaseId === 'undefined') {
|
659
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
660
|
+
}
|
661
|
+
if (typeof collectionId === 'undefined') {
|
662
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
663
|
+
}
|
664
|
+
if (typeof key === 'undefined') {
|
665
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
666
|
+
}
|
667
|
+
if (typeof required === 'undefined') {
|
668
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
669
|
+
}
|
670
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
671
|
+
const payload: Payload = {};
|
672
|
+
if (typeof key !== 'undefined') {
|
673
|
+
payload['key'] = key;
|
674
|
+
}
|
675
|
+
if (typeof required !== 'undefined') {
|
676
|
+
payload['required'] = required;
|
677
|
+
}
|
678
|
+
if (typeof xdefault !== 'undefined') {
|
679
|
+
payload['default'] = xdefault;
|
680
|
+
}
|
681
|
+
if (typeof array !== 'undefined') {
|
682
|
+
payload['array'] = array;
|
683
|
+
}
|
684
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
685
|
+
|
686
|
+
const apiHeaders: { [header: string]: string } = {
|
687
|
+
'content-type': 'application/json',
|
688
|
+
}
|
689
|
+
|
690
|
+
return await this.client.call(
|
691
|
+
'post',
|
692
|
+
uri,
|
693
|
+
apiHeaders,
|
694
|
+
payload,
|
695
|
+
);
|
696
|
+
}
|
697
|
+
/**
|
698
|
+
* Update email attribute
|
699
|
+
*
|
700
|
+
* Update an email attribute. Changing the `default` value will not update already existing documents.
|
701
|
+
|
702
|
+
*
|
703
|
+
* @param {string} databaseId
|
704
|
+
* @param {string} collectionId
|
705
|
+
* @param {string} key
|
706
|
+
* @param {boolean} required
|
707
|
+
* @param {string} xdefault
|
708
|
+
* @param {string} newKey
|
709
|
+
* @throws {AppcondaException}
|
710
|
+
* @returns {Promise<Models.AttributeEmail>}
|
711
|
+
*/
|
712
|
+
async updateEmailAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEmail> {
|
713
|
+
if (typeof databaseId === 'undefined') {
|
714
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
715
|
+
}
|
716
|
+
if (typeof collectionId === 'undefined') {
|
717
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
718
|
+
}
|
719
|
+
if (typeof key === 'undefined') {
|
720
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
721
|
+
}
|
722
|
+
if (typeof required === 'undefined') {
|
723
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
724
|
+
}
|
725
|
+
if (typeof xdefault === 'undefined') {
|
726
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
727
|
+
}
|
728
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/email/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
729
|
+
const payload: Payload = {};
|
730
|
+
if (typeof required !== 'undefined') {
|
731
|
+
payload['required'] = required;
|
732
|
+
}
|
733
|
+
if (typeof xdefault !== 'undefined') {
|
734
|
+
payload['default'] = xdefault;
|
735
|
+
}
|
736
|
+
if (typeof newKey !== 'undefined') {
|
737
|
+
payload['newKey'] = newKey;
|
738
|
+
}
|
739
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
740
|
+
|
741
|
+
const apiHeaders: { [header: string]: string } = {
|
742
|
+
'content-type': 'application/json',
|
743
|
+
}
|
744
|
+
|
745
|
+
return await this.client.call(
|
746
|
+
'patch',
|
747
|
+
uri,
|
748
|
+
apiHeaders,
|
749
|
+
payload,
|
750
|
+
);
|
751
|
+
}
|
752
|
+
/**
|
753
|
+
* Create enum attribute
|
754
|
+
*
|
755
|
+
* Create an enumeration attribute. The `elements` param acts as a white-list of accepted values for this attribute.
|
756
|
+
|
757
|
+
*
|
758
|
+
* @param {string} databaseId
|
759
|
+
* @param {string} collectionId
|
760
|
+
* @param {string} key
|
761
|
+
* @param {string[]} elements
|
762
|
+
* @param {boolean} required
|
763
|
+
* @param {string} xdefault
|
764
|
+
* @param {boolean} array
|
765
|
+
* @throws {AppcondaException}
|
766
|
+
* @returns {Promise<Models.AttributeEnum>}
|
767
|
+
*/
|
768
|
+
async createEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeEnum> {
|
769
|
+
if (typeof databaseId === 'undefined') {
|
770
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
771
|
+
}
|
772
|
+
if (typeof collectionId === 'undefined') {
|
773
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
774
|
+
}
|
775
|
+
if (typeof key === 'undefined') {
|
776
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
777
|
+
}
|
778
|
+
if (typeof elements === 'undefined') {
|
779
|
+
throw new AppcondaException('Missing required parameter: "elements"');
|
780
|
+
}
|
781
|
+
if (typeof required === 'undefined') {
|
782
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
783
|
+
}
|
784
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
785
|
+
const payload: Payload = {};
|
786
|
+
if (typeof key !== 'undefined') {
|
787
|
+
payload['key'] = key;
|
788
|
+
}
|
789
|
+
if (typeof elements !== 'undefined') {
|
790
|
+
payload['elements'] = elements;
|
791
|
+
}
|
792
|
+
if (typeof required !== 'undefined') {
|
793
|
+
payload['required'] = required;
|
794
|
+
}
|
795
|
+
if (typeof xdefault !== 'undefined') {
|
796
|
+
payload['default'] = xdefault;
|
797
|
+
}
|
798
|
+
if (typeof array !== 'undefined') {
|
799
|
+
payload['array'] = array;
|
800
|
+
}
|
801
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
802
|
+
|
803
|
+
const apiHeaders: { [header: string]: string } = {
|
804
|
+
'content-type': 'application/json',
|
805
|
+
}
|
806
|
+
|
807
|
+
return await this.client.call(
|
808
|
+
'post',
|
809
|
+
uri,
|
810
|
+
apiHeaders,
|
811
|
+
payload,
|
812
|
+
);
|
813
|
+
}
|
814
|
+
/**
|
815
|
+
* Update enum attribute
|
816
|
+
*
|
817
|
+
* Update an enum attribute. Changing the `default` value will not update already existing documents.
|
818
|
+
|
819
|
+
*
|
820
|
+
* @param {string} databaseId
|
821
|
+
* @param {string} collectionId
|
822
|
+
* @param {string} key
|
823
|
+
* @param {string[]} elements
|
824
|
+
* @param {boolean} required
|
825
|
+
* @param {string} xdefault
|
826
|
+
* @param {string} newKey
|
827
|
+
* @throws {AppcondaException}
|
828
|
+
* @returns {Promise<Models.AttributeEnum>}
|
829
|
+
*/
|
830
|
+
async updateEnumAttribute(databaseId: string, collectionId: string, key: string, elements: string[], required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeEnum> {
|
831
|
+
if (typeof databaseId === 'undefined') {
|
832
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
833
|
+
}
|
834
|
+
if (typeof collectionId === 'undefined') {
|
835
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
836
|
+
}
|
837
|
+
if (typeof key === 'undefined') {
|
838
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
839
|
+
}
|
840
|
+
if (typeof elements === 'undefined') {
|
841
|
+
throw new AppcondaException('Missing required parameter: "elements"');
|
842
|
+
}
|
843
|
+
if (typeof required === 'undefined') {
|
844
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
845
|
+
}
|
846
|
+
if (typeof xdefault === 'undefined') {
|
847
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
848
|
+
}
|
849
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
850
|
+
const payload: Payload = {};
|
851
|
+
if (typeof elements !== 'undefined') {
|
852
|
+
payload['elements'] = elements;
|
853
|
+
}
|
854
|
+
if (typeof required !== 'undefined') {
|
855
|
+
payload['required'] = required;
|
856
|
+
}
|
857
|
+
if (typeof xdefault !== 'undefined') {
|
858
|
+
payload['default'] = xdefault;
|
859
|
+
}
|
860
|
+
if (typeof newKey !== 'undefined') {
|
861
|
+
payload['newKey'] = newKey;
|
862
|
+
}
|
863
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
864
|
+
|
865
|
+
const apiHeaders: { [header: string]: string } = {
|
866
|
+
'content-type': 'application/json',
|
867
|
+
}
|
868
|
+
|
869
|
+
return await this.client.call(
|
870
|
+
'patch',
|
871
|
+
uri,
|
872
|
+
apiHeaders,
|
873
|
+
payload,
|
874
|
+
);
|
875
|
+
}
|
876
|
+
/**
|
877
|
+
* Create float attribute
|
878
|
+
*
|
879
|
+
* Create a float attribute. Optionally, minimum and maximum values can be provided.
|
880
|
+
|
881
|
+
*
|
882
|
+
* @param {string} databaseId
|
883
|
+
* @param {string} collectionId
|
884
|
+
* @param {string} key
|
885
|
+
* @param {boolean} required
|
886
|
+
* @param {number} min
|
887
|
+
* @param {number} max
|
888
|
+
* @param {number} xdefault
|
889
|
+
* @param {boolean} array
|
890
|
+
* @throws {AppcondaException}
|
891
|
+
* @returns {Promise<Models.AttributeFloat>}
|
892
|
+
*/
|
893
|
+
async createFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeFloat> {
|
894
|
+
if (typeof databaseId === 'undefined') {
|
895
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
896
|
+
}
|
897
|
+
if (typeof collectionId === 'undefined') {
|
898
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
899
|
+
}
|
900
|
+
if (typeof key === 'undefined') {
|
901
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
902
|
+
}
|
903
|
+
if (typeof required === 'undefined') {
|
904
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
905
|
+
}
|
906
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
907
|
+
const payload: Payload = {};
|
908
|
+
if (typeof key !== 'undefined') {
|
909
|
+
payload['key'] = key;
|
910
|
+
}
|
911
|
+
if (typeof required !== 'undefined') {
|
912
|
+
payload['required'] = required;
|
913
|
+
}
|
914
|
+
if (typeof min !== 'undefined') {
|
915
|
+
payload['min'] = min;
|
916
|
+
}
|
917
|
+
if (typeof max !== 'undefined') {
|
918
|
+
payload['max'] = max;
|
919
|
+
}
|
920
|
+
if (typeof xdefault !== 'undefined') {
|
921
|
+
payload['default'] = xdefault;
|
922
|
+
}
|
923
|
+
if (typeof array !== 'undefined') {
|
924
|
+
payload['array'] = array;
|
925
|
+
}
|
926
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
927
|
+
|
928
|
+
const apiHeaders: { [header: string]: string } = {
|
929
|
+
'content-type': 'application/json',
|
930
|
+
}
|
931
|
+
|
932
|
+
return await this.client.call(
|
933
|
+
'post',
|
934
|
+
uri,
|
935
|
+
apiHeaders,
|
936
|
+
payload,
|
937
|
+
);
|
938
|
+
}
|
939
|
+
/**
|
940
|
+
* Update float attribute
|
941
|
+
*
|
942
|
+
* Update a float attribute. Changing the `default` value will not update already existing documents.
|
943
|
+
|
944
|
+
*
|
945
|
+
* @param {string} databaseId
|
946
|
+
* @param {string} collectionId
|
947
|
+
* @param {string} key
|
948
|
+
* @param {boolean} required
|
949
|
+
* @param {number} min
|
950
|
+
* @param {number} max
|
951
|
+
* @param {number} xdefault
|
952
|
+
* @param {string} newKey
|
953
|
+
* @throws {AppcondaException}
|
954
|
+
* @returns {Promise<Models.AttributeFloat>}
|
955
|
+
*/
|
956
|
+
async updateFloatAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise<Models.AttributeFloat> {
|
957
|
+
if (typeof databaseId === 'undefined') {
|
958
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
959
|
+
}
|
960
|
+
if (typeof collectionId === 'undefined') {
|
961
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
962
|
+
}
|
963
|
+
if (typeof key === 'undefined') {
|
964
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
965
|
+
}
|
966
|
+
if (typeof required === 'undefined') {
|
967
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
968
|
+
}
|
969
|
+
if (typeof min === 'undefined') {
|
970
|
+
throw new AppcondaException('Missing required parameter: "min"');
|
971
|
+
}
|
972
|
+
if (typeof max === 'undefined') {
|
973
|
+
throw new AppcondaException('Missing required parameter: "max"');
|
974
|
+
}
|
975
|
+
if (typeof xdefault === 'undefined') {
|
976
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
977
|
+
}
|
978
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/float/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
979
|
+
const payload: Payload = {};
|
980
|
+
if (typeof required !== 'undefined') {
|
981
|
+
payload['required'] = required;
|
982
|
+
}
|
983
|
+
if (typeof min !== 'undefined') {
|
984
|
+
payload['min'] = min;
|
985
|
+
}
|
986
|
+
if (typeof max !== 'undefined') {
|
987
|
+
payload['max'] = max;
|
988
|
+
}
|
989
|
+
if (typeof xdefault !== 'undefined') {
|
990
|
+
payload['default'] = xdefault;
|
991
|
+
}
|
992
|
+
if (typeof newKey !== 'undefined') {
|
993
|
+
payload['newKey'] = newKey;
|
994
|
+
}
|
995
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
996
|
+
|
997
|
+
const apiHeaders: { [header: string]: string } = {
|
998
|
+
'content-type': 'application/json',
|
999
|
+
}
|
1000
|
+
|
1001
|
+
return await this.client.call(
|
1002
|
+
'patch',
|
1003
|
+
uri,
|
1004
|
+
apiHeaders,
|
1005
|
+
payload,
|
1006
|
+
);
|
1007
|
+
}
|
1008
|
+
/**
|
1009
|
+
* Create integer attribute
|
1010
|
+
*
|
1011
|
+
* Create an integer attribute. Optionally, minimum and maximum values can be provided.
|
1012
|
+
|
1013
|
+
*
|
1014
|
+
* @param {string} databaseId
|
1015
|
+
* @param {string} collectionId
|
1016
|
+
* @param {string} key
|
1017
|
+
* @param {boolean} required
|
1018
|
+
* @param {number} min
|
1019
|
+
* @param {number} max
|
1020
|
+
* @param {number} xdefault
|
1021
|
+
* @param {boolean} array
|
1022
|
+
* @throws {AppcondaException}
|
1023
|
+
* @returns {Promise<Models.AttributeInteger>}
|
1024
|
+
*/
|
1025
|
+
async createIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min?: number, max?: number, xdefault?: number, array?: boolean): Promise<Models.AttributeInteger> {
|
1026
|
+
if (typeof databaseId === 'undefined') {
|
1027
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1028
|
+
}
|
1029
|
+
if (typeof collectionId === 'undefined') {
|
1030
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1031
|
+
}
|
1032
|
+
if (typeof key === 'undefined') {
|
1033
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1034
|
+
}
|
1035
|
+
if (typeof required === 'undefined') {
|
1036
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1037
|
+
}
|
1038
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1039
|
+
const payload: Payload = {};
|
1040
|
+
if (typeof key !== 'undefined') {
|
1041
|
+
payload['key'] = key;
|
1042
|
+
}
|
1043
|
+
if (typeof required !== 'undefined') {
|
1044
|
+
payload['required'] = required;
|
1045
|
+
}
|
1046
|
+
if (typeof min !== 'undefined') {
|
1047
|
+
payload['min'] = min;
|
1048
|
+
}
|
1049
|
+
if (typeof max !== 'undefined') {
|
1050
|
+
payload['max'] = max;
|
1051
|
+
}
|
1052
|
+
if (typeof xdefault !== 'undefined') {
|
1053
|
+
payload['default'] = xdefault;
|
1054
|
+
}
|
1055
|
+
if (typeof array !== 'undefined') {
|
1056
|
+
payload['array'] = array;
|
1057
|
+
}
|
1058
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1059
|
+
|
1060
|
+
const apiHeaders: { [header: string]: string } = {
|
1061
|
+
'content-type': 'application/json',
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
return await this.client.call(
|
1065
|
+
'post',
|
1066
|
+
uri,
|
1067
|
+
apiHeaders,
|
1068
|
+
payload,
|
1069
|
+
);
|
1070
|
+
}
|
1071
|
+
/**
|
1072
|
+
* Update integer attribute
|
1073
|
+
*
|
1074
|
+
* Update an integer attribute. Changing the `default` value will not update already existing documents.
|
1075
|
+
|
1076
|
+
*
|
1077
|
+
* @param {string} databaseId
|
1078
|
+
* @param {string} collectionId
|
1079
|
+
* @param {string} key
|
1080
|
+
* @param {boolean} required
|
1081
|
+
* @param {number} min
|
1082
|
+
* @param {number} max
|
1083
|
+
* @param {number} xdefault
|
1084
|
+
* @param {string} newKey
|
1085
|
+
* @throws {AppcondaException}
|
1086
|
+
* @returns {Promise<Models.AttributeInteger>}
|
1087
|
+
*/
|
1088
|
+
async updateIntegerAttribute(databaseId: string, collectionId: string, key: string, required: boolean, min: number, max: number, xdefault?: number, newKey?: string): Promise<Models.AttributeInteger> {
|
1089
|
+
if (typeof databaseId === 'undefined') {
|
1090
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1091
|
+
}
|
1092
|
+
if (typeof collectionId === 'undefined') {
|
1093
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1094
|
+
}
|
1095
|
+
if (typeof key === 'undefined') {
|
1096
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1097
|
+
}
|
1098
|
+
if (typeof required === 'undefined') {
|
1099
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1100
|
+
}
|
1101
|
+
if (typeof min === 'undefined') {
|
1102
|
+
throw new AppcondaException('Missing required parameter: "min"');
|
1103
|
+
}
|
1104
|
+
if (typeof max === 'undefined') {
|
1105
|
+
throw new AppcondaException('Missing required parameter: "max"');
|
1106
|
+
}
|
1107
|
+
if (typeof xdefault === 'undefined') {
|
1108
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
1109
|
+
}
|
1110
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1111
|
+
const payload: Payload = {};
|
1112
|
+
if (typeof required !== 'undefined') {
|
1113
|
+
payload['required'] = required;
|
1114
|
+
}
|
1115
|
+
if (typeof min !== 'undefined') {
|
1116
|
+
payload['min'] = min;
|
1117
|
+
}
|
1118
|
+
if (typeof max !== 'undefined') {
|
1119
|
+
payload['max'] = max;
|
1120
|
+
}
|
1121
|
+
if (typeof xdefault !== 'undefined') {
|
1122
|
+
payload['default'] = xdefault;
|
1123
|
+
}
|
1124
|
+
if (typeof newKey !== 'undefined') {
|
1125
|
+
payload['newKey'] = newKey;
|
1126
|
+
}
|
1127
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1128
|
+
|
1129
|
+
const apiHeaders: { [header: string]: string } = {
|
1130
|
+
'content-type': 'application/json',
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
return await this.client.call(
|
1134
|
+
'patch',
|
1135
|
+
uri,
|
1136
|
+
apiHeaders,
|
1137
|
+
payload,
|
1138
|
+
);
|
1139
|
+
}
|
1140
|
+
/**
|
1141
|
+
* Create IP address attribute
|
1142
|
+
*
|
1143
|
+
* Create IP address attribute.
|
1144
|
+
|
1145
|
+
*
|
1146
|
+
* @param {string} databaseId
|
1147
|
+
* @param {string} collectionId
|
1148
|
+
* @param {string} key
|
1149
|
+
* @param {boolean} required
|
1150
|
+
* @param {string} xdefault
|
1151
|
+
* @param {boolean} array
|
1152
|
+
* @throws {AppcondaException}
|
1153
|
+
* @returns {Promise<Models.AttributeIp>}
|
1154
|
+
*/
|
1155
|
+
async createIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeIp> {
|
1156
|
+
if (typeof databaseId === 'undefined') {
|
1157
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1158
|
+
}
|
1159
|
+
if (typeof collectionId === 'undefined') {
|
1160
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1161
|
+
}
|
1162
|
+
if (typeof key === 'undefined') {
|
1163
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1164
|
+
}
|
1165
|
+
if (typeof required === 'undefined') {
|
1166
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1167
|
+
}
|
1168
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1169
|
+
const payload: Payload = {};
|
1170
|
+
if (typeof key !== 'undefined') {
|
1171
|
+
payload['key'] = key;
|
1172
|
+
}
|
1173
|
+
if (typeof required !== 'undefined') {
|
1174
|
+
payload['required'] = required;
|
1175
|
+
}
|
1176
|
+
if (typeof xdefault !== 'undefined') {
|
1177
|
+
payload['default'] = xdefault;
|
1178
|
+
}
|
1179
|
+
if (typeof array !== 'undefined') {
|
1180
|
+
payload['array'] = array;
|
1181
|
+
}
|
1182
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1183
|
+
|
1184
|
+
const apiHeaders: { [header: string]: string } = {
|
1185
|
+
'content-type': 'application/json',
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
return await this.client.call(
|
1189
|
+
'post',
|
1190
|
+
uri,
|
1191
|
+
apiHeaders,
|
1192
|
+
payload,
|
1193
|
+
);
|
1194
|
+
}
|
1195
|
+
/**
|
1196
|
+
* Update IP address attribute
|
1197
|
+
*
|
1198
|
+
* Update an ip attribute. Changing the `default` value will not update already existing documents.
|
1199
|
+
|
1200
|
+
*
|
1201
|
+
* @param {string} databaseId
|
1202
|
+
* @param {string} collectionId
|
1203
|
+
* @param {string} key
|
1204
|
+
* @param {boolean} required
|
1205
|
+
* @param {string} xdefault
|
1206
|
+
* @param {string} newKey
|
1207
|
+
* @throws {AppcondaException}
|
1208
|
+
* @returns {Promise<Models.AttributeIp>}
|
1209
|
+
*/
|
1210
|
+
async updateIpAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeIp> {
|
1211
|
+
if (typeof databaseId === 'undefined') {
|
1212
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1213
|
+
}
|
1214
|
+
if (typeof collectionId === 'undefined') {
|
1215
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1216
|
+
}
|
1217
|
+
if (typeof key === 'undefined') {
|
1218
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1219
|
+
}
|
1220
|
+
if (typeof required === 'undefined') {
|
1221
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1222
|
+
}
|
1223
|
+
if (typeof xdefault === 'undefined') {
|
1224
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
1225
|
+
}
|
1226
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1227
|
+
const payload: Payload = {};
|
1228
|
+
if (typeof required !== 'undefined') {
|
1229
|
+
payload['required'] = required;
|
1230
|
+
}
|
1231
|
+
if (typeof xdefault !== 'undefined') {
|
1232
|
+
payload['default'] = xdefault;
|
1233
|
+
}
|
1234
|
+
if (typeof newKey !== 'undefined') {
|
1235
|
+
payload['newKey'] = newKey;
|
1236
|
+
}
|
1237
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1238
|
+
|
1239
|
+
const apiHeaders: { [header: string]: string } = {
|
1240
|
+
'content-type': 'application/json',
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
return await this.client.call(
|
1244
|
+
'patch',
|
1245
|
+
uri,
|
1246
|
+
apiHeaders,
|
1247
|
+
payload,
|
1248
|
+
);
|
1249
|
+
}
|
1250
|
+
/**
|
1251
|
+
* Create relationship attribute
|
1252
|
+
*
|
1253
|
+
* Create relationship attribute. [Learn more about relationship attributes](https://appconda.io/docs/databases-relationships#relationship-attributes).
|
1254
|
+
|
1255
|
+
*
|
1256
|
+
* @param {string} databaseId
|
1257
|
+
* @param {string} collectionId
|
1258
|
+
* @param {string} relatedCollectionId
|
1259
|
+
* @param {RelationshipType} type
|
1260
|
+
* @param {boolean} twoWay
|
1261
|
+
* @param {string} key
|
1262
|
+
* @param {string} twoWayKey
|
1263
|
+
* @param {RelationMutate} onDelete
|
1264
|
+
* @throws {AppcondaException}
|
1265
|
+
* @returns {Promise<Models.AttributeRelationship>}
|
1266
|
+
*/
|
1267
|
+
async createRelationshipAttribute(databaseId: string, collectionId: string, relatedCollectionId: string, type: RelationshipType, twoWay?: boolean, key?: string, twoWayKey?: string, onDelete?: RelationMutate): Promise<Models.AttributeRelationship> {
|
1268
|
+
if (typeof databaseId === 'undefined') {
|
1269
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1270
|
+
}
|
1271
|
+
if (typeof collectionId === 'undefined') {
|
1272
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1273
|
+
}
|
1274
|
+
if (typeof relatedCollectionId === 'undefined') {
|
1275
|
+
throw new AppcondaException('Missing required parameter: "relatedCollectionId"');
|
1276
|
+
}
|
1277
|
+
if (typeof type === 'undefined') {
|
1278
|
+
throw new AppcondaException('Missing required parameter: "type"');
|
1279
|
+
}
|
1280
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1281
|
+
const payload: Payload = {};
|
1282
|
+
if (typeof relatedCollectionId !== 'undefined') {
|
1283
|
+
payload['relatedCollectionId'] = relatedCollectionId;
|
1284
|
+
}
|
1285
|
+
if (typeof type !== 'undefined') {
|
1286
|
+
payload['type'] = type;
|
1287
|
+
}
|
1288
|
+
if (typeof twoWay !== 'undefined') {
|
1289
|
+
payload['twoWay'] = twoWay;
|
1290
|
+
}
|
1291
|
+
if (typeof key !== 'undefined') {
|
1292
|
+
payload['key'] = key;
|
1293
|
+
}
|
1294
|
+
if (typeof twoWayKey !== 'undefined') {
|
1295
|
+
payload['twoWayKey'] = twoWayKey;
|
1296
|
+
}
|
1297
|
+
if (typeof onDelete !== 'undefined') {
|
1298
|
+
payload['onDelete'] = onDelete;
|
1299
|
+
}
|
1300
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1301
|
+
|
1302
|
+
const apiHeaders: { [header: string]: string } = {
|
1303
|
+
'content-type': 'application/json',
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
return await this.client.call(
|
1307
|
+
'post',
|
1308
|
+
uri,
|
1309
|
+
apiHeaders,
|
1310
|
+
payload,
|
1311
|
+
);
|
1312
|
+
}
|
1313
|
+
/**
|
1314
|
+
* Create string attribute
|
1315
|
+
*
|
1316
|
+
* Create a string attribute.
|
1317
|
+
|
1318
|
+
*
|
1319
|
+
* @param {string} databaseId
|
1320
|
+
* @param {string} collectionId
|
1321
|
+
* @param {string} key
|
1322
|
+
* @param {number} size
|
1323
|
+
* @param {boolean} required
|
1324
|
+
* @param {string} xdefault
|
1325
|
+
* @param {boolean} array
|
1326
|
+
* @param {boolean} encrypt
|
1327
|
+
* @throws {AppcondaException}
|
1328
|
+
* @returns {Promise<Models.AttributeString>}
|
1329
|
+
*/
|
1330
|
+
async createStringAttribute(databaseId: string, collectionId: string, key: string, size: number, required: boolean, xdefault?: string, array?: boolean, encrypt?: boolean): Promise<Models.AttributeString> {
|
1331
|
+
if (typeof databaseId === 'undefined') {
|
1332
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1333
|
+
}
|
1334
|
+
if (typeof collectionId === 'undefined') {
|
1335
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1336
|
+
}
|
1337
|
+
if (typeof key === 'undefined') {
|
1338
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1339
|
+
}
|
1340
|
+
if (typeof size === 'undefined') {
|
1341
|
+
throw new AppcondaException('Missing required parameter: "size"');
|
1342
|
+
}
|
1343
|
+
if (typeof required === 'undefined') {
|
1344
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1345
|
+
}
|
1346
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1347
|
+
const payload: Payload = {};
|
1348
|
+
if (typeof key !== 'undefined') {
|
1349
|
+
payload['key'] = key;
|
1350
|
+
}
|
1351
|
+
if (typeof size !== 'undefined') {
|
1352
|
+
payload['size'] = size;
|
1353
|
+
}
|
1354
|
+
if (typeof required !== 'undefined') {
|
1355
|
+
payload['required'] = required;
|
1356
|
+
}
|
1357
|
+
if (typeof xdefault !== 'undefined') {
|
1358
|
+
payload['default'] = xdefault;
|
1359
|
+
}
|
1360
|
+
if (typeof array !== 'undefined') {
|
1361
|
+
payload['array'] = array;
|
1362
|
+
}
|
1363
|
+
if (typeof encrypt !== 'undefined') {
|
1364
|
+
payload['encrypt'] = encrypt;
|
1365
|
+
}
|
1366
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1367
|
+
|
1368
|
+
const apiHeaders: { [header: string]: string } = {
|
1369
|
+
'content-type': 'application/json',
|
1370
|
+
}
|
1371
|
+
|
1372
|
+
return await this.client.call(
|
1373
|
+
'post',
|
1374
|
+
uri,
|
1375
|
+
apiHeaders,
|
1376
|
+
payload,
|
1377
|
+
);
|
1378
|
+
}
|
1379
|
+
/**
|
1380
|
+
* Update string attribute
|
1381
|
+
*
|
1382
|
+
* Update a string attribute. Changing the `default` value will not update already existing documents.
|
1383
|
+
|
1384
|
+
*
|
1385
|
+
* @param {string} databaseId
|
1386
|
+
* @param {string} collectionId
|
1387
|
+
* @param {string} key
|
1388
|
+
* @param {boolean} required
|
1389
|
+
* @param {string} xdefault
|
1390
|
+
* @param {number} size
|
1391
|
+
* @param {string} newKey
|
1392
|
+
* @throws {AppcondaException}
|
1393
|
+
* @returns {Promise<Models.AttributeString>}
|
1394
|
+
*/
|
1395
|
+
async updateStringAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, size?: number, newKey?: string): Promise<Models.AttributeString> {
|
1396
|
+
if (typeof databaseId === 'undefined') {
|
1397
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1398
|
+
}
|
1399
|
+
if (typeof collectionId === 'undefined') {
|
1400
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1401
|
+
}
|
1402
|
+
if (typeof key === 'undefined') {
|
1403
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1404
|
+
}
|
1405
|
+
if (typeof required === 'undefined') {
|
1406
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1407
|
+
}
|
1408
|
+
if (typeof xdefault === 'undefined') {
|
1409
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
1410
|
+
}
|
1411
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/string/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1412
|
+
const payload: Payload = {};
|
1413
|
+
if (typeof required !== 'undefined') {
|
1414
|
+
payload['required'] = required;
|
1415
|
+
}
|
1416
|
+
if (typeof xdefault !== 'undefined') {
|
1417
|
+
payload['default'] = xdefault;
|
1418
|
+
}
|
1419
|
+
if (typeof size !== 'undefined') {
|
1420
|
+
payload['size'] = size;
|
1421
|
+
}
|
1422
|
+
if (typeof newKey !== 'undefined') {
|
1423
|
+
payload['newKey'] = newKey;
|
1424
|
+
}
|
1425
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1426
|
+
|
1427
|
+
const apiHeaders: { [header: string]: string } = {
|
1428
|
+
'content-type': 'application/json',
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
return await this.client.call(
|
1432
|
+
'patch',
|
1433
|
+
uri,
|
1434
|
+
apiHeaders,
|
1435
|
+
payload,
|
1436
|
+
);
|
1437
|
+
}
|
1438
|
+
/**
|
1439
|
+
* Create URL attribute
|
1440
|
+
*
|
1441
|
+
* Create a URL attribute.
|
1442
|
+
|
1443
|
+
*
|
1444
|
+
* @param {string} databaseId
|
1445
|
+
* @param {string} collectionId
|
1446
|
+
* @param {string} key
|
1447
|
+
* @param {boolean} required
|
1448
|
+
* @param {string} xdefault
|
1449
|
+
* @param {boolean} array
|
1450
|
+
* @throws {AppcondaException}
|
1451
|
+
* @returns {Promise<Models.AttributeUrl>}
|
1452
|
+
*/
|
1453
|
+
async createUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, array?: boolean): Promise<Models.AttributeUrl> {
|
1454
|
+
if (typeof databaseId === 'undefined') {
|
1455
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1456
|
+
}
|
1457
|
+
if (typeof collectionId === 'undefined') {
|
1458
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1459
|
+
}
|
1460
|
+
if (typeof key === 'undefined') {
|
1461
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1462
|
+
}
|
1463
|
+
if (typeof required === 'undefined') {
|
1464
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1465
|
+
}
|
1466
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1467
|
+
const payload: Payload = {};
|
1468
|
+
if (typeof key !== 'undefined') {
|
1469
|
+
payload['key'] = key;
|
1470
|
+
}
|
1471
|
+
if (typeof required !== 'undefined') {
|
1472
|
+
payload['required'] = required;
|
1473
|
+
}
|
1474
|
+
if (typeof xdefault !== 'undefined') {
|
1475
|
+
payload['default'] = xdefault;
|
1476
|
+
}
|
1477
|
+
if (typeof array !== 'undefined') {
|
1478
|
+
payload['array'] = array;
|
1479
|
+
}
|
1480
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1481
|
+
|
1482
|
+
const apiHeaders: { [header: string]: string } = {
|
1483
|
+
'content-type': 'application/json',
|
1484
|
+
}
|
1485
|
+
|
1486
|
+
return await this.client.call(
|
1487
|
+
'post',
|
1488
|
+
uri,
|
1489
|
+
apiHeaders,
|
1490
|
+
payload,
|
1491
|
+
);
|
1492
|
+
}
|
1493
|
+
/**
|
1494
|
+
* Update URL attribute
|
1495
|
+
*
|
1496
|
+
* Update an url attribute. Changing the `default` value will not update already existing documents.
|
1497
|
+
|
1498
|
+
*
|
1499
|
+
* @param {string} databaseId
|
1500
|
+
* @param {string} collectionId
|
1501
|
+
* @param {string} key
|
1502
|
+
* @param {boolean} required
|
1503
|
+
* @param {string} xdefault
|
1504
|
+
* @param {string} newKey
|
1505
|
+
* @throws {AppcondaException}
|
1506
|
+
* @returns {Promise<Models.AttributeUrl>}
|
1507
|
+
*/
|
1508
|
+
async updateUrlAttribute(databaseId: string, collectionId: string, key: string, required: boolean, xdefault?: string, newKey?: string): Promise<Models.AttributeUrl> {
|
1509
|
+
if (typeof databaseId === 'undefined') {
|
1510
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1511
|
+
}
|
1512
|
+
if (typeof collectionId === 'undefined') {
|
1513
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1514
|
+
}
|
1515
|
+
if (typeof key === 'undefined') {
|
1516
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1517
|
+
}
|
1518
|
+
if (typeof required === 'undefined') {
|
1519
|
+
throw new AppcondaException('Missing required parameter: "required"');
|
1520
|
+
}
|
1521
|
+
if (typeof xdefault === 'undefined') {
|
1522
|
+
throw new AppcondaException('Missing required parameter: "xdefault"');
|
1523
|
+
}
|
1524
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/url/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1525
|
+
const payload: Payload = {};
|
1526
|
+
if (typeof required !== 'undefined') {
|
1527
|
+
payload['required'] = required;
|
1528
|
+
}
|
1529
|
+
if (typeof xdefault !== 'undefined') {
|
1530
|
+
payload['default'] = xdefault;
|
1531
|
+
}
|
1532
|
+
if (typeof newKey !== 'undefined') {
|
1533
|
+
payload['newKey'] = newKey;
|
1534
|
+
}
|
1535
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1536
|
+
|
1537
|
+
const apiHeaders: { [header: string]: string } = {
|
1538
|
+
'content-type': 'application/json',
|
1539
|
+
}
|
1540
|
+
|
1541
|
+
return await this.client.call(
|
1542
|
+
'patch',
|
1543
|
+
uri,
|
1544
|
+
apiHeaders,
|
1545
|
+
payload,
|
1546
|
+
);
|
1547
|
+
}
|
1548
|
+
/**
|
1549
|
+
* Get attribute
|
1550
|
+
*
|
1551
|
+
* Get attribute by ID.
|
1552
|
+
*
|
1553
|
+
* @param {string} databaseId
|
1554
|
+
* @param {string} collectionId
|
1555
|
+
* @param {string} key
|
1556
|
+
* @throws {AppcondaException}
|
1557
|
+
* @returns {Promise<{}>}
|
1558
|
+
*/
|
1559
|
+
async getAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
1560
|
+
if (typeof databaseId === 'undefined') {
|
1561
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1562
|
+
}
|
1563
|
+
if (typeof collectionId === 'undefined') {
|
1564
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1565
|
+
}
|
1566
|
+
if (typeof key === 'undefined') {
|
1567
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1568
|
+
}
|
1569
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1570
|
+
const payload: Payload = {};
|
1571
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1572
|
+
|
1573
|
+
const apiHeaders: { [header: string]: string } = {
|
1574
|
+
'content-type': 'application/json',
|
1575
|
+
}
|
1576
|
+
|
1577
|
+
return await this.client.call(
|
1578
|
+
'get',
|
1579
|
+
uri,
|
1580
|
+
apiHeaders,
|
1581
|
+
payload,
|
1582
|
+
);
|
1583
|
+
}
|
1584
|
+
/**
|
1585
|
+
* Delete attribute
|
1586
|
+
*
|
1587
|
+
* Deletes an attribute.
|
1588
|
+
*
|
1589
|
+
* @param {string} databaseId
|
1590
|
+
* @param {string} collectionId
|
1591
|
+
* @param {string} key
|
1592
|
+
* @throws {AppcondaException}
|
1593
|
+
* @returns {Promise<{}>}
|
1594
|
+
*/
|
1595
|
+
async deleteAttribute(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
1596
|
+
if (typeof databaseId === 'undefined') {
|
1597
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1598
|
+
}
|
1599
|
+
if (typeof collectionId === 'undefined') {
|
1600
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1601
|
+
}
|
1602
|
+
if (typeof key === 'undefined') {
|
1603
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1604
|
+
}
|
1605
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1606
|
+
const payload: Payload = {};
|
1607
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1608
|
+
|
1609
|
+
const apiHeaders: { [header: string]: string } = {
|
1610
|
+
'content-type': 'application/json',
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
return await this.client.call(
|
1614
|
+
'delete',
|
1615
|
+
uri,
|
1616
|
+
apiHeaders,
|
1617
|
+
payload,
|
1618
|
+
);
|
1619
|
+
}
|
1620
|
+
/**
|
1621
|
+
* Update relationship attribute
|
1622
|
+
*
|
1623
|
+
* Update relationship attribute. [Learn more about relationship attributes](https://appconda.io/docs/databases-relationships#relationship-attributes).
|
1624
|
+
|
1625
|
+
*
|
1626
|
+
* @param {string} databaseId
|
1627
|
+
* @param {string} collectionId
|
1628
|
+
* @param {string} key
|
1629
|
+
* @param {RelationMutate} onDelete
|
1630
|
+
* @param {string} newKey
|
1631
|
+
* @throws {AppcondaException}
|
1632
|
+
* @returns {Promise<Models.AttributeRelationship>}
|
1633
|
+
*/
|
1634
|
+
async updateRelationshipAttribute(databaseId: string, collectionId: string, key: string, onDelete?: RelationMutate, newKey?: string): Promise<Models.AttributeRelationship> {
|
1635
|
+
if (typeof databaseId === 'undefined') {
|
1636
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1637
|
+
}
|
1638
|
+
if (typeof collectionId === 'undefined') {
|
1639
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1640
|
+
}
|
1641
|
+
if (typeof key === 'undefined') {
|
1642
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1643
|
+
}
|
1644
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1645
|
+
const payload: Payload = {};
|
1646
|
+
if (typeof onDelete !== 'undefined') {
|
1647
|
+
payload['onDelete'] = onDelete;
|
1648
|
+
}
|
1649
|
+
if (typeof newKey !== 'undefined') {
|
1650
|
+
payload['newKey'] = newKey;
|
1651
|
+
}
|
1652
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1653
|
+
|
1654
|
+
const apiHeaders: { [header: string]: string } = {
|
1655
|
+
'content-type': 'application/json',
|
1656
|
+
}
|
1657
|
+
|
1658
|
+
return await this.client.call(
|
1659
|
+
'patch',
|
1660
|
+
uri,
|
1661
|
+
apiHeaders,
|
1662
|
+
payload,
|
1663
|
+
);
|
1664
|
+
}
|
1665
|
+
/**
|
1666
|
+
* List documents
|
1667
|
+
*
|
1668
|
+
* Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
|
1669
|
+
*
|
1670
|
+
* @param {string} databaseId
|
1671
|
+
* @param {string} collectionId
|
1672
|
+
* @param {string[]} queries
|
1673
|
+
* @throws {AppcondaException}
|
1674
|
+
* @returns {Promise<Models.DocumentList<Document>>}
|
1675
|
+
*/
|
1676
|
+
async listDocuments<Document extends Models.Document>(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.DocumentList<Document>> {
|
1677
|
+
if (typeof databaseId === 'undefined') {
|
1678
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1679
|
+
}
|
1680
|
+
if (typeof collectionId === 'undefined') {
|
1681
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1682
|
+
}
|
1683
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1684
|
+
const payload: Payload = {};
|
1685
|
+
if (typeof queries !== 'undefined') {
|
1686
|
+
payload['queries'] = queries;
|
1687
|
+
}
|
1688
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1689
|
+
|
1690
|
+
const apiHeaders: { [header: string]: string } = {
|
1691
|
+
'content-type': 'application/json',
|
1692
|
+
}
|
1693
|
+
|
1694
|
+
return await this.client.call(
|
1695
|
+
'get',
|
1696
|
+
uri,
|
1697
|
+
apiHeaders,
|
1698
|
+
payload,
|
1699
|
+
);
|
1700
|
+
}
|
1701
|
+
/**
|
1702
|
+
* Create document
|
1703
|
+
*
|
1704
|
+
* Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https://appconda.io/docs/server/databases#databasesCreateCollection) API or directly from your database console.
|
1705
|
+
*
|
1706
|
+
* @param {string} databaseId
|
1707
|
+
* @param {string} collectionId
|
1708
|
+
* @param {string} documentId
|
1709
|
+
* @param {Omit<Document, keyof Models.Document>} data
|
1710
|
+
* @param {string[]} permissions
|
1711
|
+
* @throws {AppcondaException}
|
1712
|
+
* @returns {Promise<Document>}
|
1713
|
+
*/
|
1714
|
+
async createDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data: Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document> {
|
1715
|
+
if (typeof databaseId === 'undefined') {
|
1716
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1717
|
+
}
|
1718
|
+
if (typeof collectionId === 'undefined') {
|
1719
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1720
|
+
}
|
1721
|
+
if (typeof documentId === 'undefined') {
|
1722
|
+
throw new AppcondaException('Missing required parameter: "documentId"');
|
1723
|
+
}
|
1724
|
+
if (typeof data === 'undefined') {
|
1725
|
+
throw new AppcondaException('Missing required parameter: "data"');
|
1726
|
+
}
|
1727
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1728
|
+
const payload: Payload = {};
|
1729
|
+
if (typeof documentId !== 'undefined') {
|
1730
|
+
payload['documentId'] = documentId;
|
1731
|
+
}
|
1732
|
+
if (typeof data !== 'undefined') {
|
1733
|
+
payload['data'] = data;
|
1734
|
+
}
|
1735
|
+
if (typeof permissions !== 'undefined') {
|
1736
|
+
payload['permissions'] = permissions;
|
1737
|
+
}
|
1738
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1739
|
+
|
1740
|
+
const apiHeaders: { [header: string]: string } = {
|
1741
|
+
'content-type': 'application/json',
|
1742
|
+
}
|
1743
|
+
|
1744
|
+
return await this.client.call(
|
1745
|
+
'post',
|
1746
|
+
uri,
|
1747
|
+
apiHeaders,
|
1748
|
+
payload,
|
1749
|
+
);
|
1750
|
+
}
|
1751
|
+
/**
|
1752
|
+
* Get document
|
1753
|
+
*
|
1754
|
+
* Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
|
1755
|
+
*
|
1756
|
+
* @param {string} databaseId
|
1757
|
+
* @param {string} collectionId
|
1758
|
+
* @param {string} documentId
|
1759
|
+
* @param {string[]} queries
|
1760
|
+
* @throws {AppcondaException}
|
1761
|
+
* @returns {Promise<Document>}
|
1762
|
+
*/
|
1763
|
+
async getDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, queries?: string[]): Promise<Document> {
|
1764
|
+
if (typeof databaseId === 'undefined') {
|
1765
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1766
|
+
}
|
1767
|
+
if (typeof collectionId === 'undefined') {
|
1768
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1769
|
+
}
|
1770
|
+
if (typeof documentId === 'undefined') {
|
1771
|
+
throw new AppcondaException('Missing required parameter: "documentId"');
|
1772
|
+
}
|
1773
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
1774
|
+
const payload: Payload = {};
|
1775
|
+
if (typeof queries !== 'undefined') {
|
1776
|
+
payload['queries'] = queries;
|
1777
|
+
}
|
1778
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1779
|
+
|
1780
|
+
const apiHeaders: { [header: string]: string } = {
|
1781
|
+
'content-type': 'application/json',
|
1782
|
+
}
|
1783
|
+
|
1784
|
+
return await this.client.call(
|
1785
|
+
'get',
|
1786
|
+
uri,
|
1787
|
+
apiHeaders,
|
1788
|
+
payload,
|
1789
|
+
);
|
1790
|
+
}
|
1791
|
+
/**
|
1792
|
+
* Update document
|
1793
|
+
*
|
1794
|
+
* Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
1795
|
+
*
|
1796
|
+
* @param {string} databaseId
|
1797
|
+
* @param {string} collectionId
|
1798
|
+
* @param {string} documentId
|
1799
|
+
* @param {Partial<Omit<Document, keyof Models.Document>>} data
|
1800
|
+
* @param {string[]} permissions
|
1801
|
+
* @throws {AppcondaException}
|
1802
|
+
* @returns {Promise<Document>}
|
1803
|
+
*/
|
1804
|
+
async updateDocument<Document extends Models.Document>(databaseId: string, collectionId: string, documentId: string, data?: Partial<Omit<Document, keyof Models.Document>>, permissions?: string[]): Promise<Document> {
|
1805
|
+
if (typeof databaseId === 'undefined') {
|
1806
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1807
|
+
}
|
1808
|
+
if (typeof collectionId === 'undefined') {
|
1809
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1810
|
+
}
|
1811
|
+
if (typeof documentId === 'undefined') {
|
1812
|
+
throw new AppcondaException('Missing required parameter: "documentId"');
|
1813
|
+
}
|
1814
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
1815
|
+
const payload: Payload = {};
|
1816
|
+
if (typeof data !== 'undefined') {
|
1817
|
+
payload['data'] = data;
|
1818
|
+
}
|
1819
|
+
if (typeof permissions !== 'undefined') {
|
1820
|
+
payload['permissions'] = permissions;
|
1821
|
+
}
|
1822
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1823
|
+
|
1824
|
+
const apiHeaders: { [header: string]: string } = {
|
1825
|
+
'content-type': 'application/json',
|
1826
|
+
}
|
1827
|
+
|
1828
|
+
return await this.client.call(
|
1829
|
+
'patch',
|
1830
|
+
uri,
|
1831
|
+
apiHeaders,
|
1832
|
+
payload,
|
1833
|
+
);
|
1834
|
+
}
|
1835
|
+
/**
|
1836
|
+
* Delete document
|
1837
|
+
*
|
1838
|
+
* Delete a document by its unique ID.
|
1839
|
+
*
|
1840
|
+
* @param {string} databaseId
|
1841
|
+
* @param {string} collectionId
|
1842
|
+
* @param {string} documentId
|
1843
|
+
* @throws {AppcondaException}
|
1844
|
+
* @returns {Promise<{}>}
|
1845
|
+
*/
|
1846
|
+
async deleteDocument(databaseId: string, collectionId: string, documentId: string): Promise<{}> {
|
1847
|
+
if (typeof databaseId === 'undefined') {
|
1848
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1849
|
+
}
|
1850
|
+
if (typeof collectionId === 'undefined') {
|
1851
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1852
|
+
}
|
1853
|
+
if (typeof documentId === 'undefined') {
|
1854
|
+
throw new AppcondaException('Missing required parameter: "documentId"');
|
1855
|
+
}
|
1856
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
1857
|
+
const payload: Payload = {};
|
1858
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1859
|
+
|
1860
|
+
const apiHeaders: { [header: string]: string } = {
|
1861
|
+
'content-type': 'application/json',
|
1862
|
+
}
|
1863
|
+
|
1864
|
+
return await this.client.call(
|
1865
|
+
'delete',
|
1866
|
+
uri,
|
1867
|
+
apiHeaders,
|
1868
|
+
payload,
|
1869
|
+
);
|
1870
|
+
}
|
1871
|
+
/**
|
1872
|
+
* List indexes
|
1873
|
+
*
|
1874
|
+
* List indexes in the collection.
|
1875
|
+
*
|
1876
|
+
* @param {string} databaseId
|
1877
|
+
* @param {string} collectionId
|
1878
|
+
* @param {string[]} queries
|
1879
|
+
* @throws {AppcondaException}
|
1880
|
+
* @returns {Promise<Models.IndexList>}
|
1881
|
+
*/
|
1882
|
+
async listIndexes(databaseId: string, collectionId: string, queries?: string[]): Promise<Models.IndexList> {
|
1883
|
+
if (typeof databaseId === 'undefined') {
|
1884
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1885
|
+
}
|
1886
|
+
if (typeof collectionId === 'undefined') {
|
1887
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1888
|
+
}
|
1889
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1890
|
+
const payload: Payload = {};
|
1891
|
+
if (typeof queries !== 'undefined') {
|
1892
|
+
payload['queries'] = queries;
|
1893
|
+
}
|
1894
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1895
|
+
|
1896
|
+
const apiHeaders: { [header: string]: string } = {
|
1897
|
+
'content-type': 'application/json',
|
1898
|
+
}
|
1899
|
+
|
1900
|
+
return await this.client.call(
|
1901
|
+
'get',
|
1902
|
+
uri,
|
1903
|
+
apiHeaders,
|
1904
|
+
payload,
|
1905
|
+
);
|
1906
|
+
}
|
1907
|
+
/**
|
1908
|
+
* Create index
|
1909
|
+
*
|
1910
|
+
* Creates an index on the attributes listed. Your index should include all the attributes you will query in a single request.
|
1911
|
+
Attributes can be `key`, `fulltext`, and `unique`.
|
1912
|
+
*
|
1913
|
+
* @param {string} databaseId
|
1914
|
+
* @param {string} collectionId
|
1915
|
+
* @param {string} key
|
1916
|
+
* @param {IndexType} type
|
1917
|
+
* @param {string[]} attributes
|
1918
|
+
* @param {string[]} orders
|
1919
|
+
* @throws {AppcondaException}
|
1920
|
+
* @returns {Promise<Models.Index>}
|
1921
|
+
*/
|
1922
|
+
async createIndex(databaseId: string, collectionId: string, key: string, type: IndexType, attributes: string[], orders?: string[]): Promise<Models.Index> {
|
1923
|
+
if (typeof databaseId === 'undefined') {
|
1924
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1925
|
+
}
|
1926
|
+
if (typeof collectionId === 'undefined') {
|
1927
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1928
|
+
}
|
1929
|
+
if (typeof key === 'undefined') {
|
1930
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1931
|
+
}
|
1932
|
+
if (typeof type === 'undefined') {
|
1933
|
+
throw new AppcondaException('Missing required parameter: "type"');
|
1934
|
+
}
|
1935
|
+
if (typeof attributes === 'undefined') {
|
1936
|
+
throw new AppcondaException('Missing required parameter: "attributes"');
|
1937
|
+
}
|
1938
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId);
|
1939
|
+
const payload: Payload = {};
|
1940
|
+
if (typeof key !== 'undefined') {
|
1941
|
+
payload['key'] = key;
|
1942
|
+
}
|
1943
|
+
if (typeof type !== 'undefined') {
|
1944
|
+
payload['type'] = type;
|
1945
|
+
}
|
1946
|
+
if (typeof attributes !== 'undefined') {
|
1947
|
+
payload['attributes'] = attributes;
|
1948
|
+
}
|
1949
|
+
if (typeof orders !== 'undefined') {
|
1950
|
+
payload['orders'] = orders;
|
1951
|
+
}
|
1952
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1953
|
+
|
1954
|
+
const apiHeaders: { [header: string]: string } = {
|
1955
|
+
'content-type': 'application/json',
|
1956
|
+
}
|
1957
|
+
|
1958
|
+
return await this.client.call(
|
1959
|
+
'post',
|
1960
|
+
uri,
|
1961
|
+
apiHeaders,
|
1962
|
+
payload,
|
1963
|
+
);
|
1964
|
+
}
|
1965
|
+
/**
|
1966
|
+
* Get index
|
1967
|
+
*
|
1968
|
+
* Get index by ID.
|
1969
|
+
*
|
1970
|
+
* @param {string} databaseId
|
1971
|
+
* @param {string} collectionId
|
1972
|
+
* @param {string} key
|
1973
|
+
* @throws {AppcondaException}
|
1974
|
+
* @returns {Promise<Models.Index>}
|
1975
|
+
*/
|
1976
|
+
async getIndex(databaseId: string, collectionId: string, key: string): Promise<Models.Index> {
|
1977
|
+
if (typeof databaseId === 'undefined') {
|
1978
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
1979
|
+
}
|
1980
|
+
if (typeof collectionId === 'undefined') {
|
1981
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
1982
|
+
}
|
1983
|
+
if (typeof key === 'undefined') {
|
1984
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
1985
|
+
}
|
1986
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
1987
|
+
const payload: Payload = {};
|
1988
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
1989
|
+
|
1990
|
+
const apiHeaders: { [header: string]: string } = {
|
1991
|
+
'content-type': 'application/json',
|
1992
|
+
}
|
1993
|
+
|
1994
|
+
return await this.client.call(
|
1995
|
+
'get',
|
1996
|
+
uri,
|
1997
|
+
apiHeaders,
|
1998
|
+
payload,
|
1999
|
+
);
|
2000
|
+
}
|
2001
|
+
/**
|
2002
|
+
* Delete index
|
2003
|
+
*
|
2004
|
+
* Delete an index.
|
2005
|
+
*
|
2006
|
+
* @param {string} databaseId
|
2007
|
+
* @param {string} collectionId
|
2008
|
+
* @param {string} key
|
2009
|
+
* @throws {AppcondaException}
|
2010
|
+
* @returns {Promise<{}>}
|
2011
|
+
*/
|
2012
|
+
async deleteIndex(databaseId: string, collectionId: string, key: string): Promise<{}> {
|
2013
|
+
if (typeof databaseId === 'undefined') {
|
2014
|
+
throw new AppcondaException('Missing required parameter: "databaseId"');
|
2015
|
+
}
|
2016
|
+
if (typeof collectionId === 'undefined') {
|
2017
|
+
throw new AppcondaException('Missing required parameter: "collectionId"');
|
2018
|
+
}
|
2019
|
+
if (typeof key === 'undefined') {
|
2020
|
+
throw new AppcondaException('Missing required parameter: "key"');
|
2021
|
+
}
|
2022
|
+
const apiPath = '/databases/{databaseId}/collections/{collectionId}/indexes/{key}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{key}', key);
|
2023
|
+
const payload: Payload = {};
|
2024
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
2025
|
+
|
2026
|
+
const apiHeaders: { [header: string]: string } = {
|
2027
|
+
'content-type': 'application/json',
|
2028
|
+
}
|
2029
|
+
|
2030
|
+
return await this.client.call(
|
2031
|
+
'delete',
|
2032
|
+
uri,
|
2033
|
+
apiHeaders,
|
2034
|
+
payload,
|
2035
|
+
);
|
2036
|
+
}
|
2037
|
+
}
|