@appwrite.io/console 7.0.0 → 8.1.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.
Files changed (150) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/CHANGELOG.md +30 -6
  3. package/README.md +2 -2
  4. package/dist/cjs/sdk.js +222 -303
  5. package/docs/examples/databases/create-index.md +2 -2
  6. package/docs/examples/domains/create-purchase.md +2 -1
  7. package/docs/examples/domains/create-transfer-in.md +2 -1
  8. package/docs/examples/domains/update-auto-renewal.md +16 -0
  9. package/docs/examples/project/create-variable.md +1 -0
  10. package/docs/examples/project/list-variables.md +4 -1
  11. package/docs/examples/project/update-variable.md +1 -1
  12. package/docs/examples/tablesdb/create-index.md +2 -2
  13. package/docs/examples/users/update-impersonator.md +16 -0
  14. package/package.json +7 -7
  15. package/rollup.config.js +2 -1
  16. package/src/client.ts +61 -1
  17. package/src/enums/appwrite-migration-resource.ts +2 -0
  18. package/src/enums/backup-services.ts +3 -0
  19. package/src/enums/build-runtime.ts +0 -86
  20. package/src/enums/database-type.ts +2 -0
  21. package/src/enums/databases-index-type.ts +6 -0
  22. package/src/enums/runtime.ts +0 -86
  23. package/src/enums/runtimes.ts +0 -86
  24. package/src/enums/scopes.ts +13 -2
  25. package/src/enums/{index-type.ts → tables-db-index-type.ts} +1 -1
  26. package/src/enums/template-reference-type.ts +1 -1
  27. package/src/enums/use-cases.ts +7 -2
  28. package/src/index.ts +2 -1
  29. package/src/models.ts +172 -4
  30. package/src/services/databases.ts +10 -10
  31. package/src/services/domains.ts +103 -26
  32. package/src/services/project.ts +76 -33
  33. package/src/services/tables-db.ts +10 -10
  34. package/src/services/users.ts +67 -2
  35. package/src/services/vcs.ts +10 -10
  36. package/dist/cjs/sdk.js.map +0 -1
  37. package/dist/esm/sdk.js +0 -29782
  38. package/dist/esm/sdk.js.map +0 -1
  39. package/dist/iife/sdk.js +0 -33583
  40. package/types/channel.d.ts +0 -74
  41. package/types/client.d.ts +0 -260
  42. package/types/enums/adapter.d.ts +0 -4
  43. package/types/enums/api-service.d.ts +0 -15
  44. package/types/enums/api.d.ts +0 -5
  45. package/types/enums/appwrite-migration-resource.d.ts +0 -25
  46. package/types/enums/attribute-status.d.ts +0 -7
  47. package/types/enums/auth-method.d.ts +0 -9
  48. package/types/enums/authentication-factor.d.ts +0 -6
  49. package/types/enums/authenticator-type.d.ts +0 -3
  50. package/types/enums/backup-services.d.ts +0 -5
  51. package/types/enums/billing-plan-group.d.ts +0 -5
  52. package/types/enums/browser-permission.d.ts +0 -22
  53. package/types/enums/browser.d.ts +0 -16
  54. package/types/enums/build-runtime.d.ts +0 -174
  55. package/types/enums/column-status.d.ts +0 -7
  56. package/types/enums/compression.d.ts +0 -5
  57. package/types/enums/console-resource-type.d.ts +0 -3
  58. package/types/enums/credit-card.d.ts +0 -19
  59. package/types/enums/database-type.d.ts +0 -4
  60. package/types/enums/deployment-download-type.d.ts +0 -4
  61. package/types/enums/deployment-status.d.ts +0 -8
  62. package/types/enums/domain-purchase-status.d.ts +0 -6
  63. package/types/enums/domain-transfer-status-enum.d.ts +0 -10
  64. package/types/enums/email-template-locale.d.ts +0 -133
  65. package/types/enums/email-template-type.d.ts +0 -9
  66. package/types/enums/execution-method.d.ts +0 -9
  67. package/types/enums/execution-status.d.ts +0 -7
  68. package/types/enums/execution-trigger.d.ts +0 -5
  69. package/types/enums/filter-type.d.ts +0 -4
  70. package/types/enums/firebase-migration-resource.d.ts +0 -12
  71. package/types/enums/flag.d.ts +0 -197
  72. package/types/enums/framework.d.ts +0 -17
  73. package/types/enums/frameworks.d.ts +0 -17
  74. package/types/enums/health-antivirus-status.d.ts +0 -5
  75. package/types/enums/health-check-status.d.ts +0 -4
  76. package/types/enums/image-format.d.ts +0 -9
  77. package/types/enums/image-gravity.d.ts +0 -11
  78. package/types/enums/index-status.d.ts +0 -7
  79. package/types/enums/index-type.d.ts +0 -6
  80. package/types/enums/message-priority.d.ts +0 -4
  81. package/types/enums/message-status.d.ts +0 -7
  82. package/types/enums/messaging-provider-type.d.ts +0 -5
  83. package/types/enums/n-host-migration-resource.d.ts +0 -13
  84. package/types/enums/name.d.ts +0 -15
  85. package/types/enums/o-auth-provider.d.ts +0 -41
  86. package/types/enums/order-by.d.ts +0 -4
  87. package/types/enums/password-hash.d.ts +0 -13
  88. package/types/enums/platform-type.d.ts +0 -17
  89. package/types/enums/platform.d.ts +0 -4
  90. package/types/enums/project-usage-range.d.ts +0 -4
  91. package/types/enums/proxy-resource-type.d.ts +0 -4
  92. package/types/enums/proxy-rule-deployment-resource-type.d.ts +0 -4
  93. package/types/enums/proxy-rule-status.d.ts +0 -6
  94. package/types/enums/region.d.ts +0 -8
  95. package/types/enums/registration-type.d.ts +0 -6
  96. package/types/enums/relation-mutate.d.ts +0 -5
  97. package/types/enums/relationship-type.d.ts +0 -6
  98. package/types/enums/resource-type.d.ts +0 -6
  99. package/types/enums/runtime.d.ts +0 -174
  100. package/types/enums/runtimes.d.ts +0 -174
  101. package/types/enums/scopes.d.ts +0 -70
  102. package/types/enums/sms-template-locale.d.ts +0 -133
  103. package/types/enums/sms-template-type.d.ts +0 -6
  104. package/types/enums/smtp-encryption.d.ts +0 -5
  105. package/types/enums/smtp-secure.d.ts +0 -4
  106. package/types/enums/status-code.d.ts +0 -6
  107. package/types/enums/status.d.ts +0 -3
  108. package/types/enums/supabase-migration-resource.d.ts +0 -13
  109. package/types/enums/template-reference-type.d.ts +0 -5
  110. package/types/enums/theme.d.ts +0 -4
  111. package/types/enums/timezone.d.ts +0 -421
  112. package/types/enums/usage-range.d.ts +0 -5
  113. package/types/enums/use-cases.d.ts +0 -11
  114. package/types/enums/vcs-detection-type.d.ts +0 -4
  115. package/types/enums/vcs-reference-type.d.ts +0 -5
  116. package/types/id.d.ts +0 -20
  117. package/types/index.d.ts +0 -117
  118. package/types/models.d.ts +0 -9071
  119. package/types/operator.d.ts +0 -180
  120. package/types/permission.d.ts +0 -43
  121. package/types/query.d.ts +0 -442
  122. package/types/role.d.ts +0 -70
  123. package/types/service.d.ts +0 -11
  124. package/types/services/account.d.ts +0 -1536
  125. package/types/services/activities.d.ts +0 -46
  126. package/types/services/assistant.d.ts +0 -24
  127. package/types/services/avatars.d.ts +0 -320
  128. package/types/services/backups.d.ts +0 -277
  129. package/types/services/console.d.ts +0 -248
  130. package/types/services/databases.d.ts +0 -2435
  131. package/types/services/domains.d.ts +0 -1499
  132. package/types/services/functions.d.ts +0 -842
  133. package/types/services/graphql.d.ts +0 -43
  134. package/types/services/health.d.ts +0 -475
  135. package/types/services/locale.d.ts +0 -64
  136. package/types/services/messaging.d.ts +0 -1989
  137. package/types/services/migrations.d.ts +0 -417
  138. package/types/services/organizations.d.ts +0 -1009
  139. package/types/services/project.d.ts +0 -130
  140. package/types/services/projects.d.ts +0 -1626
  141. package/types/services/proxy.d.ts +0 -190
  142. package/types/services/realtime.d.ts +0 -134
  143. package/types/services/sites.d.ts +0 -800
  144. package/types/services/storage.d.ts +0 -467
  145. package/types/services/tables-db.d.ts +0 -2352
  146. package/types/services/teams.d.ts +0 -366
  147. package/types/services/tokens.d.ts +0 -119
  148. package/types/services/users.d.ts +0 -1184
  149. package/types/services/vcs.d.ts +0 -252
  150. package/types/services/webhooks.d.ts +0 -165
