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