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
package/lib/services/storage.js
DELETED
|
@@ -1,663 +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 Storage extends Service {
|
|
12
|
-
|
|
13
|
-
constructor(client)
|
|
14
|
-
{
|
|
15
|
-
super(client);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* List buckets
|
|
21
|
-
*
|
|
22
|
-
* Get a list of all the storage buckets. You can use the query params to
|
|
23
|
-
* filter your results.
|
|
24
|
-
*
|
|
25
|
-
* @param {string[]} queries
|
|
26
|
-
* @param {string} search
|
|
27
|
-
* @throws {AppwriteException}
|
|
28
|
-
* @returns {Promise}
|
|
29
|
-
*/
|
|
30
|
-
async listBuckets(queries, search) {
|
|
31
|
-
const apiPath = '/storage/buckets';
|
|
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 bucket
|
|
49
|
-
*
|
|
50
|
-
* Create a new storage bucket.
|
|
51
|
-
*
|
|
52
|
-
* @param {string} bucketId
|
|
53
|
-
* @param {string} name
|
|
54
|
-
* @param {string[]} permissions
|
|
55
|
-
* @param {boolean} fileSecurity
|
|
56
|
-
* @param {boolean} enabled
|
|
57
|
-
* @param {number} maximumFileSize
|
|
58
|
-
* @param {string[]} allowedFileExtensions
|
|
59
|
-
* @param {Compression} compression
|
|
60
|
-
* @param {boolean} encryption
|
|
61
|
-
* @param {boolean} antivirus
|
|
62
|
-
* @throws {AppwriteException}
|
|
63
|
-
* @returns {Promise}
|
|
64
|
-
*/
|
|
65
|
-
async createBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
|
|
66
|
-
const apiPath = '/storage/buckets';
|
|
67
|
-
let payload = {};
|
|
68
|
-
if (typeof bucketId === 'undefined') {
|
|
69
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (typeof name === 'undefined') {
|
|
73
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (typeof bucketId !== 'undefined') {
|
|
78
|
-
payload['bucketId'] = bucketId;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (typeof name !== 'undefined') {
|
|
82
|
-
payload['name'] = name;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (typeof permissions !== 'undefined') {
|
|
86
|
-
payload['permissions'] = permissions;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (typeof fileSecurity !== 'undefined') {
|
|
90
|
-
payload['fileSecurity'] = fileSecurity;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (typeof enabled !== 'undefined') {
|
|
94
|
-
payload['enabled'] = enabled;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (typeof maximumFileSize !== 'undefined') {
|
|
98
|
-
payload['maximumFileSize'] = maximumFileSize;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (typeof allowedFileExtensions !== 'undefined') {
|
|
102
|
-
payload['allowedFileExtensions'] = allowedFileExtensions;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (typeof compression !== 'undefined') {
|
|
106
|
-
payload['compression'] = compression;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (typeof encryption !== 'undefined') {
|
|
110
|
-
payload['encryption'] = encryption;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (typeof antivirus !== 'undefined') {
|
|
114
|
-
payload['antivirus'] = antivirus;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
return await this.client.call('post', apiPath, {
|
|
118
|
-
'content-type': 'application/json',
|
|
119
|
-
}, payload);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Get bucket
|
|
124
|
-
*
|
|
125
|
-
* Get a storage bucket by its unique ID. This endpoint response returns a
|
|
126
|
-
* JSON object with the storage bucket metadata.
|
|
127
|
-
*
|
|
128
|
-
* @param {string} bucketId
|
|
129
|
-
* @throws {AppwriteException}
|
|
130
|
-
* @returns {Promise}
|
|
131
|
-
*/
|
|
132
|
-
async getBucket(bucketId) {
|
|
133
|
-
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
134
|
-
let payload = {};
|
|
135
|
-
if (typeof bucketId === 'undefined') {
|
|
136
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return await this.client.call('get', apiPath, {
|
|
141
|
-
'content-type': 'application/json',
|
|
142
|
-
}, payload);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Update bucket
|
|
147
|
-
*
|
|
148
|
-
* Update a storage bucket by its unique ID.
|
|
149
|
-
*
|
|
150
|
-
* @param {string} bucketId
|
|
151
|
-
* @param {string} name
|
|
152
|
-
* @param {string[]} permissions
|
|
153
|
-
* @param {boolean} fileSecurity
|
|
154
|
-
* @param {boolean} enabled
|
|
155
|
-
* @param {number} maximumFileSize
|
|
156
|
-
* @param {string[]} allowedFileExtensions
|
|
157
|
-
* @param {Compression} compression
|
|
158
|
-
* @param {boolean} encryption
|
|
159
|
-
* @param {boolean} antivirus
|
|
160
|
-
* @throws {AppwriteException}
|
|
161
|
-
* @returns {Promise}
|
|
162
|
-
*/
|
|
163
|
-
async updateBucket(bucketId, name, permissions, fileSecurity, enabled, maximumFileSize, allowedFileExtensions, compression, encryption, antivirus) {
|
|
164
|
-
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
165
|
-
let payload = {};
|
|
166
|
-
if (typeof bucketId === 'undefined') {
|
|
167
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
if (typeof name === 'undefined') {
|
|
171
|
-
throw new AppwriteException('Missing required parameter: "name"');
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (typeof name !== 'undefined') {
|
|
176
|
-
payload['name'] = name;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (typeof permissions !== 'undefined') {
|
|
180
|
-
payload['permissions'] = permissions;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (typeof fileSecurity !== 'undefined') {
|
|
184
|
-
payload['fileSecurity'] = fileSecurity;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (typeof enabled !== 'undefined') {
|
|
188
|
-
payload['enabled'] = enabled;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (typeof maximumFileSize !== 'undefined') {
|
|
192
|
-
payload['maximumFileSize'] = maximumFileSize;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (typeof allowedFileExtensions !== 'undefined') {
|
|
196
|
-
payload['allowedFileExtensions'] = allowedFileExtensions;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (typeof compression !== 'undefined') {
|
|
200
|
-
payload['compression'] = compression;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (typeof encryption !== 'undefined') {
|
|
204
|
-
payload['encryption'] = encryption;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (typeof antivirus !== 'undefined') {
|
|
208
|
-
payload['antivirus'] = antivirus;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return await this.client.call('put', apiPath, {
|
|
212
|
-
'content-type': 'application/json',
|
|
213
|
-
}, payload);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Delete bucket
|
|
218
|
-
*
|
|
219
|
-
* Delete a storage bucket by its unique ID.
|
|
220
|
-
*
|
|
221
|
-
* @param {string} bucketId
|
|
222
|
-
* @throws {AppwriteException}
|
|
223
|
-
* @returns {Promise}
|
|
224
|
-
*/
|
|
225
|
-
async deleteBucket(bucketId) {
|
|
226
|
-
const apiPath = '/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
|
|
227
|
-
let payload = {};
|
|
228
|
-
if (typeof bucketId === 'undefined') {
|
|
229
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
return await this.client.call('delete', apiPath, {
|
|
234
|
-
'content-type': 'application/json',
|
|
235
|
-
}, payload);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* List files
|
|
240
|
-
*
|
|
241
|
-
* Get a list of all the user files. You can use the query params to filter
|
|
242
|
-
* your results.
|
|
243
|
-
*
|
|
244
|
-
* @param {string} bucketId
|
|
245
|
-
* @param {string[]} queries
|
|
246
|
-
* @param {string} search
|
|
247
|
-
* @throws {AppwriteException}
|
|
248
|
-
* @returns {Promise}
|
|
249
|
-
*/
|
|
250
|
-
async listFiles(bucketId, queries, search) {
|
|
251
|
-
const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
|
|
252
|
-
let payload = {};
|
|
253
|
-
if (typeof bucketId === 'undefined') {
|
|
254
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (typeof queries !== 'undefined') {
|
|
259
|
-
payload['queries'] = queries;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
if (typeof search !== 'undefined') {
|
|
263
|
-
payload['search'] = search;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
return await this.client.call('get', apiPath, {
|
|
267
|
-
'content-type': 'application/json',
|
|
268
|
-
}, payload);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Create file
|
|
273
|
-
*
|
|
274
|
-
* Create a new file. Before using this route, you should create a new bucket
|
|
275
|
-
* resource using either a [server
|
|
276
|
-
* integration](https://appwrite.io/docs/server/storage#storageCreateBucket)
|
|
277
|
-
* API or directly from your Appwrite console.
|
|
278
|
-
*
|
|
279
|
-
* Larger files should be uploaded using multiple requests with the
|
|
280
|
-
* [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
|
|
281
|
-
* header to send a partial request with a maximum supported chunk of `5MB`.
|
|
282
|
-
* The `content-range` header values should always be in bytes.
|
|
283
|
-
*
|
|
284
|
-
* When the first request is sent, the server will return the **File** object,
|
|
285
|
-
* and the subsequent part request must include the file's **id** in
|
|
286
|
-
* `x-appwrite-id` header to allow the server to know that the partial upload
|
|
287
|
-
* is for the existing file and not for a new one.
|
|
288
|
-
*
|
|
289
|
-
* If you're creating a new file using one of the Appwrite SDKs, all the
|
|
290
|
-
* chunking logic will be managed by the SDK internally.
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* @param {string} bucketId
|
|
294
|
-
* @param {string} fileId
|
|
295
|
-
* @param {InputFile} file
|
|
296
|
-
* @param {string[]} permissions
|
|
297
|
-
* @param {CallableFunction} onProgress
|
|
298
|
-
* @throws {AppwriteException}
|
|
299
|
-
* @returns {Promise}
|
|
300
|
-
*/
|
|
301
|
-
async createFile(bucketId, fileId, file, permissions, onProgress = () => {}) {
|
|
302
|
-
const apiPath = '/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
|
|
303
|
-
let payload = {};
|
|
304
|
-
if (typeof bucketId === 'undefined') {
|
|
305
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
if (typeof fileId === 'undefined') {
|
|
309
|
-
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
if (typeof file === 'undefined') {
|
|
313
|
-
throw new AppwriteException('Missing required parameter: "file"');
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
if (typeof fileId !== 'undefined') {
|
|
318
|
-
payload['fileId'] = fileId;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (typeof file !== 'undefined') {
|
|
322
|
-
payload['file'] = file;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
if (typeof permissions !== 'undefined') {
|
|
326
|
-
payload['permissions'] = permissions;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const size = file.size;
|
|
331
|
-
|
|
332
|
-
const apiHeaders = {
|
|
333
|
-
'content-type': 'multipart/form-data',
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
let id = undefined;
|
|
337
|
-
let response = undefined;
|
|
338
|
-
|
|
339
|
-
let chunksUploaded = 0;
|
|
340
|
-
|
|
341
|
-
if(fileId != 'unique()') {
|
|
342
|
-
try {
|
|
343
|
-
response = await this.client.call('get', apiPath + '/' + fileId, apiHeaders);
|
|
344
|
-
chunksUploaded = response.chunksUploaded;
|
|
345
|
-
} catch(e) {
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
let currentChunk = 1;
|
|
350
|
-
let currentPosition = 0;
|
|
351
|
-
let uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const uploadChunk = async (lastUpload = false) => {
|
|
355
|
-
if(currentChunk <= chunksUploaded) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
const start = ((currentChunk - 1) * client.CHUNK_SIZE);
|
|
360
|
-
let end = start + currentPosition - 1;
|
|
361
|
-
|
|
362
|
-
if(!lastUpload || currentChunk !== 1) {
|
|
363
|
-
apiHeaders['content-range'] = 'bytes ' + start + '-' + end + '/' + size;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
let uploadableChunkTrimmed;
|
|
367
|
-
|
|
368
|
-
if(currentPosition + 1 >= client.CHUNK_SIZE) {
|
|
369
|
-
uploadableChunkTrimmed = uploadableChunk;
|
|
370
|
-
} else {
|
|
371
|
-
uploadableChunkTrimmed = new Uint8Array(currentPosition);
|
|
372
|
-
for(let i = 0; i <= currentPosition; i++) {
|
|
373
|
-
uploadableChunkTrimmed[i] = uploadableChunk[i];
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
if (id) {
|
|
378
|
-
apiHeaders['x-appwrite-id'] = id;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
payload['file'] = { type: 'file', file: new File([uploadableChunkTrimmed], file.filename), filename: file.filename };
|
|
382
|
-
|
|
383
|
-
response = await this.client.call('post', apiPath, apiHeaders, payload);
|
|
384
|
-
|
|
385
|
-
if (!id) {
|
|
386
|
-
id = response['$id'];
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
if (onProgress !== null) {
|
|
390
|
-
onProgress({
|
|
391
|
-
$id: response['$id'],
|
|
392
|
-
progress: Math.min((currentChunk) * client.CHUNK_SIZE, size) / size * 100,
|
|
393
|
-
sizeUploaded: end+1,
|
|
394
|
-
chunksTotal: response['chunksTotal'],
|
|
395
|
-
chunksUploaded: response['chunksUploaded']
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
uploadableChunk = new Uint8Array(client.CHUNK_SIZE);
|
|
400
|
-
currentChunk++;
|
|
401
|
-
currentPosition = 0;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
for await (const chunk of file.stream) {
|
|
405
|
-
for(const b of chunk) {
|
|
406
|
-
uploadableChunk[currentPosition] = b;
|
|
407
|
-
|
|
408
|
-
currentPosition++;
|
|
409
|
-
if(currentPosition >= client.CHUNK_SIZE) {
|
|
410
|
-
await uploadChunk();
|
|
411
|
-
currentPosition = 0;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
if (currentPosition > 0) { // Check if there's any remaining data for the last chunk
|
|
417
|
-
await uploadChunk(true);
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return response;
|
|
421
|
-
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Get file
|
|
426
|
-
*
|
|
427
|
-
* Get a file by its unique ID. This endpoint response returns a JSON object
|
|
428
|
-
* with the file metadata.
|
|
429
|
-
*
|
|
430
|
-
* @param {string} bucketId
|
|
431
|
-
* @param {string} fileId
|
|
432
|
-
* @throws {AppwriteException}
|
|
433
|
-
* @returns {Promise}
|
|
434
|
-
*/
|
|
435
|
-
async getFile(bucketId, fileId) {
|
|
436
|
-
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
437
|
-
let payload = {};
|
|
438
|
-
if (typeof bucketId === 'undefined') {
|
|
439
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
if (typeof fileId === 'undefined') {
|
|
443
|
-
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
return await this.client.call('get', apiPath, {
|
|
448
|
-
'content-type': 'application/json',
|
|
449
|
-
}, payload);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Update file
|
|
454
|
-
*
|
|
455
|
-
* Update a file by its unique ID. Only users with write permissions have
|
|
456
|
-
* access to update this resource.
|
|
457
|
-
*
|
|
458
|
-
* @param {string} bucketId
|
|
459
|
-
* @param {string} fileId
|
|
460
|
-
* @param {string} name
|
|
461
|
-
* @param {string[]} permissions
|
|
462
|
-
* @throws {AppwriteException}
|
|
463
|
-
* @returns {Promise}
|
|
464
|
-
*/
|
|
465
|
-
async updateFile(bucketId, fileId, name, permissions) {
|
|
466
|
-
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
467
|
-
let payload = {};
|
|
468
|
-
if (typeof bucketId === 'undefined') {
|
|
469
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (typeof fileId === 'undefined') {
|
|
473
|
-
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
if (typeof name !== 'undefined') {
|
|
478
|
-
payload['name'] = name;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
if (typeof permissions !== 'undefined') {
|
|
482
|
-
payload['permissions'] = permissions;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
return await this.client.call('put', apiPath, {
|
|
486
|
-
'content-type': 'application/json',
|
|
487
|
-
}, payload);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* Delete File
|
|
492
|
-
*
|
|
493
|
-
* Delete a file by its unique ID. Only users with write permissions have
|
|
494
|
-
* access to delete this resource.
|
|
495
|
-
*
|
|
496
|
-
* @param {string} bucketId
|
|
497
|
-
* @param {string} fileId
|
|
498
|
-
* @throws {AppwriteException}
|
|
499
|
-
* @returns {Promise}
|
|
500
|
-
*/
|
|
501
|
-
async deleteFile(bucketId, fileId) {
|
|
502
|
-
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
503
|
-
let payload = {};
|
|
504
|
-
if (typeof bucketId === 'undefined') {
|
|
505
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
if (typeof fileId === 'undefined') {
|
|
509
|
-
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
return await this.client.call('delete', apiPath, {
|
|
514
|
-
'content-type': 'application/json',
|
|
515
|
-
}, payload);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Get file for download
|
|
520
|
-
*
|
|
521
|
-
* Get a file content by its unique ID. The endpoint response return with a
|
|
522
|
-
* 'Content-Disposition: attachment' header that tells the browser to start
|
|
523
|
-
* downloading the file to user downloads directory.
|
|
524
|
-
*
|
|
525
|
-
* @param {string} bucketId
|
|
526
|
-
* @param {string} fileId
|
|
527
|
-
* @throws {AppwriteException}
|
|
528
|
-
* @returns {Promise}
|
|
529
|
-
*/
|
|
530
|
-
async getFileDownload(bucketId, fileId) {
|
|
531
|
-
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
532
|
-
let payload = {};
|
|
533
|
-
if (typeof bucketId === 'undefined') {
|
|
534
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
if (typeof fileId === 'undefined') {
|
|
538
|
-
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
return await this.client.call('get', apiPath, {
|
|
543
|
-
'content-type': 'application/json',
|
|
544
|
-
}, payload, 'arraybuffer');
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
* Get file preview
|
|
549
|
-
*
|
|
550
|
-
* Get a file preview image. Currently, this method supports preview for image
|
|
551
|
-
* files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
|
|
552
|
-
* and spreadsheets, will return the file icon image. You can also pass query
|
|
553
|
-
* string arguments for cutting and resizing your preview image. Preview is
|
|
554
|
-
* supported only for image files smaller than 10MB.
|
|
555
|
-
*
|
|
556
|
-
* @param {string} bucketId
|
|
557
|
-
* @param {string} fileId
|
|
558
|
-
* @param {number} width
|
|
559
|
-
* @param {number} height
|
|
560
|
-
* @param {ImageGravity} gravity
|
|
561
|
-
* @param {number} quality
|
|
562
|
-
* @param {number} borderWidth
|
|
563
|
-
* @param {string} borderColor
|
|
564
|
-
* @param {number} borderRadius
|
|
565
|
-
* @param {number} opacity
|
|
566
|
-
* @param {number} rotation
|
|
567
|
-
* @param {string} background
|
|
568
|
-
* @param {ImageFormat} output
|
|
569
|
-
* @throws {AppwriteException}
|
|
570
|
-
* @returns {Promise}
|
|
571
|
-
*/
|
|
572
|
-
async getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output) {
|
|
573
|
-
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
574
|
-
let payload = {};
|
|
575
|
-
if (typeof bucketId === 'undefined') {
|
|
576
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
if (typeof fileId === 'undefined') {
|
|
580
|
-
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (typeof width !== 'undefined') {
|
|
585
|
-
payload['width'] = width;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
if (typeof height !== 'undefined') {
|
|
589
|
-
payload['height'] = height;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
if (typeof gravity !== 'undefined') {
|
|
593
|
-
payload['gravity'] = gravity;
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
if (typeof quality !== 'undefined') {
|
|
597
|
-
payload['quality'] = quality;
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
if (typeof borderWidth !== 'undefined') {
|
|
601
|
-
payload['borderWidth'] = borderWidth;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
if (typeof borderColor !== 'undefined') {
|
|
605
|
-
payload['borderColor'] = borderColor;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
if (typeof borderRadius !== 'undefined') {
|
|
609
|
-
payload['borderRadius'] = borderRadius;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
if (typeof opacity !== 'undefined') {
|
|
613
|
-
payload['opacity'] = opacity;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
if (typeof rotation !== 'undefined') {
|
|
617
|
-
payload['rotation'] = rotation;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
if (typeof background !== 'undefined') {
|
|
621
|
-
payload['background'] = background;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
if (typeof output !== 'undefined') {
|
|
625
|
-
payload['output'] = output;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
return await this.client.call('get', apiPath, {
|
|
629
|
-
'content-type': 'application/json',
|
|
630
|
-
}, payload, 'arraybuffer');
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* Get file for view
|
|
635
|
-
*
|
|
636
|
-
* Get a file content by its unique ID. This endpoint is similar to the
|
|
637
|
-
* download method but returns with no 'Content-Disposition: attachment'
|
|
638
|
-
* header.
|
|
639
|
-
*
|
|
640
|
-
* @param {string} bucketId
|
|
641
|
-
* @param {string} fileId
|
|
642
|
-
* @throws {AppwriteException}
|
|
643
|
-
* @returns {Promise}
|
|
644
|
-
*/
|
|
645
|
-
async getFileView(bucketId, fileId) {
|
|
646
|
-
const apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
|
|
647
|
-
let payload = {};
|
|
648
|
-
if (typeof bucketId === 'undefined') {
|
|
649
|
-
throw new AppwriteException('Missing required parameter: "bucketId"');
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
if (typeof fileId === 'undefined') {
|
|
653
|
-
throw new AppwriteException('Missing required parameter: "fileId"');
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
return await this.client.call('get', apiPath, {
|
|
658
|
-
'content-type': 'application/json',
|
|
659
|
-
}, payload, 'arraybuffer');
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
module.exports = Storage;
|