@@ -1,467 +0,0 @@
1
- import { Client, UploadProgress } from '../client';
2
- import type { Models } from '../models';
3
- import { Compression } from '../enums/compression';
4
- import { ImageGravity } from '../enums/image-gravity';
5
- import { ImageFormat } from '../enums/image-format';
6
- import { UsageRange } from '../enums/usage-range';
7
- export declare class Storage {
8
- client: Client;
9
- constructor(client: Client);
10
- /**
11
- * Get a list of all the storage buckets. You can use the query params to filter your results.
12
- *
13
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
14
- * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
15
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
16
- * @throws {AppwriteException}
17
- * @returns {Promise<Models.BucketList>}
18
- */
19
- listBuckets(params?: {
20
- queries?: string[];
21
- search?: string;
22
- total?: boolean;
23
- }): Promise<Models.BucketList>;
24
- /**
25
- * Get a list of all the storage buckets. You can use the query params to filter your results.
26
- *
27
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus, transformations
28
- * @param {string} search - Search term to filter your list results. Max length: 256 chars.
29
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
30
- * @throws {AppwriteException}
31
- * @returns {Promise<Models.BucketList>}
32
- * @deprecated Use the object parameter style method for a better developer experience.
33
- */
34
- listBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>;
35
- /**
36
- * Create a new storage bucket.
37
- *
38
- * @param {string} params.bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
39
- * @param {string} params.name - Bucket name
40
- * @param {string[]} params.permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
41
- * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
42
- * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
43
- * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB.
44
- * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
45
- * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
46
- * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
47
- * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
48
- * @param {boolean} params.transformations - Are image transformations enabled?
49
- * @throws {AppwriteException}
50
- * @returns {Promise<Models.Bucket>}
51
- */
52
- createBucket(params: {
53
- bucketId: string;
54
- name: string;
55
- permissions?: string[];
56
- fileSecurity?: boolean;
57
- enabled?: boolean;
58
- maximumFileSize?: number;
59
- allowedFileExtensions?: string[];
60
- compression?: Compression;
61
- encryption?: boolean;
62
- antivirus?: boolean;
63
- transformations?: boolean;
64
- }): Promise<Models.Bucket>;
65
- /**
66
- * Create a new storage bucket.
67
- *
68
- * @param {string} bucketId - Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
69
- * @param {string} name - Bucket name
70
- * @param {string[]} permissions - An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
71
- * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
72
- * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
73
- * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB.
74
- * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
75
- * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
76
- * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
77
- * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
78
- * @param {boolean} transformations - Are image transformations enabled?
79
- * @throws {AppwriteException}
80
- * @returns {Promise<Models.Bucket>}
81
- * @deprecated Use the object parameter style method for a better developer experience.
82
- */
83
- createBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>;
84
- /**
85
- * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
86
- *
87
- * @param {string} params.bucketId - Bucket unique ID.
88
- * @throws {AppwriteException}
89
- * @returns {Promise<Models.Bucket>}
90
- */
91
- getBucket(params: {
92
- bucketId: string;
93
- }): Promise<Models.Bucket>;
94
- /**
95
- * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
96
- *
97
- * @param {string} bucketId - Bucket unique ID.
98
- * @throws {AppwriteException}
99
- * @returns {Promise<Models.Bucket>}
100
- * @deprecated Use the object parameter style method for a better developer experience.
101
- */
102
- getBucket(bucketId: string): Promise<Models.Bucket>;
103
- /**
104
- * Update a storage bucket by its unique ID.
105
- *
106
- * @param {string} params.bucketId - Bucket unique ID.
107
- * @param {string} params.name - Bucket name
108
- * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
109
- * @param {boolean} params.fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
110
- * @param {boolean} params.enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
111
- * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB.
112
- * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
113
- * @param {Compression} params.compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
114
- * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
115
- * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
116
- * @param {boolean} params.transformations - Are image transformations enabled?
117
- * @throws {AppwriteException}
118
- * @returns {Promise<Models.Bucket>}
119
- */
120
- updateBucket(params: {
121
- bucketId: string;
122
- name: string;
123
- permissions?: string[];
124
- fileSecurity?: boolean;
125
- enabled?: boolean;
126
- maximumFileSize?: number;
127
- allowedFileExtensions?: string[];
128
- compression?: Compression;
129
- encryption?: boolean;
130
- antivirus?: boolean;
131
- transformations?: boolean;
132
- }): Promise<Models.Bucket>;
133
- /**
134
- * Update a storage bucket by its unique ID.
135
- *
136
- * @param {string} bucketId - Bucket unique ID.
137
- * @param {string} name - Bucket name
138
- * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
139
- * @param {boolean} fileSecurity - Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](https://appwrite.io/docs/permissions).
140
- * @param {boolean} enabled - Is bucket enabled? When set to 'disabled', users cannot access the files in this bucket but Server SDKs with and API key can still access the bucket. No files are lost when this is toggled.
141
- * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 5GB.
142
- * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
143
- * @param {Compression} compression - Compression algorithm chosen for compression. Can be one of none, [gzip](https://en.wikipedia.org/wiki/Gzip), or [zstd](https://en.wikipedia.org/wiki/Zstd), For file size above 20MB compression is skipped even if it's enabled
144
- * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
145
- * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
146
- * @param {boolean} transformations - Are image transformations enabled?
147
- * @throws {AppwriteException}
148
- * @returns {Promise<Models.Bucket>}
149
- * @deprecated Use the object parameter style method for a better developer experience.
150
- */
151
- updateBucket(bucketId: string, name: string, permissions?: string[], fileSecurity?: boolean, enabled?: boolean, maximumFileSize?: number, allowedFileExtensions?: string[], compression?: Compression, encryption?: boolean, antivirus?: boolean, transformations?: boolean): Promise<Models.Bucket>;
152
- /**
153
- * Delete a storage bucket by its unique ID.
154
- *
155
- * @param {string} params.bucketId - Bucket unique ID.
156
- * @throws {AppwriteException}
157
- * @returns {Promise<{}>}
158
- */
159
- deleteBucket(params: {
160
- bucketId: string;
161
- }): Promise<{}>;
162
- /**
163
- * Delete a storage bucket by its unique ID.
164
- *
165
- * @param {string} bucketId - Bucket unique ID.
166
- * @throws {AppwriteException}
167
- * @returns {Promise<{}>}
168
- * @deprecated Use the object parameter style method for a better developer experience.
169
- */
170
- deleteBucket(bucketId: string): Promise<{}>;
171
- /**
172
- * Get a list of all the user files. You can use the query params to filter your results.
173
- *
174
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
175
- * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
176
- * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
177
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
178
- * @throws {AppwriteException}
179
- * @returns {Promise<Models.FileList>}
180
- */
181
- listFiles(params: {
182
- bucketId: string;
183
- queries?: string[];
184
- search?: string;
185
- total?: boolean;
186
- }): Promise<Models.FileList>;
187
- /**
188
- * Get a list of all the user files. You can use the query params to filter your results.
189
- *
190
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
191
- * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded
192
- * @param {string} search - Search term to filter your list results. Max length: 256 chars.
193
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
194
- * @throws {AppwriteException}
195
- * @returns {Promise<Models.FileList>}
196
- * @deprecated Use the object parameter style method for a better developer experience.
197
- */
198
- listFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.FileList>;
199
- /**
200
- * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
201
- *
202
- * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
203
- *
204
- * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
205
- *
206
- * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
207
- *
208
- *
209
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
210
- * @param {string} params.fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
211
- * @param {File} params.file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
212
- * @param {string[]} params.permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
213
- * @throws {AppwriteException}
214
- * @returns {Promise<Models.File>}
215
- */
216
- createFile(params: {
217
- bucketId: string;
218
- fileId: string;
219
- file: File;
220
- permissions?: string[];
221
- onProgress?: (progress: UploadProgress) => void;
222
- }): Promise<Models.File>;
223
- /**
224
- * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://appwrite.io/docs/server/storage#storageCreateBucket) API or directly from your Appwrite console.
225
- *
226
- * Larger files should be uploaded using multiple requests with the [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range) header to send a partial request with a maximum supported chunk of `5MB`. The `content-range` header values should always be in bytes.
227
- *
228
- * When the first request is sent, the server will return the **File** object, and the subsequent part request must include the file's **id** in `x-appwrite-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
229
- *
230
- * If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.
231
- *
232
- *
233
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
234
- * @param {string} fileId - File ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
235
- * @param {File} file - Binary file. Appwrite SDKs provide helpers to handle file input. [Learn about file input](https://appwrite.io/docs/products/storage/upload-download#input-file).
236
- * @param {string[]} permissions - An array of permission strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
237
- * @throws {AppwriteException}
238
- * @returns {Promise<Models.File>}
239
- * @deprecated Use the object parameter style method for a better developer experience.
240
- */
241
- createFile(bucketId: string, fileId: string, file: File, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
242
- /**
243
- * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
244
- *
245
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
246
- * @param {string} params.fileId - File ID.
247
- * @throws {AppwriteException}
248
- * @returns {Promise<Models.File>}
249
- */
250
- getFile(params: {
251
- bucketId: string;
252
- fileId: string;
253
- }): Promise<Models.File>;
254
- /**
255
- * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
256
- *
257
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
258
- * @param {string} fileId - File ID.
259
- * @throws {AppwriteException}
260
- * @returns {Promise<Models.File>}
261
- * @deprecated Use the object parameter style method for a better developer experience.
262
- */
263
- getFile(bucketId: string, fileId: string): Promise<Models.File>;
264
- /**
265
- * Update a file by its unique ID. Only users with write permissions have access to update this resource.
266
- *
267
- * @param {string} params.bucketId - Bucket unique ID.
268
- * @param {string} params.fileId - File ID.
269
- * @param {string} params.name - File name.
270
- * @param {string[]} params.permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
271
- * @throws {AppwriteException}
272
- * @returns {Promise<Models.File>}
273
- */
274
- updateFile(params: {
275
- bucketId: string;
276
- fileId: string;
277
- name?: string;
278
- permissions?: string[];
279
- }): Promise<Models.File>;
280
- /**
281
- * Update a file by its unique ID. Only users with write permissions have access to update this resource.
282
- *
283
- * @param {string} bucketId - Bucket unique ID.
284
- * @param {string} fileId - File ID.
285
- * @param {string} name - File name.
286
- * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
287
- * @throws {AppwriteException}
288
- * @returns {Promise<Models.File>}
289
- * @deprecated Use the object parameter style method for a better developer experience.
290
- */
291
- updateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
292
- /**
293
- * Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
294
- *
295
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
296
- * @param {string} params.fileId - File ID.
297
- * @throws {AppwriteException}
298
- * @returns {Promise<{}>}
299
- */
300
- deleteFile(params: {
301
- bucketId: string;
302
- fileId: string;
303
- }): Promise<{}>;
304
- /**
305
- * Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
306
- *
307
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
308
- * @param {string} fileId - File ID.
309
- * @throws {AppwriteException}
310
- * @returns {Promise<{}>}
311
- * @deprecated Use the object parameter style method for a better developer experience.
312
- */
313
- deleteFile(bucketId: string, fileId: string): Promise<{}>;
314
- /**
315
- * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
316
- *
317
- * @param {string} params.bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
318
- * @param {string} params.fileId - File ID.
319
- * @param {string} params.token - File token for accessing this file.
320
- * @throws {AppwriteException}
321
- * @returns {string}
322
- */
323
- getFileDownload(params: {
324
- bucketId: string;
325
- fileId: string;
326
- token?: string;
327
- }): string;
328
- /**
329
- * Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.
330
- *
331
- * @param {string} bucketId - Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
332
- * @param {string} fileId - File ID.
333
- * @param {string} token - File token for accessing this file.
334
- * @throws {AppwriteException}
335
- * @returns {string}
336
- * @deprecated Use the object parameter style method for a better developer experience.
337
- */
338
- getFileDownload(bucketId: string, fileId: string, token?: string): string;
339
- /**
340
- * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
341
- *
342
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
343
- * @param {string} params.fileId - File ID
344
- * @param {number} params.width - Resize preview image width, Pass an integer between 0 to 4000.
345
- * @param {number} params.height - Resize preview image height, Pass an integer between 0 to 4000.
346
- * @param {ImageGravity} params.gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
347
- * @param {number} params.quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
348
- * @param {number} params.borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
349
- * @param {string} params.borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
350
- * @param {number} params.borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
351
- * @param {number} params.opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
352
- * @param {number} params.rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
353
- * @param {string} params.background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
354
- * @param {ImageFormat} params.output - Output format type (jpeg, jpg, png, gif and webp).
355
- * @param {string} params.token - File token for accessing this file.
356
- * @throws {AppwriteException}
357
- * @returns {string}
358
- */
359
- getFilePreview(params: {
360
- bucketId: string;
361
- fileId: string;
362
- width?: number;
363
- height?: number;
364
- gravity?: ImageGravity;
365
- quality?: number;
366
- borderWidth?: number;
367
- borderColor?: string;
368
- borderRadius?: number;
369
- opacity?: number;
370
- rotation?: number;
371
- background?: string;
372
- output?: ImageFormat;
373
- token?: string;
374
- }): string;
375
- /**
376
- * Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.
377
- *
378
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
379
- * @param {string} fileId - File ID
380
- * @param {number} width - Resize preview image width, Pass an integer between 0 to 4000.
381
- * @param {number} height - Resize preview image height, Pass an integer between 0 to 4000.
382
- * @param {ImageGravity} gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
383
- * @param {number} quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
384
- * @param {number} borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
385
- * @param {string} borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
386
- * @param {number} borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
387
- * @param {number} opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
388
- * @param {number} rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
389
- * @param {string} background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
390
- * @param {ImageFormat} output - Output format type (jpeg, jpg, png, gif and webp).
391
- * @param {string} token - File token for accessing this file.
392
- * @throws {AppwriteException}
393
- * @returns {string}
394
- * @deprecated Use the object parameter style method for a better developer experience.
395
- */
396
- getFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: ImageGravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: ImageFormat, token?: string): string;
397
- /**
398
- * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
399
- *
400
- * @param {string} params.bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
401
- * @param {string} params.fileId - File ID.
402
- * @param {string} params.token - File token for accessing this file.
403
- * @throws {AppwriteException}
404
- * @returns {string}
405
- */
406
- getFileView(params: {
407
- bucketId: string;
408
- fileId: string;
409
- token?: string;
410
- }): string;
411
- /**
412
- * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
413
- *
414
- * @param {string} bucketId - Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).
415
- * @param {string} fileId - File ID.
416
- * @param {string} token - File token for accessing this file.
417
- * @throws {AppwriteException}
418
- * @returns {string}
419
- * @deprecated Use the object parameter style method for a better developer experience.
420
- */
421
- getFileView(bucketId: string, fileId: string, token?: string): string;
422
- /**
423
- * Get usage metrics and statistics for all buckets in the project. You can view the total number of buckets, files, storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
424
- *
425
- *
426
- * @param {UsageRange} params.range - Date range.
427
- * @throws {AppwriteException}
428
- * @returns {Promise<Models.UsageStorage>}
429
- */
430
- getUsage(params?: {
431
- range?: UsageRange;
432
- }): Promise<Models.UsageStorage>;
433
- /**
434
- * Get usage metrics and statistics for all buckets in the project. You can view the total number of buckets, files, storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
435
- *
436
- *
437
- * @param {UsageRange} range - Date range.
438
- * @throws {AppwriteException}
439
- * @returns {Promise<Models.UsageStorage>}
440
- * @deprecated Use the object parameter style method for a better developer experience.
441
- */
442
- getUsage(range?: UsageRange): Promise<Models.UsageStorage>;
443
- /**
444
- * Get usage metrics and statistics a specific bucket in the project. You can view the total number of files, storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
445
- *
446
- *
447
- * @param {string} params.bucketId - Bucket ID.
448
- * @param {UsageRange} params.range - Date range.
449
- * @throws {AppwriteException}
450
- * @returns {Promise<Models.UsageBuckets>}
451
- */
452
- getBucketUsage(params: {
453
- bucketId: string;
454
- range?: UsageRange;
455
- }): Promise<Models.UsageBuckets>;
456
- /**
457
- * Get usage metrics and statistics a specific bucket in the project. You can view the total number of files, storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.
458
- *
459
- *
460
- * @param {string} bucketId - Bucket ID.
461
- * @param {UsageRange} range - Date range.
462
- * @throws {AppwriteException}
463
- * @returns {Promise<Models.UsageBuckets>}
464
- * @deprecated Use the object parameter style method for a better developer experience.
465
- */
466
- getBucketUsage(bucketId: string, range?: UsageRange): Promise<Models.UsageBuckets>;
467
- }