@revenexx/sdk 0.0.5 → 0.0.6

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.
@@ -2,9 +2,7 @@ import { Service } from '../service';
2
2
  import { RevenexxException, Client, type Payload, UploadProgress } from '../client';
3
3
  import type { Models } from '../models';
4
4
 
5
- import { Compression } from '../enums/compression';
6
- import { Gravity } from '../enums/gravity';
7
- import { Output } from '../enums/output';
5
+ import { Visibility } from '../enums/visibility';
8
6
 
9
7
  export class Storage {
10
8
  client: Client;
@@ -14,58 +12,41 @@ export class Storage {
14
12
  }
15
13
 
16
14
  /**
17
- * Get a list of all the storage buckets. You can use the query params to filter your results.
18
15
  *
19
- * @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
20
- * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
21
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
16
+ * @param {string} params.search -
22
17
  * @throws {RevenexxException}
23
- * @returns {Promise<Models.BucketList>}
18
+ * @returns {Promise<{}>}
24
19
  */
25
- storageListBuckets(params?: { queries?: string[], search?: string, total?: boolean }): Promise<Models.BucketList>;
20
+ assetIndex(params?: { search?: string }): Promise<{}>;
26
21
  /**
27
- * Get a list of all the storage buckets. You can use the query params to filter your results.
28
22
  *
29
- * @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
30
- * @param {string} search - Search term to filter your list results. Max length: 256 chars.
31
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
23
+ * @param {string} search -
32
24
  * @throws {RevenexxException}
33
- * @returns {Promise<Models.BucketList>}
25
+ * @returns {Promise<{}>}
34
26
  * @deprecated Use the object parameter style method for a better developer experience.
35
27
  */
36
- storageListBuckets(queries?: string[], search?: string, total?: boolean): Promise<Models.BucketList>;
37
- storageListBuckets(
38
- paramsOrFirst?: { queries?: string[], search?: string, total?: boolean } | string[],
39
- ...rest: [(string)?, (boolean)?]
40
- ): Promise<Models.BucketList> {
41
- let params: { queries?: string[], search?: string, total?: boolean };
28
+ assetIndex(search?: string): Promise<{}>;
29
+ assetIndex(
30
+ paramsOrFirst?: { search?: string } | string
31
+ ): Promise<{}> {
32
+ let params: { search?: string };
42
33
 
43
34
  if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
44
- params = (paramsOrFirst || {}) as { queries?: string[], search?: string, total?: boolean };
35
+ params = (paramsOrFirst || {}) as { search?: string };
45
36
  } else {
46
37
  params = {
47
- queries: paramsOrFirst as string[],
48
- search: rest[0] as string,
49
- total: rest[1] as boolean
38
+ search: paramsOrFirst as string
50
39
  };
51
40
  }
52
41
 
53
- const queries = params.queries;
54
42
  const search = params.search;
55
- const total = params.total;
56
43
 
57
44
 
58
- const apiPath = '/v1/storage/buckets';
45
+ const apiPath = '/v1/storage/assets';
59
46
  const apiPayload: Payload = {};
60
- if (typeof queries !== 'undefined') {
61
- apiPayload['queries'] = queries;
62
- }
63
47
  if (typeof search !== 'undefined') {
64
48
  apiPayload['search'] = search;
65
49
  }
66
- if (typeof total !== 'undefined') {
67
- apiPayload['total'] = total;
68
- }
69
50
  const uri = new URL(this.client.config.endpoint + apiPath);
70
51
 
71
52
  const apiHeaders: { [header: string]: string } = {
@@ -80,119 +61,162 @@ export class Storage {
80
61
  }
81
62
 
82
63
  /**
83
- * Create a new storage bucket.
84
64
  *
85
- * @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.
86
- * @param {string} params.name - Bucket name
87
- * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
88
- * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
89
- * @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
90
- * @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.
91
- * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
92
- * @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).
93
- * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
94
- * @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).
95
- * @param {boolean} params.transformations - Are image transformations enabled?
65
+ * @param {string} params.file -
66
+ * @param {string} params.altText -
67
+ * @param {string} params.description -
68
+ * @param {string} params.displayName -
69
+ * @param {string} params.folderId -
70
+ * @param {boolean} params.keepArchive -
71
+ * @param {string[]} params.tags -
72
+ * @param {boolean} params.unpack - Archives only: unpack the members after upload (see AssetController).
73
+ * @param {Visibility} params.visibility -
96
74
  * @throws {RevenexxException}
97
- * @returns {Promise<Models.Bucket>}
75
+ * @returns {Promise<{}>}
98
76
  */
99
- storageCreateBucket(params: { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean }): Promise<Models.Bucket>;
77
+ assetStore(params: { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility, onProgress?: (progress: UploadProgress) => void }): Promise<{}>;
100
78
  /**
101
- * Create a new storage bucket.
102
79
  *
103
- * @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.
104
- * @param {string} name - Bucket name
105
- * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
106
- * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
107
- * @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
108
- * @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.
109
- * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
110
- * @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).
111
- * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
112
- * @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).
113
- * @param {boolean} transformations - Are image transformations enabled?
80
+ * @param {string} file -
81
+ * @param {string} altText -
82
+ * @param {string} description -
83
+ * @param {string} displayName -
84
+ * @param {string} folderId -
85
+ * @param {boolean} keepArchive -
86
+ * @param {string[]} tags -
87
+ * @param {boolean} unpack - Archives only: unpack the members after upload (see AssetController).
88
+ * @param {Visibility} visibility -
114
89
  * @throws {RevenexxException}
115
- * @returns {Promise<Models.Bucket>}
90
+ * @returns {Promise<{}>}
116
91
  * @deprecated Use the object parameter style method for a better developer experience.
117
92
  */
118
- storageCreateBucket(bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean): Promise<Models.Bucket>;
119
- storageCreateBucket(
120
- paramsOrFirst: { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean } | string,
121
- ...rest: [(string)?, (string[])?, (boolean)?, (Compression)?, (boolean)?, (boolean)?, (boolean)?, (number)?, (string[])?, (boolean)?]
122
- ): Promise<Models.Bucket> {
123
- let params: { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean };
93
+ assetStore(file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility, onProgress?: (progress: UploadProgress) => void): Promise<{}>;
94
+ assetStore(
95
+ paramsOrFirst: { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility, onProgress?: (progress: UploadProgress) => void } | string,
96
+ ...rest: [(string)?, (string)?, (string)?, (string)?, (boolean)?, (string[])?, (boolean)?, (Visibility)?,((progress: UploadProgress) => void)?]
97
+ ): Promise<{}> {
98
+ let params: { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility };
99
+ let onProgress: ((progress: UploadProgress) => void);
124
100
 
125
101
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
126
- params = (paramsOrFirst || {}) as { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean };
102
+ params = (paramsOrFirst || {}) as { file: string, altText?: string, description?: string, displayName?: string, folderId?: string, keepArchive?: boolean, tags?: string[], unpack?: boolean, visibility?: Visibility };
103
+ onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void);
127
104
  } else {
128
105
  params = {
129
- bucketId: paramsOrFirst as string,
130
- name: rest[0] as string,
131
- allowedFileExtensions: rest[1] as string[],
132
- antivirus: rest[2] as boolean,
133
- compression: rest[3] as Compression,
134
- enabled: rest[4] as boolean,
135
- encryption: rest[5] as boolean,
136
- fileSecurity: rest[6] as boolean,
137
- maximumFileSize: rest[7] as number,
138
- permissions: rest[8] as string[],
139
- transformations: rest[9] as boolean
106
+ file: paramsOrFirst as string,
107
+ altText: rest[0] as string,
108
+ description: rest[1] as string,
109
+ displayName: rest[2] as string,
110
+ folderId: rest[3] as string,
111
+ keepArchive: rest[4] as boolean,
112
+ tags: rest[5] as string[],
113
+ unpack: rest[6] as boolean,
114
+ visibility: rest[7] as Visibility
140
115
  };
116
+ onProgress = rest[8] as ((progress: UploadProgress) => void);
141
117
  }
142
118
 
143
- const bucketId = params.bucketId;
144
- const name = params.name;
145
- const allowedFileExtensions = params.allowedFileExtensions;
146
- const antivirus = params.antivirus;
147
- const compression = params.compression;
148
- const enabled = params.enabled;
149
- const encryption = params.encryption;
150
- const fileSecurity = params.fileSecurity;
151
- const maximumFileSize = params.maximumFileSize;
152
- const permissions = params.permissions;
153
- const transformations = params.transformations;
154
-
155
- if (typeof bucketId === 'undefined') {
156
- throw new RevenexxException('Missing required parameter: "bucketId"');
157
- }
158
- if (typeof name === 'undefined') {
159
- throw new RevenexxException('Missing required parameter: "name"');
119
+ const file = params.file;
120
+ const altText = params.altText;
121
+ const description = params.description;
122
+ const displayName = params.displayName;
123
+ const folderId = params.folderId;
124
+ const keepArchive = params.keepArchive;
125
+ const tags = params.tags;
126
+ const unpack = params.unpack;
127
+ const visibility = params.visibility;
128
+
129
+ if (typeof file === 'undefined') {
130
+ throw new RevenexxException('Missing required parameter: "file"');
160
131
  }
161
132
 
162
- const apiPath = '/v1/storage/buckets';
133
+ const apiPath = '/v1/storage/assets';
163
134
  const apiPayload: Payload = {};
164
- if (typeof allowedFileExtensions !== 'undefined') {
165
- apiPayload['allowedFileExtensions'] = allowedFileExtensions;
135
+ if (typeof altText !== 'undefined') {
136
+ apiPayload['alt_text'] = altText;
166
137
  }
167
- if (typeof antivirus !== 'undefined') {
168
- apiPayload['antivirus'] = antivirus;
138
+ if (typeof description !== 'undefined') {
139
+ apiPayload['description'] = description;
169
140
  }
170
- if (typeof bucketId !== 'undefined') {
171
- apiPayload['bucketId'] = bucketId;
141
+ if (typeof displayName !== 'undefined') {
142
+ apiPayload['display_name'] = displayName;
172
143
  }
173
- if (typeof compression !== 'undefined') {
174
- apiPayload['compression'] = compression;
144
+ if (typeof file !== 'undefined') {
145
+ apiPayload['file'] = file;
175
146
  }
176
- if (typeof enabled !== 'undefined') {
177
- apiPayload['enabled'] = enabled;
147
+ if (typeof folderId !== 'undefined') {
148
+ apiPayload['folder_id'] = folderId;
178
149
  }
179
- if (typeof encryption !== 'undefined') {
180
- apiPayload['encryption'] = encryption;
150
+ if (typeof keepArchive !== 'undefined') {
151
+ apiPayload['keep_archive'] = keepArchive;
181
152
  }
182
- if (typeof fileSecurity !== 'undefined') {
183
- apiPayload['fileSecurity'] = fileSecurity;
153
+ if (typeof tags !== 'undefined') {
154
+ apiPayload['tags'] = tags;
184
155
  }
185
- if (typeof maximumFileSize !== 'undefined') {
186
- apiPayload['maximumFileSize'] = maximumFileSize;
156
+ if (typeof unpack !== 'undefined') {
157
+ apiPayload['unpack'] = unpack;
187
158
  }
188
- if (typeof name !== 'undefined') {
189
- apiPayload['name'] = name;
159
+ if (typeof visibility !== 'undefined') {
160
+ apiPayload['visibility'] = visibility;
190
161
  }
191
- if (typeof permissions !== 'undefined') {
192
- apiPayload['permissions'] = permissions;
162
+ const uri = new URL(this.client.config.endpoint + apiPath);
163
+
164
+ const apiHeaders: { [header: string]: string } = {
165
+ 'content-type': 'multipart/form-data',
193
166
  }
194
- if (typeof transformations !== 'undefined') {
195
- apiPayload['transformations'] = transformations;
167
+
168
+ return this.client.chunkedUpload(
169
+ 'post',
170
+ uri,
171
+ apiHeaders,
172
+ apiPayload,
173
+ onProgress
174
+ );
175
+ }
176
+
177
+ /**
178
+ *
179
+ * @param {string} params.folderId -
180
+ * @param {string} params.visibility -
181
+ * @throws {RevenexxException}
182
+ * @returns {Promise<{}>}
183
+ */
184
+ assetBulk(params?: { folderId?: string, visibility?: string }): Promise<{}>;
185
+ /**
186
+ *
187
+ * @param {string} folderId -
188
+ * @param {string} visibility -
189
+ * @throws {RevenexxException}
190
+ * @returns {Promise<{}>}
191
+ * @deprecated Use the object parameter style method for a better developer experience.
192
+ */
193
+ assetBulk(folderId?: string, visibility?: string): Promise<{}>;
194
+ assetBulk(
195
+ paramsOrFirst?: { folderId?: string, visibility?: string } | string,
196
+ ...rest: [(string)?]
197
+ ): Promise<{}> {
198
+ let params: { folderId?: string, visibility?: string };
199
+
200
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
201
+ params = (paramsOrFirst || {}) as { folderId?: string, visibility?: string };
202
+ } else {
203
+ params = {
204
+ folderId: paramsOrFirst as string,
205
+ visibility: rest[0] as string
206
+ };
207
+ }
208
+
209
+ const folderId = params.folderId;
210
+ const visibility = params.visibility;
211
+
212
+
213
+ const apiPath = '/v1/storage/assets/bulk';
214
+ const apiPayload: Payload = {};
215
+ if (typeof folderId !== 'undefined') {
216
+ apiPayload['folder_id'] = folderId;
217
+ }
218
+ if (typeof visibility !== 'undefined') {
219
+ apiPayload['visibility'] = visibility;
196
220
  }
197
221
  const uri = new URL(this.client.config.endpoint + apiPath);
198
222
 
@@ -209,42 +233,40 @@ export class Storage {
209
233
  }
210
234
 
211
235
  /**
212
- * Delete a storage bucket by its unique ID.
213
236
  *
214
- * @param {string} params.bucketId - Bucket unique ID.
237
+ * @param {string} params.id -
215
238
  * @throws {RevenexxException}
216
239
  * @returns {Promise<{}>}
217
240
  */
218
- storageDeleteBucket(params: { bucketId: string }): Promise<{}>;
241
+ assetDestroy(params: { id: string }): Promise<{}>;
219
242
  /**
220
- * Delete a storage bucket by its unique ID.
221
243
  *
222
- * @param {string} bucketId - Bucket unique ID.
244
+ * @param {string} id -
223
245
  * @throws {RevenexxException}
224
246
  * @returns {Promise<{}>}
225
247
  * @deprecated Use the object parameter style method for a better developer experience.
226
248
  */
227
- storageDeleteBucket(bucketId: string): Promise<{}>;
228
- storageDeleteBucket(
229
- paramsOrFirst: { bucketId: string } | string
249
+ assetDestroy(id: string): Promise<{}>;
250
+ assetDestroy(
251
+ paramsOrFirst: { id: string } | string
230
252
  ): Promise<{}> {
231
- let params: { bucketId: string };
253
+ let params: { id: string };
232
254
 
233
255
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
234
- params = (paramsOrFirst || {}) as { bucketId: string };
256
+ params = (paramsOrFirst || {}) as { id: string };
235
257
  } else {
236
258
  params = {
237
- bucketId: paramsOrFirst as string
259
+ id: paramsOrFirst as string
238
260
  };
239
261
  }
240
262
 
241
- const bucketId = params.bucketId;
263
+ const id = params.id;
242
264
 
243
- if (typeof bucketId === 'undefined') {
244
- throw new RevenexxException('Missing required parameter: "bucketId"');
265
+ if (typeof id === 'undefined') {
266
+ throw new RevenexxException('Missing required parameter: "id"');
245
267
  }
246
268
 
247
- const apiPath = '/v1/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
269
+ const apiPath = '/v1/storage/assets/{id}'.replace('{id}', id);
248
270
  const apiPayload: Payload = {};
249
271
  const uri = new URL(this.client.config.endpoint + apiPath);
250
272
 
@@ -260,42 +282,40 @@ export class Storage {
260
282
  }
261
283
 
262
284
  /**
263
- * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
264
285
  *
265
- * @param {string} params.bucketId - Bucket unique ID.
286
+ * @param {string} params.id -
266
287
  * @throws {RevenexxException}
267
- * @returns {Promise<Models.Bucket>}
288
+ * @returns {Promise<{}>}
268
289
  */
269
- storageGetBucket(params: { bucketId: string }): Promise<Models.Bucket>;
290
+ assetShow(params: { id: string }): Promise<{}>;
270
291
  /**
271
- * Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.
272
292
  *
273
- * @param {string} bucketId - Bucket unique ID.
293
+ * @param {string} id -
274
294
  * @throws {RevenexxException}
275
- * @returns {Promise<Models.Bucket>}
295
+ * @returns {Promise<{}>}
276
296
  * @deprecated Use the object parameter style method for a better developer experience.
277
297
  */
278
- storageGetBucket(bucketId: string): Promise<Models.Bucket>;
279
- storageGetBucket(
280
- paramsOrFirst: { bucketId: string } | string
281
- ): Promise<Models.Bucket> {
282
- let params: { bucketId: string };
298
+ assetShow(id: string): Promise<{}>;
299
+ assetShow(
300
+ paramsOrFirst: { id: string } | string
301
+ ): Promise<{}> {
302
+ let params: { id: string };
283
303
 
284
304
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
285
- params = (paramsOrFirst || {}) as { bucketId: string };
305
+ params = (paramsOrFirst || {}) as { id: string };
286
306
  } else {
287
307
  params = {
288
- bucketId: paramsOrFirst as string
308
+ id: paramsOrFirst as string
289
309
  };
290
310
  }
291
311
 
292
- const bucketId = params.bucketId;
312
+ const id = params.id;
293
313
 
294
- if (typeof bucketId === 'undefined') {
295
- throw new RevenexxException('Missing required parameter: "bucketId"');
314
+ if (typeof id === 'undefined') {
315
+ throw new RevenexxException('Missing required parameter: "id"');
296
316
  }
297
317
 
298
- const apiPath = '/v1/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
318
+ const apiPath = '/v1/storage/assets/{id}'.replace('{id}', id);
299
319
  const apiPayload: Payload = {};
300
320
  const uri = new URL(this.client.config.endpoint + apiPath);
301
321
 
@@ -311,116 +331,90 @@ export class Storage {
311
331
  }
312
332
 
313
333
  /**
314
- * Update a storage bucket by its unique ID.
315
334
  *
316
- * @param {string} params.bucketId - Bucket unique ID.
317
- * @param {string} params.name - Bucket name
318
- * @param {string[]} params.allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
319
- * @param {boolean} params.antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
320
- * @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
321
- * @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.
322
- * @param {boolean} params.encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
323
- * @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).
324
- * @param {number} params.maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
325
- * @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).
326
- * @param {boolean} params.transformations - Are image transformations enabled?
335
+ * @param {string} params.id -
336
+ * @param {string} params.altText -
337
+ * @param {string} params.description -
338
+ * @param {string} params.displayName -
339
+ * @param {string} params.folderId -
340
+ * @param {string} params.name -
341
+ * @param {string[]} params.tags -
342
+ * @param {Visibility} params.visibility -
327
343
  * @throws {RevenexxException}
328
- * @returns {Promise<Models.Bucket>}
344
+ * @returns {Promise<{}>}
329
345
  */
330
- storageUpdateBucket(params: { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean }): Promise<Models.Bucket>;
346
+ assetUpdate(params: { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility }): Promise<{}>;
331
347
  /**
332
- * Update a storage bucket by its unique ID.
333
348
  *
334
- * @param {string} bucketId - Bucket unique ID.
335
- * @param {string} name - Bucket name
336
- * @param {string[]} allowedFileExtensions - Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
337
- * @param {boolean} antivirus - Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled
338
- * @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
339
- * @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.
340
- * @param {boolean} encryption - Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
341
- * @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).
342
- * @param {number} maximumFileSize - Maximum file size allowed in bytes. Maximum allowed value is 30MB.
343
- * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
344
- * @param {boolean} transformations - Are image transformations enabled?
349
+ * @param {string} id -
350
+ * @param {string} altText -
351
+ * @param {string} description -
352
+ * @param {string} displayName -
353
+ * @param {string} folderId -
354
+ * @param {string} name -
355
+ * @param {string[]} tags -
356
+ * @param {Visibility} visibility -
345
357
  * @throws {RevenexxException}
346
- * @returns {Promise<Models.Bucket>}
358
+ * @returns {Promise<{}>}
347
359
  * @deprecated Use the object parameter style method for a better developer experience.
348
360
  */
349
- storageUpdateBucket(bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean): Promise<Models.Bucket>;
350
- storageUpdateBucket(
351
- paramsOrFirst: { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean } | string,
352
- ...rest: [(string)?, (string[])?, (boolean)?, (Compression)?, (boolean)?, (boolean)?, (boolean)?, (number)?, (string[])?, (boolean)?]
353
- ): Promise<Models.Bucket> {
354
- let params: { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean };
361
+ assetUpdate(id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility): Promise<{}>;
362
+ assetUpdate(
363
+ paramsOrFirst: { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility } | string,
364
+ ...rest: [(string)?, (string)?, (string)?, (string)?, (string)?, (string[])?, (Visibility)?]
365
+ ): Promise<{}> {
366
+ let params: { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility };
355
367
 
356
368
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
357
- params = (paramsOrFirst || {}) as { bucketId: string, name: string, allowedFileExtensions?: string[], antivirus?: boolean, compression?: Compression, enabled?: boolean, encryption?: boolean, fileSecurity?: boolean, maximumFileSize?: number, permissions?: string[], transformations?: boolean };
369
+ params = (paramsOrFirst || {}) as { id: string, altText?: string, description?: string, displayName?: string, folderId?: string, name?: string, tags?: string[], visibility?: Visibility };
358
370
  } else {
359
371
  params = {
360
- bucketId: paramsOrFirst as string,
361
- name: rest[0] as string,
362
- allowedFileExtensions: rest[1] as string[],
363
- antivirus: rest[2] as boolean,
364
- compression: rest[3] as Compression,
365
- enabled: rest[4] as boolean,
366
- encryption: rest[5] as boolean,
367
- fileSecurity: rest[6] as boolean,
368
- maximumFileSize: rest[7] as number,
369
- permissions: rest[8] as string[],
370
- transformations: rest[9] as boolean
372
+ id: paramsOrFirst as string,
373
+ altText: rest[0] as string,
374
+ description: rest[1] as string,
375
+ displayName: rest[2] as string,
376
+ folderId: rest[3] as string,
377
+ name: rest[4] as string,
378
+ tags: rest[5] as string[],
379
+ visibility: rest[6] as Visibility
371
380
  };
372
381
  }
373
382
 
374
- const bucketId = params.bucketId;
383
+ const id = params.id;
384
+ const altText = params.altText;
385
+ const description = params.description;
386
+ const displayName = params.displayName;
387
+ const folderId = params.folderId;
375
388
  const name = params.name;
376
- const allowedFileExtensions = params.allowedFileExtensions;
377
- const antivirus = params.antivirus;
378
- const compression = params.compression;
379
- const enabled = params.enabled;
380
- const encryption = params.encryption;
381
- const fileSecurity = params.fileSecurity;
382
- const maximumFileSize = params.maximumFileSize;
383
- const permissions = params.permissions;
384
- const transformations = params.transformations;
385
-
386
- if (typeof bucketId === 'undefined') {
387
- throw new RevenexxException('Missing required parameter: "bucketId"');
388
- }
389
- if (typeof name === 'undefined') {
390
- throw new RevenexxException('Missing required parameter: "name"');
389
+ const tags = params.tags;
390
+ const visibility = params.visibility;
391
+
392
+ if (typeof id === 'undefined') {
393
+ throw new RevenexxException('Missing required parameter: "id"');
391
394
  }
392
395
 
393
- const apiPath = '/v1/storage/buckets/{bucketId}'.replace('{bucketId}', bucketId);
396
+ const apiPath = '/v1/storage/assets/{id}'.replace('{id}', id);
394
397
  const apiPayload: Payload = {};
395
- if (typeof allowedFileExtensions !== 'undefined') {
396
- apiPayload['allowedFileExtensions'] = allowedFileExtensions;
397
- }
398
- if (typeof antivirus !== 'undefined') {
399
- apiPayload['antivirus'] = antivirus;
400
- }
401
- if (typeof compression !== 'undefined') {
402
- apiPayload['compression'] = compression;
403
- }
404
- if (typeof enabled !== 'undefined') {
405
- apiPayload['enabled'] = enabled;
398
+ if (typeof altText !== 'undefined') {
399
+ apiPayload['alt_text'] = altText;
406
400
  }
407
- if (typeof encryption !== 'undefined') {
408
- apiPayload['encryption'] = encryption;
401
+ if (typeof description !== 'undefined') {
402
+ apiPayload['description'] = description;
409
403
  }
410
- if (typeof fileSecurity !== 'undefined') {
411
- apiPayload['fileSecurity'] = fileSecurity;
404
+ if (typeof displayName !== 'undefined') {
405
+ apiPayload['display_name'] = displayName;
412
406
  }
413
- if (typeof maximumFileSize !== 'undefined') {
414
- apiPayload['maximumFileSize'] = maximumFileSize;
407
+ if (typeof folderId !== 'undefined') {
408
+ apiPayload['folder_id'] = folderId;
415
409
  }
416
410
  if (typeof name !== 'undefined') {
417
411
  apiPayload['name'] = name;
418
412
  }
419
- if (typeof permissions !== 'undefined') {
420
- apiPayload['permissions'] = permissions;
413
+ if (typeof tags !== 'undefined') {
414
+ apiPayload['tags'] = tags;
421
415
  }
422
- if (typeof transformations !== 'undefined') {
423
- apiPayload['transformations'] = transformations;
416
+ if (typeof visibility !== 'undefined') {
417
+ apiPayload['visibility'] = visibility;
424
418
  }
425
419
  const uri = new URL(this.client.config.endpoint + apiPath);
426
420
 
@@ -429,7 +423,7 @@ export class Storage {
429
423
  }
430
424
 
431
425
  return this.client.call(
432
- 'put',
426
+ 'patch',
433
427
  uri,
434
428
  apiHeaders,
435
429
  apiPayload
@@ -437,65 +431,41 @@ export class Storage {
437
431
  }
438
432
 
439
433
  /**
440
- * Get a list of all the user files. You can use the query params to filter your results.
441
434
  *
442
- * @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).
443
- * @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
444
- * @param {string} params.search - Search term to filter your list results. Max length: 256 chars.
445
- * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
435
+ * @param {string} params.id -
446
436
  * @throws {RevenexxException}
447
- * @returns {Promise<Models.FileList>}
437
+ * @returns {Promise<{}>}
448
438
  */
449
- storageListFiles(params: { bucketId: string, queries?: string[], search?: string, total?: boolean }): Promise<Models.FileList>;
439
+ assetDownload(params: { id: string }): Promise<{}>;
450
440
  /**
451
- * Get a list of all the user files. You can use the query params to filter your results.
452
441
  *
453
- * @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).
454
- * @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
455
- * @param {string} search - Search term to filter your list results. Max length: 256 chars.
456
- * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
442
+ * @param {string} id -
457
443
  * @throws {RevenexxException}
458
- * @returns {Promise<Models.FileList>}
444
+ * @returns {Promise<{}>}
459
445
  * @deprecated Use the object parameter style method for a better developer experience.
460
446
  */
461
- storageListFiles(bucketId: string, queries?: string[], search?: string, total?: boolean): Promise<Models.FileList>;
462
- storageListFiles(
463
- paramsOrFirst: { bucketId: string, queries?: string[], search?: string, total?: boolean } | string,
464
- ...rest: [(string[])?, (string)?, (boolean)?]
465
- ): Promise<Models.FileList> {
466
- let params: { bucketId: string, queries?: string[], search?: string, total?: boolean };
447
+ assetDownload(id: string): Promise<{}>;
448
+ assetDownload(
449
+ paramsOrFirst: { id: string } | string
450
+ ): Promise<{}> {
451
+ let params: { id: string };
467
452
 
468
453
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
469
- params = (paramsOrFirst || {}) as { bucketId: string, queries?: string[], search?: string, total?: boolean };
454
+ params = (paramsOrFirst || {}) as { id: string };
470
455
  } else {
471
456
  params = {
472
- bucketId: paramsOrFirst as string,
473
- queries: rest[0] as string[],
474
- search: rest[1] as string,
475
- total: rest[2] as boolean
457
+ id: paramsOrFirst as string
476
458
  };
477
459
  }
478
460
 
479
- const bucketId = params.bucketId;
480
- const queries = params.queries;
481
- const search = params.search;
482
- const total = params.total;
461
+ const id = params.id;
483
462
 
484
- if (typeof bucketId === 'undefined') {
485
- throw new RevenexxException('Missing required parameter: "bucketId"');
463
+ if (typeof id === 'undefined') {
464
+ throw new RevenexxException('Missing required parameter: "id"');
486
465
  }
487
466
 
488
- const apiPath = '/v1/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
467
+ const apiPath = '/v1/storage/assets/{id}/download'.replace('{id}', id);
489
468
  const apiPayload: Payload = {};
490
- if (typeof queries !== 'undefined') {
491
- apiPayload['queries'] = queries;
492
- }
493
- if (typeof search !== 'undefined') {
494
- apiPayload['search'] = search;
495
- }
496
- if (typeof total !== 'undefined') {
497
- apiPayload['total'] = total;
498
- }
499
469
  const uri = new URL(this.client.config.endpoint + apiPath);
500
470
 
501
471
  const apiHeaders: { [header: string]: string } = {
@@ -510,156 +480,204 @@ export class Storage {
510
480
  }
511
481
 
512
482
  /**
513
- * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://app.revenexx.com/docs/server/storage#storageCreateBucket) API or directly from your Revenexx console.
514
- *
515
- * 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.
516
- *
517
- * 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-revenexx-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
518
- *
519
- * If you're creating a new file using one of the Revenexx SDKs, all the chunking logic will be managed by the SDK internally.
520
- *
521
483
  *
522
- * @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).
523
- * @param {string} 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).
524
- * @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.
525
- * @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).
484
+ * @param {string} params.id -
526
485
  * @throws {RevenexxException}
527
- * @returns {Promise<Models.File>}
486
+ * @returns {Promise<{}>}
528
487
  */
529
- storageCreateFile(params: { bucketId: string, file: string, fileId: string, permissions?: string[], onProgress?: (progress: UploadProgress) => void }): Promise<Models.File>;
488
+ assetPermanent(params: { id: string }): Promise<{}>;
530
489
  /**
531
- * Create a new file. Before using this route, you should create a new bucket resource using either a [server integration](https://app.revenexx.com/docs/server/storage#storageCreateBucket) API or directly from your Revenexx console.
532
- *
533
- * 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.
534
- *
535
- * 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-revenexx-id` header to allow the server to know that the partial upload is for the existing file and not for a new one.
536
- *
537
- * If you're creating a new file using one of the Revenexx SDKs, all the chunking logic will be managed by the SDK internally.
538
- *
539
490
  *
540
- * @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).
541
- * @param {string} 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).
542
- * @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.
543
- * @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).
491
+ * @param {string} id -
544
492
  * @throws {RevenexxException}
545
- * @returns {Promise<Models.File>}
493
+ * @returns {Promise<{}>}
546
494
  * @deprecated Use the object parameter style method for a better developer experience.
547
495
  */
548
- storageCreateFile(bucketId: string, file: string, fileId: string, permissions?: string[], onProgress?: (progress: UploadProgress) => void): Promise<Models.File>;
549
- storageCreateFile(
550
- paramsOrFirst: { bucketId: string, file: string, fileId: string, permissions?: string[], onProgress?: (progress: UploadProgress) => void } | string,
551
- ...rest: [(string)?, (string)?, (string[])?,((progress: UploadProgress) => void)?]
552
- ): Promise<Models.File> {
553
- let params: { bucketId: string, file: string, fileId: string, permissions?: string[] };
554
- let onProgress: ((progress: UploadProgress) => void);
496
+ assetPermanent(id: string): Promise<{}>;
497
+ assetPermanent(
498
+ paramsOrFirst: { id: string } | string
499
+ ): Promise<{}> {
500
+ let params: { id: string };
555
501
 
556
502
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
557
- params = (paramsOrFirst || {}) as { bucketId: string, file: string, fileId: string, permissions?: string[] };
558
- onProgress = paramsOrFirst?.onProgress as ((progress: UploadProgress) => void);
503
+ params = (paramsOrFirst || {}) as { id: string };
559
504
  } else {
560
505
  params = {
561
- bucketId: paramsOrFirst as string,
562
- file: rest[0] as string,
563
- fileId: rest[1] as string,
564
- permissions: rest[2] as string[]
506
+ id: paramsOrFirst as string
565
507
  };
566
- onProgress = rest[3] as ((progress: UploadProgress) => void);
567
508
  }
568
509
 
569
- const bucketId = params.bucketId;
570
- const file = params.file;
571
- const fileId = params.fileId;
572
- const permissions = params.permissions;
510
+ const id = params.id;
573
511
 
574
- if (typeof bucketId === 'undefined') {
575
- throw new RevenexxException('Missing required parameter: "bucketId"');
512
+ if (typeof id === 'undefined') {
513
+ throw new RevenexxException('Missing required parameter: "id"');
576
514
  }
577
- if (typeof file === 'undefined') {
578
- throw new RevenexxException('Missing required parameter: "file"');
515
+
516
+ const apiPath = '/v1/storage/assets/{id}/permanent'.replace('{id}', id);
517
+ const apiPayload: Payload = {};
518
+ const uri = new URL(this.client.config.endpoint + apiPath);
519
+
520
+ const apiHeaders: { [header: string]: string } = {
579
521
  }
580
- if (typeof fileId === 'undefined') {
581
- throw new RevenexxException('Missing required parameter: "fileId"');
522
+
523
+ return this.client.call(
524
+ 'delete',
525
+ uri,
526
+ apiHeaders,
527
+ apiPayload
528
+ );
529
+ }
530
+
531
+ /**
532
+ *
533
+ * @param {string} params.id -
534
+ * @throws {RevenexxException}
535
+ * @returns {Promise<{}>}
536
+ */
537
+ assetReprocess(params: { id: string }): Promise<{}>;
538
+ /**
539
+ *
540
+ * @param {string} id -
541
+ * @throws {RevenexxException}
542
+ * @returns {Promise<{}>}
543
+ * @deprecated Use the object parameter style method for a better developer experience.
544
+ */
545
+ assetReprocess(id: string): Promise<{}>;
546
+ assetReprocess(
547
+ paramsOrFirst: { id: string } | string
548
+ ): Promise<{}> {
549
+ let params: { id: string };
550
+
551
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
552
+ params = (paramsOrFirst || {}) as { id: string };
553
+ } else {
554
+ params = {
555
+ id: paramsOrFirst as string
556
+ };
557
+ }
558
+
559
+ const id = params.id;
560
+
561
+ if (typeof id === 'undefined') {
562
+ throw new RevenexxException('Missing required parameter: "id"');
582
563
  }
583
564
 
584
- const apiPath = '/v1/storage/buckets/{bucketId}/files'.replace('{bucketId}', bucketId);
565
+ const apiPath = '/v1/storage/assets/{id}/reprocess'.replace('{id}', id);
585
566
  const apiPayload: Payload = {};
586
- if (typeof file !== 'undefined') {
587
- apiPayload['file'] = file;
567
+ const uri = new URL(this.client.config.endpoint + apiPath);
568
+
569
+ const apiHeaders: { [header: string]: string } = {
588
570
  }
589
- if (typeof fileId !== 'undefined') {
590
- apiPayload['fileId'] = fileId;
571
+
572
+ return this.client.call(
573
+ 'post',
574
+ uri,
575
+ apiHeaders,
576
+ apiPayload
577
+ );
578
+ }
579
+
580
+ /**
581
+ *
582
+ * @param {string} params.id -
583
+ * @throws {RevenexxException}
584
+ * @returns {Promise<{}>}
585
+ */
586
+ assetRestore(params: { id: string }): Promise<{}>;
587
+ /**
588
+ *
589
+ * @param {string} id -
590
+ * @throws {RevenexxException}
591
+ * @returns {Promise<{}>}
592
+ * @deprecated Use the object parameter style method for a better developer experience.
593
+ */
594
+ assetRestore(id: string): Promise<{}>;
595
+ assetRestore(
596
+ paramsOrFirst: { id: string } | string
597
+ ): Promise<{}> {
598
+ let params: { id: string };
599
+
600
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
601
+ params = (paramsOrFirst || {}) as { id: string };
602
+ } else {
603
+ params = {
604
+ id: paramsOrFirst as string
605
+ };
591
606
  }
592
- if (typeof permissions !== 'undefined') {
593
- apiPayload['permissions'] = permissions;
607
+
608
+ const id = params.id;
609
+
610
+ if (typeof id === 'undefined') {
611
+ throw new RevenexxException('Missing required parameter: "id"');
594
612
  }
613
+
614
+ const apiPath = '/v1/storage/assets/{id}/restore'.replace('{id}', id);
615
+ const apiPayload: Payload = {};
595
616
  const uri = new URL(this.client.config.endpoint + apiPath);
596
617
 
597
618
  const apiHeaders: { [header: string]: string } = {
598
- 'content-type': 'multipart/form-data',
599
619
  }
600
620
 
601
- return this.client.chunkedUpload(
621
+ return this.client.call(
602
622
  'post',
603
623
  uri,
604
624
  apiHeaders,
605
- apiPayload,
606
- onProgress
625
+ apiPayload
607
626
  );
608
627
  }
609
628
 
610
629
  /**
611
- * Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
612
630
  *
613
- * @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).
614
- * @param {string} params.fileId - File ID.
631
+ * @param {string} params.id -
632
+ * @param {number} params.ttlSeconds -
615
633
  * @throws {RevenexxException}
616
634
  * @returns {Promise<{}>}
617
635
  */
618
- storageDeleteFile(params: { bucketId: string, fileId: string }): Promise<{}>;
636
+ assetSign(params: { id: string, ttlSeconds?: number }): Promise<{}>;
619
637
  /**
620
- * Delete a file by its unique ID. Only users with write permissions have access to delete this resource.
621
638
  *
622
- * @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).
623
- * @param {string} fileId - File ID.
639
+ * @param {string} id -
640
+ * @param {number} ttlSeconds -
624
641
  * @throws {RevenexxException}
625
642
  * @returns {Promise<{}>}
626
643
  * @deprecated Use the object parameter style method for a better developer experience.
627
644
  */
628
- storageDeleteFile(bucketId: string, fileId: string): Promise<{}>;
629
- storageDeleteFile(
630
- paramsOrFirst: { bucketId: string, fileId: string } | string,
631
- ...rest: [(string)?]
645
+ assetSign(id: string, ttlSeconds?: number): Promise<{}>;
646
+ assetSign(
647
+ paramsOrFirst: { id: string, ttlSeconds?: number } | string,
648
+ ...rest: [(number)?]
632
649
  ): Promise<{}> {
633
- let params: { bucketId: string, fileId: string };
650
+ let params: { id: string, ttlSeconds?: number };
634
651
 
635
652
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
636
- params = (paramsOrFirst || {}) as { bucketId: string, fileId: string };
653
+ params = (paramsOrFirst || {}) as { id: string, ttlSeconds?: number };
637
654
  } else {
638
655
  params = {
639
- bucketId: paramsOrFirst as string,
640
- fileId: rest[0] as string
656
+ id: paramsOrFirst as string,
657
+ ttlSeconds: rest[0] as number
641
658
  };
642
659
  }
643
660
 
644
- const bucketId = params.bucketId;
645
- const fileId = params.fileId;
661
+ const id = params.id;
662
+ const ttlSeconds = params.ttlSeconds;
646
663
 
647
- if (typeof bucketId === 'undefined') {
648
- throw new RevenexxException('Missing required parameter: "bucketId"');
649
- }
650
- if (typeof fileId === 'undefined') {
651
- throw new RevenexxException('Missing required parameter: "fileId"');
664
+ if (typeof id === 'undefined') {
665
+ throw new RevenexxException('Missing required parameter: "id"');
652
666
  }
653
667
 
654
- const apiPath = '/v1/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
668
+ const apiPath = '/v1/storage/assets/{id}/sign'.replace('{id}', id);
655
669
  const apiPayload: Payload = {};
670
+ if (typeof ttlSeconds !== 'undefined') {
671
+ apiPayload['ttl_seconds'] = ttlSeconds;
672
+ }
656
673
  const uri = new URL(this.client.config.endpoint + apiPath);
657
674
 
658
675
  const apiHeaders: { [header: string]: string } = {
676
+ 'content-type': 'application/json',
659
677
  }
660
678
 
661
679
  return this.client.call(
662
- 'delete',
680
+ 'post',
663
681
  uri,
664
682
  apiHeaders,
665
683
  apiPayload
@@ -667,50 +685,78 @@ export class Storage {
667
685
  }
668
686
 
669
687
  /**
670
- * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
671
688
  *
672
- * @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).
673
- * @param {string} params.fileId - File ID.
689
+ * @param {string} params.id -
690
+ * @param {boolean} params.keepArchive -
691
+ * @param {string} params.targetFolderId -
674
692
  * @throws {RevenexxException}
675
- * @returns {Promise<Models.File>}
693
+ * @returns {Promise<{}>}
676
694
  */
677
- storageGetFile(params: { bucketId: string, fileId: string }): Promise<Models.File>;
695
+ assetUnpack(params: { id: string, keepArchive?: boolean, targetFolderId?: string }): Promise<{}>;
678
696
  /**
679
- * Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.
680
697
  *
681
- * @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).
682
- * @param {string} fileId - File ID.
698
+ * @param {string} id -
699
+ * @param {boolean} keepArchive -
700
+ * @param {string} targetFolderId -
683
701
  * @throws {RevenexxException}
684
- * @returns {Promise<Models.File>}
702
+ * @returns {Promise<{}>}
685
703
  * @deprecated Use the object parameter style method for a better developer experience.
686
704
  */
687
- storageGetFile(bucketId: string, fileId: string): Promise<Models.File>;
688
- storageGetFile(
689
- paramsOrFirst: { bucketId: string, fileId: string } | string,
690
- ...rest: [(string)?]
691
- ): Promise<Models.File> {
692
- let params: { bucketId: string, fileId: string };
705
+ assetUnpack(id: string, keepArchive?: boolean, targetFolderId?: string): Promise<{}>;
706
+ assetUnpack(
707
+ paramsOrFirst: { id: string, keepArchive?: boolean, targetFolderId?: string } | string,
708
+ ...rest: [(boolean)?, (string)?]
709
+ ): Promise<{}> {
710
+ let params: { id: string, keepArchive?: boolean, targetFolderId?: string };
693
711
 
694
712
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
695
- params = (paramsOrFirst || {}) as { bucketId: string, fileId: string };
713
+ params = (paramsOrFirst || {}) as { id: string, keepArchive?: boolean, targetFolderId?: string };
696
714
  } else {
697
715
  params = {
698
- bucketId: paramsOrFirst as string,
699
- fileId: rest[0] as string
716
+ id: paramsOrFirst as string,
717
+ keepArchive: rest[0] as boolean,
718
+ targetFolderId: rest[1] as string
700
719
  };
701
720
  }
702
721
 
703
- const bucketId = params.bucketId;
704
- const fileId = params.fileId;
722
+ const id = params.id;
723
+ const keepArchive = params.keepArchive;
724
+ const targetFolderId = params.targetFolderId;
725
+
726
+ if (typeof id === 'undefined') {
727
+ throw new RevenexxException('Missing required parameter: "id"');
728
+ }
705
729
 
706
- if (typeof bucketId === 'undefined') {
707
- throw new RevenexxException('Missing required parameter: "bucketId"');
730
+ const apiPath = '/v1/storage/assets/{id}/unpack'.replace('{id}', id);
731
+ const apiPayload: Payload = {};
732
+ if (typeof keepArchive !== 'undefined') {
733
+ apiPayload['keep_archive'] = keepArchive;
708
734
  }
709
- if (typeof fileId === 'undefined') {
710
- throw new RevenexxException('Missing required parameter: "fileId"');
735
+ if (typeof targetFolderId !== 'undefined') {
736
+ apiPayload['target_folder_id'] = targetFolderId;
711
737
  }
738
+ const uri = new URL(this.client.config.endpoint + apiPath);
739
+
740
+ const apiHeaders: { [header: string]: string } = {
741
+ 'content-type': 'application/json',
742
+ }
743
+
744
+ return this.client.call(
745
+ 'post',
746
+ uri,
747
+ apiHeaders,
748
+ apiPayload
749
+ );
750
+ }
751
+
752
+ /**
753
+ *
754
+ * @throws {RevenexxException}
755
+ * @returns {Promise<{}>}
756
+ */
757
+ folderIndex(): Promise<{}> {
712
758
 
713
- const apiPath = '/v1/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
759
+ const apiPath = '/v1/storage/folders';
714
760
  const apiPayload: Payload = {};
715
761
  const uri = new URL(this.client.config.endpoint + apiPath);
716
762
 
@@ -726,64 +772,51 @@ export class Storage {
726
772
  }
727
773
 
728
774
  /**
729
- * Update a file by its unique ID. Only users with write permissions have access to update this resource.
730
775
  *
731
- * @param {string} params.bucketId - Bucket unique ID.
732
- * @param {string} params.fileId - File ID.
733
- * @param {string} params.name - File name.
734
- * @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).
776
+ * @param {string} params.name -
777
+ * @param {string} params.parentId -
735
778
  * @throws {RevenexxException}
736
- * @returns {Promise<Models.File>}
779
+ * @returns {Promise<{}>}
737
780
  */
738
- storageUpdateFile(params: { bucketId: string, fileId: string, name?: string, permissions?: string[] }): Promise<Models.File>;
781
+ folderStore(params: { name: string, parentId?: string }): Promise<{}>;
739
782
  /**
740
- * Update a file by its unique ID. Only users with write permissions have access to update this resource.
741
783
  *
742
- * @param {string} bucketId - Bucket unique ID.
743
- * @param {string} fileId - File ID.
744
- * @param {string} name - File name.
745
- * @param {string[]} permissions - An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
784
+ * @param {string} name -
785
+ * @param {string} parentId -
746
786
  * @throws {RevenexxException}
747
- * @returns {Promise<Models.File>}
787
+ * @returns {Promise<{}>}
748
788
  * @deprecated Use the object parameter style method for a better developer experience.
749
789
  */
750
- storageUpdateFile(bucketId: string, fileId: string, name?: string, permissions?: string[]): Promise<Models.File>;
751
- storageUpdateFile(
752
- paramsOrFirst: { bucketId: string, fileId: string, name?: string, permissions?: string[] } | string,
753
- ...rest: [(string)?, (string)?, (string[])?]
754
- ): Promise<Models.File> {
755
- let params: { bucketId: string, fileId: string, name?: string, permissions?: string[] };
790
+ folderStore(name: string, parentId?: string): Promise<{}>;
791
+ folderStore(
792
+ paramsOrFirst: { name: string, parentId?: string } | string,
793
+ ...rest: [(string)?]
794
+ ): Promise<{}> {
795
+ let params: { name: string, parentId?: string };
756
796
 
757
797
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
758
- params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, name?: string, permissions?: string[] };
798
+ params = (paramsOrFirst || {}) as { name: string, parentId?: string };
759
799
  } else {
760
800
  params = {
761
- bucketId: paramsOrFirst as string,
762
- fileId: rest[0] as string,
763
- name: rest[1] as string,
764
- permissions: rest[2] as string[]
801
+ name: paramsOrFirst as string,
802
+ parentId: rest[0] as string
765
803
  };
766
804
  }
767
805
 
768
- const bucketId = params.bucketId;
769
- const fileId = params.fileId;
770
806
  const name = params.name;
771
- const permissions = params.permissions;
807
+ const parentId = params.parentId;
772
808
 
773
- if (typeof bucketId === 'undefined') {
774
- throw new RevenexxException('Missing required parameter: "bucketId"');
775
- }
776
- if (typeof fileId === 'undefined') {
777
- throw new RevenexxException('Missing required parameter: "fileId"');
809
+ if (typeof name === 'undefined') {
810
+ throw new RevenexxException('Missing required parameter: "name"');
778
811
  }
779
812
 
780
- const apiPath = '/v1/storage/buckets/{bucketId}/files/{fileId}'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
813
+ const apiPath = '/v1/storage/folders';
781
814
  const apiPayload: Payload = {};
782
815
  if (typeof name !== 'undefined') {
783
816
  apiPayload['name'] = name;
784
817
  }
785
- if (typeof permissions !== 'undefined') {
786
- apiPayload['permissions'] = permissions;
818
+ if (typeof parentId !== 'undefined') {
819
+ apiPayload['parent_id'] = parentId;
787
820
  }
788
821
  const uri = new URL(this.client.config.endpoint + apiPath);
789
822
 
@@ -792,7 +825,7 @@ export class Storage {
792
825
  }
793
826
 
794
827
  return this.client.call(
795
- 'put',
828
+ 'post',
796
829
  uri,
797
830
  apiHeaders,
798
831
  apiPayload
@@ -800,60 +833,187 @@ export class Storage {
800
833
  }
801
834
 
802
835
  /**
803
- * 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.
804
836
  *
805
- * @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).
806
- * @param {string} params.fileId - File ID.
807
- * @param {string} params.token - File token for accessing this file.
837
+ * @param {string} params.id -
838
+ * @param {boolean} params.recursive -
808
839
  * @throws {RevenexxException}
809
840
  * @returns {Promise<{}>}
810
841
  */
811
- storageGetFileDownload(params: { bucketId: string, fileId: string, token?: string }): Promise<{}>;
842
+ folderDestroy(params: { id: string, recursive?: boolean }): Promise<{}>;
812
843
  /**
813
- * 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.
814
844
  *
815
- * @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).
816
- * @param {string} fileId - File ID.
817
- * @param {string} token - File token for accessing this file.
845
+ * @param {string} id -
846
+ * @param {boolean} recursive -
818
847
  * @throws {RevenexxException}
819
848
  * @returns {Promise<{}>}
820
849
  * @deprecated Use the object parameter style method for a better developer experience.
821
850
  */
822
- storageGetFileDownload(bucketId: string, fileId: string, token?: string): Promise<{}>;
823
- storageGetFileDownload(
824
- paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string,
825
- ...rest: [(string)?, (string)?]
851
+ folderDestroy(id: string, recursive?: boolean): Promise<{}>;
852
+ folderDestroy(
853
+ paramsOrFirst: { id: string, recursive?: boolean } | string,
854
+ ...rest: [(boolean)?]
826
855
  ): Promise<{}> {
827
- let params: { bucketId: string, fileId: string, token?: string };
856
+ let params: { id: string, recursive?: boolean };
828
857
 
829
858
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
830
- params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string };
859
+ params = (paramsOrFirst || {}) as { id: string, recursive?: boolean };
831
860
  } else {
832
861
  params = {
833
- bucketId: paramsOrFirst as string,
834
- fileId: rest[0] as string,
835
- token: rest[1] as string
862
+ id: paramsOrFirst as string,
863
+ recursive: rest[0] as boolean
836
864
  };
837
865
  }
838
866
 
839
- const bucketId = params.bucketId;
840
- const fileId = params.fileId;
841
- const token = params.token;
867
+ const id = params.id;
868
+ const recursive = params.recursive;
869
+
870
+ if (typeof id === 'undefined') {
871
+ throw new RevenexxException('Missing required parameter: "id"');
872
+ }
873
+
874
+ const apiPath = '/v1/storage/folders/{id}'.replace('{id}', id);
875
+ const apiPayload: Payload = {};
876
+ if (typeof recursive !== 'undefined') {
877
+ apiPayload['recursive'] = recursive;
878
+ }
879
+ const uri = new URL(this.client.config.endpoint + apiPath);
880
+
881
+ const apiHeaders: { [header: string]: string } = {
882
+ }
883
+
884
+ return this.client.call(
885
+ 'delete',
886
+ uri,
887
+ apiHeaders,
888
+ apiPayload
889
+ );
890
+ }
891
+
892
+ /**
893
+ *
894
+ * @param {string} params.id -
895
+ * @throws {RevenexxException}
896
+ * @returns {Promise<{}>}
897
+ */
898
+ folderShow(params: { id: string }): Promise<{}>;
899
+ /**
900
+ *
901
+ * @param {string} id -
902
+ * @throws {RevenexxException}
903
+ * @returns {Promise<{}>}
904
+ * @deprecated Use the object parameter style method for a better developer experience.
905
+ */
906
+ folderShow(id: string): Promise<{}>;
907
+ folderShow(
908
+ paramsOrFirst: { id: string } | string
909
+ ): Promise<{}> {
910
+ let params: { id: string };
911
+
912
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
913
+ params = (paramsOrFirst || {}) as { id: string };
914
+ } else {
915
+ params = {
916
+ id: paramsOrFirst as string
917
+ };
918
+ }
919
+
920
+ const id = params.id;
921
+
922
+ if (typeof id === 'undefined') {
923
+ throw new RevenexxException('Missing required parameter: "id"');
924
+ }
925
+
926
+ const apiPath = '/v1/storage/folders/{id}'.replace('{id}', id);
927
+ const apiPayload: Payload = {};
928
+ const uri = new URL(this.client.config.endpoint + apiPath);
929
+
930
+ const apiHeaders: { [header: string]: string } = {
931
+ }
932
+
933
+ return this.client.call(
934
+ 'get',
935
+ uri,
936
+ apiHeaders,
937
+ apiPayload
938
+ );
939
+ }
842
940
 
843
- if (typeof bucketId === 'undefined') {
844
- throw new RevenexxException('Missing required parameter: "bucketId"');
941
+ /**
942
+ *
943
+ * @param {string} params.id -
944
+ * @param {string} params.name -
945
+ * @param {string} params.parentId -
946
+ * @throws {RevenexxException}
947
+ * @returns {Promise<{}>}
948
+ */
949
+ folderUpdate(params: { id: string, name?: string, parentId?: string }): Promise<{}>;
950
+ /**
951
+ *
952
+ * @param {string} id -
953
+ * @param {string} name -
954
+ * @param {string} parentId -
955
+ * @throws {RevenexxException}
956
+ * @returns {Promise<{}>}
957
+ * @deprecated Use the object parameter style method for a better developer experience.
958
+ */
959
+ folderUpdate(id: string, name?: string, parentId?: string): Promise<{}>;
960
+ folderUpdate(
961
+ paramsOrFirst: { id: string, name?: string, parentId?: string } | string,
962
+ ...rest: [(string)?, (string)?]
963
+ ): Promise<{}> {
964
+ let params: { id: string, name?: string, parentId?: string };
965
+
966
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
967
+ params = (paramsOrFirst || {}) as { id: string, name?: string, parentId?: string };
968
+ } else {
969
+ params = {
970
+ id: paramsOrFirst as string,
971
+ name: rest[0] as string,
972
+ parentId: rest[1] as string
973
+ };
845
974
  }
846
- if (typeof fileId === 'undefined') {
847
- throw new RevenexxException('Missing required parameter: "fileId"');
975
+
976
+ const id = params.id;
977
+ const name = params.name;
978
+ const parentId = params.parentId;
979
+
980
+ if (typeof id === 'undefined') {
981
+ throw new RevenexxException('Missing required parameter: "id"');
848
982
  }
849
983
 
850
- const apiPath = '/v1/storage/buckets/{bucketId}/files/{fileId}/download'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
984
+ const apiPath = '/v1/storage/folders/{id}'.replace('{id}', id);
851
985
  const apiPayload: Payload = {};
852
- if (typeof token !== 'undefined') {
853
- apiPayload['token'] = token;
986
+ if (typeof name !== 'undefined') {
987
+ apiPayload['name'] = name;
988
+ }
989
+ if (typeof parentId !== 'undefined') {
990
+ apiPayload['parent_id'] = parentId;
854
991
  }
855
992
  const uri = new URL(this.client.config.endpoint + apiPath);
856
993
 
994
+ const apiHeaders: { [header: string]: string } = {
995
+ 'content-type': 'application/json',
996
+ }
997
+
998
+ return this.client.call(
999
+ 'patch',
1000
+ uri,
1001
+ apiHeaders,
1002
+ apiPayload
1003
+ );
1004
+ }
1005
+
1006
+ /**
1007
+ *
1008
+ * @throws {RevenexxException}
1009
+ * @returns {Promise<{}>}
1010
+ */
1011
+ syncRuleIndex(): Promise<{}> {
1012
+
1013
+ const apiPath = '/v1/storage/sftp/rules';
1014
+ const apiPayload: Payload = {};
1015
+ const uri = new URL(this.client.config.endpoint + apiPath);
1016
+
857
1017
  const apiHeaders: { [header: string]: string } = {
858
1018
  }
859
1019
 
@@ -866,135 +1026,267 @@ export class Storage {
866
1026
  }
867
1027
 
868
1028
  /**
869
- * 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.
870
1029
  *
871
- * @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).
872
- * @param {string} params.fileId - File ID
873
- * @param {number} params.width - Resize preview image width, Pass an integer between 0 to 4000.
874
- * @param {number} params.height - Resize preview image height, Pass an integer between 0 to 4000.
875
- * @param {Gravity} params.gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
876
- * @param {number} params.quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
877
- * @param {number} params.borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
878
- * @param {string} params.borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
879
- * @param {number} params.borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
880
- * @param {number} params.opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
881
- * @param {number} params.rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
882
- * @param {string} params.background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
883
- * @param {Output} params.output - Output format type (jpeg, jpg, png, gif and webp).
884
- * @param {string} params.token - File token for accessing this file.
885
1030
  * @throws {RevenexxException}
886
1031
  * @returns {Promise<{}>}
887
1032
  */
888
- storageGetFilePreview(params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: Gravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: Output, token?: string }): Promise<{}>;
1033
+ syncRuleStore(): Promise<{}> {
1034
+
1035
+ const apiPath = '/v1/storage/sftp/rules';
1036
+ const apiPayload: Payload = {};
1037
+ const uri = new URL(this.client.config.endpoint + apiPath);
1038
+
1039
+ const apiHeaders: { [header: string]: string } = {
1040
+ }
1041
+
1042
+ return this.client.call(
1043
+ 'post',
1044
+ uri,
1045
+ apiHeaders,
1046
+ apiPayload
1047
+ );
1048
+ }
1049
+
1050
+ /**
1051
+ *
1052
+ * @param {string} params.id -
1053
+ * @throws {RevenexxException}
1054
+ * @returns {Promise<{}>}
1055
+ */
1056
+ syncRuleDestroy(params: { id: string }): Promise<{}>;
889
1057
  /**
890
- * 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.
891
1058
  *
892
- * @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).
893
- * @param {string} fileId - File ID
894
- * @param {number} width - Resize preview image width, Pass an integer between 0 to 4000.
895
- * @param {number} height - Resize preview image height, Pass an integer between 0 to 4000.
896
- * @param {Gravity} gravity - Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
897
- * @param {number} quality - Preview image quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.
898
- * @param {number} borderWidth - Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.
899
- * @param {string} borderColor - Preview image border color. Use a valid HEX color, no # is needed for prefix.
900
- * @param {number} borderRadius - Preview image border radius in pixels. Pass an integer between 0 to 4000.
901
- * @param {number} opacity - Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.
902
- * @param {number} rotation - Preview image rotation in degrees. Pass an integer between -360 and 360.
903
- * @param {string} background - Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.
904
- * @param {Output} output - Output format type (jpeg, jpg, png, gif and webp).
905
- * @param {string} token - File token for accessing this file.
1059
+ * @param {string} id -
906
1060
  * @throws {RevenexxException}
907
1061
  * @returns {Promise<{}>}
908
1062
  * @deprecated Use the object parameter style method for a better developer experience.
909
1063
  */
910
- storageGetFilePreview(bucketId: string, fileId: string, width?: number, height?: number, gravity?: Gravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: Output, token?: string): Promise<{}>;
911
- storageGetFilePreview(
912
- paramsOrFirst: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: Gravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: Output, token?: string } | string,
913
- ...rest: [(string)?, (number)?, (number)?, (Gravity)?, (number)?, (number)?, (string)?, (number)?, (number)?, (number)?, (string)?, (Output)?, (string)?]
1064
+ syncRuleDestroy(id: string): Promise<{}>;
1065
+ syncRuleDestroy(
1066
+ paramsOrFirst: { id: string } | string
914
1067
  ): Promise<{}> {
915
- let params: { bucketId: string, fileId: string, width?: number, height?: number, gravity?: Gravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: Output, token?: string };
1068
+ let params: { id: string };
916
1069
 
917
1070
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
918
- params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, width?: number, height?: number, gravity?: Gravity, quality?: number, borderWidth?: number, borderColor?: string, borderRadius?: number, opacity?: number, rotation?: number, background?: string, output?: Output, token?: string };
1071
+ params = (paramsOrFirst || {}) as { id: string };
919
1072
  } else {
920
1073
  params = {
921
- bucketId: paramsOrFirst as string,
922
- fileId: rest[0] as string,
923
- width: rest[1] as number,
924
- height: rest[2] as number,
925
- gravity: rest[3] as Gravity,
926
- quality: rest[4] as number,
927
- borderWidth: rest[5] as number,
928
- borderColor: rest[6] as string,
929
- borderRadius: rest[7] as number,
930
- opacity: rest[8] as number,
931
- rotation: rest[9] as number,
932
- background: rest[10] as string,
933
- output: rest[11] as Output,
934
- token: rest[12] as string
1074
+ id: paramsOrFirst as string
935
1075
  };
936
1076
  }
937
1077
 
938
- const bucketId = params.bucketId;
939
- const fileId = params.fileId;
940
- const width = params.width;
941
- const height = params.height;
942
- const gravity = params.gravity;
943
- const quality = params.quality;
944
- const borderWidth = params.borderWidth;
945
- const borderColor = params.borderColor;
946
- const borderRadius = params.borderRadius;
947
- const opacity = params.opacity;
948
- const rotation = params.rotation;
949
- const background = params.background;
950
- const output = params.output;
951
- const token = params.token;
952
-
953
- if (typeof bucketId === 'undefined') {
954
- throw new RevenexxException('Missing required parameter: "bucketId"');
955
- }
956
- if (typeof fileId === 'undefined') {
957
- throw new RevenexxException('Missing required parameter: "fileId"');
958
- }
959
-
960
- const apiPath = '/v1/storage/buckets/{bucketId}/files/{fileId}/preview'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
1078
+ const id = params.id;
1079
+
1080
+ if (typeof id === 'undefined') {
1081
+ throw new RevenexxException('Missing required parameter: "id"');
1082
+ }
1083
+
1084
+ const apiPath = '/v1/storage/sftp/rules/{id}'.replace('{id}', id);
961
1085
  const apiPayload: Payload = {};
962
- if (typeof width !== 'undefined') {
963
- apiPayload['width'] = width;
1086
+ const uri = new URL(this.client.config.endpoint + apiPath);
1087
+
1088
+ const apiHeaders: { [header: string]: string } = {
964
1089
  }
965
- if (typeof height !== 'undefined') {
966
- apiPayload['height'] = height;
1090
+
1091
+ return this.client.call(
1092
+ 'delete',
1093
+ uri,
1094
+ apiHeaders,
1095
+ apiPayload
1096
+ );
1097
+ }
1098
+
1099
+ /**
1100
+ *
1101
+ * @param {string} params.id -
1102
+ * @throws {RevenexxException}
1103
+ * @returns {Promise<{}>}
1104
+ */
1105
+ syncRuleShow(params: { id: string }): Promise<{}>;
1106
+ /**
1107
+ *
1108
+ * @param {string} id -
1109
+ * @throws {RevenexxException}
1110
+ * @returns {Promise<{}>}
1111
+ * @deprecated Use the object parameter style method for a better developer experience.
1112
+ */
1113
+ syncRuleShow(id: string): Promise<{}>;
1114
+ syncRuleShow(
1115
+ paramsOrFirst: { id: string } | string
1116
+ ): Promise<{}> {
1117
+ let params: { id: string };
1118
+
1119
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1120
+ params = (paramsOrFirst || {}) as { id: string };
1121
+ } else {
1122
+ params = {
1123
+ id: paramsOrFirst as string
1124
+ };
967
1125
  }
968
- if (typeof gravity !== 'undefined') {
969
- apiPayload['gravity'] = gravity;
1126
+
1127
+ const id = params.id;
1128
+
1129
+ if (typeof id === 'undefined') {
1130
+ throw new RevenexxException('Missing required parameter: "id"');
970
1131
  }
971
- if (typeof quality !== 'undefined') {
972
- apiPayload['quality'] = quality;
1132
+
1133
+ const apiPath = '/v1/storage/sftp/rules/{id}'.replace('{id}', id);
1134
+ const apiPayload: Payload = {};
1135
+ const uri = new URL(this.client.config.endpoint + apiPath);
1136
+
1137
+ const apiHeaders: { [header: string]: string } = {
1138
+ }
1139
+
1140
+ return this.client.call(
1141
+ 'get',
1142
+ uri,
1143
+ apiHeaders,
1144
+ apiPayload
1145
+ );
1146
+ }
1147
+
1148
+ /**
1149
+ *
1150
+ * @param {string} params.id -
1151
+ * @throws {RevenexxException}
1152
+ * @returns {Promise<{}>}
1153
+ */
1154
+ syncRuleUpdate(params: { id: string }): Promise<{}>;
1155
+ /**
1156
+ *
1157
+ * @param {string} id -
1158
+ * @throws {RevenexxException}
1159
+ * @returns {Promise<{}>}
1160
+ * @deprecated Use the object parameter style method for a better developer experience.
1161
+ */
1162
+ syncRuleUpdate(id: string): Promise<{}>;
1163
+ syncRuleUpdate(
1164
+ paramsOrFirst: { id: string } | string
1165
+ ): Promise<{}> {
1166
+ let params: { id: string };
1167
+
1168
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1169
+ params = (paramsOrFirst || {}) as { id: string };
1170
+ } else {
1171
+ params = {
1172
+ id: paramsOrFirst as string
1173
+ };
973
1174
  }
974
- if (typeof borderWidth !== 'undefined') {
975
- apiPayload['borderWidth'] = borderWidth;
1175
+
1176
+ const id = params.id;
1177
+
1178
+ if (typeof id === 'undefined') {
1179
+ throw new RevenexxException('Missing required parameter: "id"');
976
1180
  }
977
- if (typeof borderColor !== 'undefined') {
978
- apiPayload['borderColor'] = borderColor;
1181
+
1182
+ const apiPath = '/v1/storage/sftp/rules/{id}'.replace('{id}', id);
1183
+ const apiPayload: Payload = {};
1184
+ const uri = new URL(this.client.config.endpoint + apiPath);
1185
+
1186
+ const apiHeaders: { [header: string]: string } = {
979
1187
  }
980
- if (typeof borderRadius !== 'undefined') {
981
- apiPayload['borderRadius'] = borderRadius;
1188
+
1189
+ return this.client.call(
1190
+ 'patch',
1191
+ uri,
1192
+ apiHeaders,
1193
+ apiPayload
1194
+ );
1195
+ }
1196
+
1197
+ /**
1198
+ *
1199
+ * @param {string} params.id -
1200
+ * @throws {RevenexxException}
1201
+ * @returns {Promise<{}>}
1202
+ */
1203
+ syncRuleRun(params: { id: string }): Promise<{}>;
1204
+ /**
1205
+ *
1206
+ * @param {string} id -
1207
+ * @throws {RevenexxException}
1208
+ * @returns {Promise<{}>}
1209
+ * @deprecated Use the object parameter style method for a better developer experience.
1210
+ */
1211
+ syncRuleRun(id: string): Promise<{}>;
1212
+ syncRuleRun(
1213
+ paramsOrFirst: { id: string } | string
1214
+ ): Promise<{}> {
1215
+ let params: { id: string };
1216
+
1217
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1218
+ params = (paramsOrFirst || {}) as { id: string };
1219
+ } else {
1220
+ params = {
1221
+ id: paramsOrFirst as string
1222
+ };
982
1223
  }
983
- if (typeof opacity !== 'undefined') {
984
- apiPayload['opacity'] = opacity;
1224
+
1225
+ const id = params.id;
1226
+
1227
+ if (typeof id === 'undefined') {
1228
+ throw new RevenexxException('Missing required parameter: "id"');
985
1229
  }
986
- if (typeof rotation !== 'undefined') {
987
- apiPayload['rotation'] = rotation;
1230
+
1231
+ const apiPath = '/v1/storage/sftp/rules/{id}/run'.replace('{id}', id);
1232
+ const apiPayload: Payload = {};
1233
+ const uri = new URL(this.client.config.endpoint + apiPath);
1234
+
1235
+ const apiHeaders: { [header: string]: string } = {
988
1236
  }
989
- if (typeof background !== 'undefined') {
990
- apiPayload['background'] = background;
1237
+
1238
+ return this.client.call(
1239
+ 'post',
1240
+ uri,
1241
+ apiHeaders,
1242
+ apiPayload
1243
+ );
1244
+ }
1245
+
1246
+ /**
1247
+ *
1248
+ * @param {string} params.id -
1249
+ * @param {string} params.runId -
1250
+ * @throws {RevenexxException}
1251
+ * @returns {Promise<{}>}
1252
+ */
1253
+ syncRuleRunProtocol(params: { id: string, runId: string }): Promise<{}>;
1254
+ /**
1255
+ *
1256
+ * @param {string} id -
1257
+ * @param {string} runId -
1258
+ * @throws {RevenexxException}
1259
+ * @returns {Promise<{}>}
1260
+ * @deprecated Use the object parameter style method for a better developer experience.
1261
+ */
1262
+ syncRuleRunProtocol(id: string, runId: string): Promise<{}>;
1263
+ syncRuleRunProtocol(
1264
+ paramsOrFirst: { id: string, runId: string } | string,
1265
+ ...rest: [(string)?]
1266
+ ): Promise<{}> {
1267
+ let params: { id: string, runId: string };
1268
+
1269
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1270
+ params = (paramsOrFirst || {}) as { id: string, runId: string };
1271
+ } else {
1272
+ params = {
1273
+ id: paramsOrFirst as string,
1274
+ runId: rest[0] as string
1275
+ };
991
1276
  }
992
- if (typeof output !== 'undefined') {
993
- apiPayload['output'] = output;
1277
+
1278
+ const id = params.id;
1279
+ const runId = params.runId;
1280
+
1281
+ if (typeof id === 'undefined') {
1282
+ throw new RevenexxException('Missing required parameter: "id"');
994
1283
  }
995
- if (typeof token !== 'undefined') {
996
- apiPayload['token'] = token;
1284
+ if (typeof runId === 'undefined') {
1285
+ throw new RevenexxException('Missing required parameter: "runId"');
997
1286
  }
1287
+
1288
+ const apiPath = '/v1/storage/sftp/rules/{id}/runs/{runId}'.replace('{id}', id).replace('{runId}', runId);
1289
+ const apiPayload: Payload = {};
998
1290
  const uri = new URL(this.client.config.endpoint + apiPath);
999
1291
 
1000
1292
  const apiHeaders: { [header: string]: string } = {
@@ -1009,58 +1301,100 @@ export class Storage {
1009
1301
  }
1010
1302
 
1011
1303
  /**
1012
- * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
1013
1304
  *
1014
- * @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).
1015
- * @param {string} params.fileId - File ID.
1016
- * @param {string} params.token - File token for accessing this file.
1305
+ * @param {string} params.ruleId -
1306
+ * @param {string} params.from -
1307
+ * @param {string} params.to -
1017
1308
  * @throws {RevenexxException}
1018
1309
  * @returns {Promise<{}>}
1019
1310
  */
1020
- storageGetFileView(params: { bucketId: string, fileId: string, token?: string }): Promise<{}>;
1311
+ syncRuleHistory(params?: { ruleId?: string, from?: string, to?: string }): Promise<{}>;
1021
1312
  /**
1022
- * Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.
1023
1313
  *
1024
- * @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).
1025
- * @param {string} fileId - File ID.
1026
- * @param {string} token - File token for accessing this file.
1314
+ * @param {string} ruleId -
1315
+ * @param {string} from -
1316
+ * @param {string} to -
1027
1317
  * @throws {RevenexxException}
1028
1318
  * @returns {Promise<{}>}
1029
1319
  * @deprecated Use the object parameter style method for a better developer experience.
1030
1320
  */
1031
- storageGetFileView(bucketId: string, fileId: string, token?: string): Promise<{}>;
1032
- storageGetFileView(
1033
- paramsOrFirst: { bucketId: string, fileId: string, token?: string } | string,
1321
+ syncRuleHistory(ruleId?: string, from?: string, to?: string): Promise<{}>;
1322
+ syncRuleHistory(
1323
+ paramsOrFirst?: { ruleId?: string, from?: string, to?: string } | string,
1034
1324
  ...rest: [(string)?, (string)?]
1035
1325
  ): Promise<{}> {
1036
- let params: { bucketId: string, fileId: string, token?: string };
1326
+ let params: { ruleId?: string, from?: string, to?: string };
1037
1327
 
1038
- if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1039
- params = (paramsOrFirst || {}) as { bucketId: string, fileId: string, token?: string };
1328
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1329
+ params = (paramsOrFirst || {}) as { ruleId?: string, from?: string, to?: string };
1040
1330
  } else {
1041
1331
  params = {
1042
- bucketId: paramsOrFirst as string,
1043
- fileId: rest[0] as string,
1044
- token: rest[1] as string
1332
+ ruleId: paramsOrFirst as string,
1333
+ from: rest[0] as string,
1334
+ to: rest[1] as string
1045
1335
  };
1046
1336
  }
1047
1337
 
1048
- const bucketId = params.bucketId;
1049
- const fileId = params.fileId;
1050
- const token = params.token;
1338
+ const ruleId = params.ruleId;
1339
+ const from = params.from;
1340
+ const to = params.to;
1341
+
1051
1342
 
1052
- if (typeof bucketId === 'undefined') {
1053
- throw new RevenexxException('Missing required parameter: "bucketId"');
1343
+ const apiPath = '/v1/storage/sftp/sync-history';
1344
+ const apiPayload: Payload = {};
1345
+ if (typeof ruleId !== 'undefined') {
1346
+ apiPayload['rule_id'] = ruleId;
1347
+ }
1348
+ if (typeof from !== 'undefined') {
1349
+ apiPayload['from'] = from;
1054
1350
  }
1055
- if (typeof fileId === 'undefined') {
1056
- throw new RevenexxException('Missing required parameter: "fileId"');
1351
+ if (typeof to !== 'undefined') {
1352
+ apiPayload['to'] = to;
1353
+ }
1354
+ const uri = new URL(this.client.config.endpoint + apiPath);
1355
+
1356
+ const apiHeaders: { [header: string]: string } = {
1057
1357
  }
1058
1358
 
1059
- const apiPath = '/v1/storage/buckets/{bucketId}/files/{fileId}/view'.replace('{bucketId}', bucketId).replace('{fileId}', fileId);
1359
+ return this.client.call(
1360
+ 'get',
1361
+ uri,
1362
+ apiHeaders,
1363
+ apiPayload
1364
+ );
1365
+ }
1366
+
1367
+ /**
1368
+ *
1369
+ * @throws {RevenexxException}
1370
+ * @returns {Promise<{}>}
1371
+ */
1372
+ tenantStats(): Promise<{}> {
1373
+
1374
+ const apiPath = '/v1/storage/tenant/stats';
1060
1375
  const apiPayload: Payload = {};
1061
- if (typeof token !== 'undefined') {
1062
- apiPayload['token'] = token;
1376
+ const uri = new URL(this.client.config.endpoint + apiPath);
1377
+
1378
+ const apiHeaders: { [header: string]: string } = {
1063
1379
  }
1380
+
1381
+ return this.client.call(
1382
+ 'get',
1383
+ uri,
1384
+ apiHeaders,
1385
+ apiPayload
1386
+ );
1387
+ }
1388
+
1389
+ /**
1390
+ *
1391
+ * @throws {RevenexxException}
1392
+ * @returns {Promise<{}>}
1393
+ */
1394
+ tenantUsage(): Promise<{}> {
1395
+
1396
+ const apiPath = '/v1/storage/tenant/usage';
1397
+ const apiPayload: Payload = {};
1064
1398
  const uri = new URL(this.client.config.endpoint + apiPath);
1065
1399
 
1066
1400
  const apiHeaders: { [header: string]: string } = {