appwrite 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +69 -5
  3. data/lib/appwrite/exception.rb +3 -1
  4. data/lib/appwrite/file.rb +4 -2
  5. data/lib/appwrite/models/attribute_list.rb +5 -5
  6. data/lib/appwrite/models/bucket.rb +82 -0
  7. data/lib/appwrite/models/bucket_list.rb +32 -0
  8. data/lib/appwrite/models/collection_list.rb +5 -5
  9. data/lib/appwrite/models/continent_list.rb +5 -5
  10. data/lib/appwrite/models/country_list.rb +5 -5
  11. data/lib/appwrite/models/currency_list.rb +5 -5
  12. data/lib/appwrite/models/deployment.rb +77 -0
  13. data/lib/appwrite/models/deployment_list.rb +32 -0
  14. data/lib/appwrite/models/document_list.rb +5 -5
  15. data/lib/appwrite/models/execution.rb +5 -5
  16. data/lib/appwrite/models/execution_list.rb +5 -5
  17. data/lib/appwrite/models/file.rb +18 -3
  18. data/lib/appwrite/models/file_list.rb +5 -5
  19. data/lib/appwrite/models/function.rb +5 -5
  20. data/lib/appwrite/models/function_list.rb +5 -5
  21. data/lib/appwrite/models/index_list.rb +5 -5
  22. data/lib/appwrite/models/language_list.rb +5 -5
  23. data/lib/appwrite/models/log_list.rb +5 -5
  24. data/lib/appwrite/models/membership_list.rb +5 -5
  25. data/lib/appwrite/models/phone_list.rb +5 -5
  26. data/lib/appwrite/models/runtime_list.rb +5 -5
  27. data/lib/appwrite/models/session.rb +15 -5
  28. data/lib/appwrite/models/session_list.rb +5 -5
  29. data/lib/appwrite/models/team.rb +5 -5
  30. data/lib/appwrite/models/team_list.rb +5 -5
  31. data/lib/appwrite/models/user_list.rb +5 -5
  32. data/lib/appwrite/services/account.rb +62 -32
  33. data/lib/appwrite/services/avatars.rb +7 -8
  34. data/lib/appwrite/services/database.rb +52 -53
  35. data/lib/appwrite/services/functions.rb +175 -125
  36. data/lib/appwrite/services/health.rb +22 -23
  37. data/lib/appwrite/services/locale.rb +14 -15
  38. data/lib/appwrite/services/storage.rb +309 -47
  39. data/lib/appwrite/services/teams.rb +25 -22
  40. data/lib/appwrite/services/users.rb +31 -31
  41. data/lib/appwrite.rb +5 -3
  42. metadata +8 -6
  43. data/lib/appwrite/models/tag.rb +0 -47
  44. data/lib/appwrite/models/tag_list.rb +0 -32
@@ -3,11 +3,215 @@
3
3
  module Appwrite
4
4
  class Storage < Service
5
5
 
6
- include Models
6
+ # Get a list of all the storage buckets. You can use the query params to
7
+ # filter your results.
8
+ #
9
+ # @param [string] search Search term to filter your list results. Max length: 256 chars.
10
+ # @param [number] limit Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request.
11
+ # @param [number] offset Results offset. The default value is 0. Use this param to manage pagination.
12
+ # @param [string] cursor ID of the bucket used as the starting point for the query, excluding the bucket itself. Should be used for efficient pagination when working with large sets of data.
13
+ # @param [string] cursor_direction Direction of the cursor.
14
+ # @param [string] order_type Order result by ASC or DESC order.
15
+ #
16
+ # @return [BucketList]
17
+ def list_buckets(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
18
+ path = '/storage/buckets'
19
+
20
+ params = {
21
+ search: search,
22
+ limit: limit,
23
+ offset: offset,
24
+ cursor: cursor,
25
+ cursorDirection: cursor_direction,
26
+ orderType: order_type,
27
+ }
28
+
29
+ headers = {
30
+ "content-type": 'application/json',
31
+ }
32
+
33
+ @client.call(
34
+ method: 'GET',
35
+ path: path,
36
+ headers: headers,
37
+ params: params,
38
+ response_type: Models::BucketList
39
+ )
40
+ end
41
+
42
+ # Create a new storage bucket.
43
+ #
44
+ # @param [string] bucket_id Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
45
+ # @param [string] name Bucket name
46
+ # @param [string] permission Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the `read` and `write` params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](/docs/permissions) and get a full list of available permissions.
47
+ # @param [array] read An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.
48
+ # @param [array] write An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.
49
+ # @param [boolean] enabled Is bucket enabled?
50
+ # @param [number] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self-hosted setups you can change the max limit by changing the `_APP_STORAGE_LIMIT` environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)
51
+ # @param [array] allowed_file_extensions Allowed file extensions
52
+ # @param [boolean] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it&#039;s enabled
53
+ # @param [boolean] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it&#039;s enabled
54
+ #
55
+ # @return [Bucket]
56
+ def create_bucket(bucket_id:, name:, permission:, read: nil, write: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, encryption: nil, antivirus: nil)
57
+ if bucket_id.nil?
58
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
59
+ end
60
+
61
+ if name.nil?
62
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
63
+ end
64
+
65
+ if permission.nil?
66
+ raise Appwrite::Exception.new('Missing required parameter: "permission"')
67
+ end
68
+
69
+ path = '/storage/buckets'
70
+
71
+ params = {
72
+ bucketId: bucket_id,
73
+ name: name,
74
+ permission: permission,
75
+ read: read,
76
+ write: write,
77
+ enabled: enabled,
78
+ maximumFileSize: maximum_file_size,
79
+ allowedFileExtensions: allowed_file_extensions,
80
+ encryption: encryption,
81
+ antivirus: antivirus,
82
+ }
83
+
84
+ headers = {
85
+ "content-type": 'application/json',
86
+ }
87
+
88
+ @client.call(
89
+ method: 'POST',
90
+ path: path,
91
+ headers: headers,
92
+ params: params,
93
+ response_type: Models::Bucket
94
+ )
95
+ end
96
+
97
+ # Get a storage bucket by its unique ID. This endpoint response returns a
98
+ # JSON object with the storage bucket metadata.
99
+ #
100
+ # @param [string] bucket_id Bucket unique ID.
101
+ #
102
+ # @return [Bucket]
103
+ def get_bucket(bucket_id:)
104
+ if bucket_id.nil?
105
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
106
+ end
107
+
108
+ path = '/storage/buckets/{bucketId}'
109
+ .gsub('{bucketId}', bucket_id)
110
+
111
+ params = {
112
+ }
113
+
114
+ headers = {
115
+ "content-type": 'application/json',
116
+ }
117
+
118
+ @client.call(
119
+ method: 'GET',
120
+ path: path,
121
+ headers: headers,
122
+ params: params,
123
+ response_type: Models::Bucket
124
+ )
125
+ end
126
+
127
+ # Update a storage bucket by its unique ID.
128
+ #
129
+ # @param [string] bucket_id Bucket unique ID.
130
+ # @param [string] name Bucket name
131
+ # @param [string] permission Permissions type model to use for reading files in this bucket. You can use bucket-level permission set once on the bucket using the `read` and `write` params, or you can set file-level permission where each file read and write params will decide who has access to read and write to each file individually. [learn more about permissions](/docs/permissions) and get a full list of available permissions.
132
+ # @param [array] read An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.
133
+ # @param [array] write An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.
134
+ # @param [boolean] enabled Is bucket enabled?
135
+ # @param [number] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. [Learn more about storage environment variables](docs/environment-variables#storage)
136
+ # @param [array] allowed_file_extensions Allowed file extensions
137
+ # @param [boolean] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it&#039;s enabled
138
+ # @param [boolean] antivirus Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it&#039;s enabled
139
+ #
140
+ # @return [Bucket]
141
+ def update_bucket(bucket_id:, name:, permission:, read: nil, write: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, encryption: nil, antivirus: nil)
142
+ if bucket_id.nil?
143
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
144
+ end
145
+
146
+ if name.nil?
147
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
148
+ end
149
+
150
+ if permission.nil?
151
+ raise Appwrite::Exception.new('Missing required parameter: "permission"')
152
+ end
153
+
154
+ path = '/storage/buckets/{bucketId}'
155
+ .gsub('{bucketId}', bucket_id)
156
+
157
+ params = {
158
+ name: name,
159
+ permission: permission,
160
+ read: read,
161
+ write: write,
162
+ enabled: enabled,
163
+ maximumFileSize: maximum_file_size,
164
+ allowedFileExtensions: allowed_file_extensions,
165
+ encryption: encryption,
166
+ antivirus: antivirus,
167
+ }
168
+
169
+ headers = {
170
+ "content-type": 'application/json',
171
+ }
172
+
173
+ @client.call(
174
+ method: 'PUT',
175
+ path: path,
176
+ headers: headers,
177
+ params: params,
178
+ response_type: Models::Bucket
179
+ )
180
+ end
181
+
182
+ # Delete a storage bucket by its unique ID.
183
+ #
184
+ # @param [string] bucket_id Bucket unique ID.
185
+ #
186
+ # @return []
187
+ def delete_bucket(bucket_id:)
188
+ if bucket_id.nil?
189
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
190
+ end
191
+
192
+ path = '/storage/buckets/{bucketId}'
193
+ .gsub('{bucketId}', bucket_id)
194
+
195
+ params = {
196
+ }
197
+
198
+ headers = {
199
+ "content-type": 'application/json',
200
+ }
201
+
202
+ @client.call(
203
+ method: 'DELETE',
204
+ path: path,
205
+ headers: headers,
206
+ params: params,
207
+ )
208
+ end
209
+
7
210
  # Get a list of all the user files. You can use the query params to filter
8
211
  # your results. On admin mode, this endpoint will return a list of all of the
9
212
  # project's files. [Learn more about different API modes](/docs/admin).
10
213
  #
214
+ # @param [string] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
11
215
  # @param [string] search Search term to filter your list results. Max length: 256 chars.
12
216
  # @param [number] limit Maximum number of files to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
13
217
  # @param [number] offset Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
@@ -16,8 +220,13 @@ module Appwrite
16
220
  # @param [string] order_type Order result by ASC or DESC order.
17
221
  #
18
222
  # @return [FileList]
19
- def list_files(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
20
- path = '/storage/files'
223
+ def list_files(bucket_id:, search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
224
+ if bucket_id.nil?
225
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
226
+ end
227
+
228
+ path = '/storage/buckets/{bucketId}/files'
229
+ .gsub('{bucketId}', bucket_id)
21
230
 
22
231
  params = {
23
232
  search: search,
@@ -35,23 +244,43 @@ module Appwrite
35
244
  @client.call(
36
245
  method: 'GET',
37
246
  path: path,
38
- params: params,
39
247
  headers: headers,
40
- response_type: FileList
248
+ params: params,
249
+ response_type: Models::FileList
41
250
  )
42
251
  end
43
252
 
44
- # Create a new file. The user who creates the file will automatically be
45
- # assigned to read and write access unless he has passed custom values for
46
- # read and write arguments.
253
+ # Create a new file. Before using this route, you should create a new bucket
254
+ # resource using either a [server
255
+ # integration](/docs/server/database#storageCreateBucket) API or directly
256
+ # from your Appwrite console.
257
+ #
258
+ # Larger files should be uploaded using multiple requests with the
259
+ # [content-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range)
260
+ # header to send a partial request with a maximum supported chunk of `5MB`.
261
+ # The `content-range` header values should always be in bytes.
262
+ #
263
+ # When the first request is sent, the server will return the **File** object,
264
+ # and the subsequent part request must include the file's **id** in
265
+ # `x-appwrite-id` header to allow the server to know that the partial upload
266
+ # is for the existing file and not for a new one.
267
+ #
268
+ # If you're creating a new file using one of the Appwrite SDKs, all the
269
+ # chunking logic will be managed by the SDK internally.
270
+ #
47
271
  #
48
- # @param [string] file_id File ID. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
49
- # @param [File] file Binary file.
272
+ # @param [string] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
273
+ # @param [string] file_id File ID. Choose your own unique ID or pass the string &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
274
+ # @param [file] file Binary file.
50
275
  # @param [array] read An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
51
276
  # @param [array] write An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
52
277
  #
53
278
  # @return [File]
54
- def create_file(file_id:, file:, read: nil, write: nil)
279
+ def create_file(bucket_id:, file_id:, file:, read: nil, write: nil, on_progress: nil)
280
+ if bucket_id.nil?
281
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
282
+ end
283
+
55
284
  if file_id.nil?
56
285
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
57
286
  end
@@ -60,7 +289,8 @@ module Appwrite
60
289
  raise Appwrite::Exception.new('Missing required parameter: "file"')
61
290
  end
62
291
 
63
- path = '/storage/files'
292
+ path = '/storage/buckets/{bucketId}/files'
293
+ .gsub('{bucketId}', bucket_id)
64
294
 
65
295
  params = {
66
296
  fileId: file_id,
@@ -73,27 +303,36 @@ module Appwrite
73
303
  "content-type": 'multipart/form-data',
74
304
  }
75
305
 
76
- @client.call(
77
- method: 'POST',
306
+ param_name = 'file'
307
+
308
+ @client.chunked_upload(
78
309
  path: path,
79
- params: params,
80
310
  headers: headers,
81
- response_type: File
311
+ params: params,
312
+ param_name: param_name,
313
+ on_progress: on_progress,
314
+ response_type: Models::File
82
315
  )
83
316
  end
84
317
 
85
318
  # Get a file by its unique ID. This endpoint response returns a JSON object
86
319
  # with the file metadata.
87
320
  #
321
+ # @param [string] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
88
322
  # @param [string] file_id File ID.
89
323
  #
90
324
  # @return [File]
91
- def get_file(file_id:)
325
+ def get_file(bucket_id:, file_id:)
326
+ if bucket_id.nil?
327
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
328
+ end
329
+
92
330
  if file_id.nil?
93
331
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
94
332
  end
95
333
 
96
- path = '/storage/files/{fileId}'
334
+ path = '/storage/buckets/{bucketId}/files/{fileId}'
335
+ .gsub('{bucketId}', bucket_id)
97
336
  .gsub('{fileId}', file_id)
98
337
 
99
338
  params = {
@@ -106,34 +345,32 @@ module Appwrite
106
345
  @client.call(
107
346
  method: 'GET',
108
347
  path: path,
109
- params: params,
110
348
  headers: headers,
111
- response_type: File
349
+ params: params,
350
+ response_type: Models::File
112
351
  )
113
352
  end
114
353
 
115
354
  # Update a file by its unique ID. Only users with write permissions have
116
355
  # access to update this resource.
117
356
  #
118
- # @param [string] file_id File ID.
357
+ # @param [string] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
358
+ # @param [string] file_id File unique ID.
119
359
  # @param [array] read An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
120
360
  # @param [array] write An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
121
361
  #
122
362
  # @return [File]
123
- def update_file(file_id:, read:, write:)
124
- if file_id.nil?
125
- raise Appwrite::Exception.new('Missing required parameter: "fileId"')
363
+ def update_file(bucket_id:, file_id:, read: nil, write: nil)
364
+ if bucket_id.nil?
365
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
126
366
  end
127
367
 
128
- if read.nil?
129
- raise Appwrite::Exception.new('Missing required parameter: "read"')
130
- end
131
-
132
- if write.nil?
133
- raise Appwrite::Exception.new('Missing required parameter: "write"')
368
+ if file_id.nil?
369
+ raise Appwrite::Exception.new('Missing required parameter: "fileId"')
134
370
  end
135
371
 
136
- path = '/storage/files/{fileId}'
372
+ path = '/storage/buckets/{bucketId}/files/{fileId}'
373
+ .gsub('{bucketId}', bucket_id)
137
374
  .gsub('{fileId}', file_id)
138
375
 
139
376
  params = {
@@ -148,24 +385,30 @@ module Appwrite
148
385
  @client.call(
149
386
  method: 'PUT',
150
387
  path: path,
151
- params: params,
152
388
  headers: headers,
153
- response_type: File
389
+ params: params,
390
+ response_type: Models::File
154
391
  )
155
392
  end
156
393
 
157
394
  # Delete a file by its unique ID. Only users with write permissions have
158
395
  # access to delete this resource.
159
396
  #
397
+ # @param [string] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
160
398
  # @param [string] file_id File ID.
161
399
  #
162
400
  # @return []
163
- def delete_file(file_id:)
401
+ def delete_file(bucket_id:, file_id:)
402
+ if bucket_id.nil?
403
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
404
+ end
405
+
164
406
  if file_id.nil?
165
407
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
166
408
  end
167
409
 
168
- path = '/storage/files/{fileId}'
410
+ path = '/storage/buckets/{bucketId}/files/{fileId}'
411
+ .gsub('{bucketId}', bucket_id)
169
412
  .gsub('{fileId}', file_id)
170
413
 
171
414
  params = {
@@ -178,8 +421,8 @@ module Appwrite
178
421
  @client.call(
179
422
  method: 'DELETE',
180
423
  path: path,
181
- params: params,
182
424
  headers: headers,
425
+ params: params,
183
426
  )
184
427
  end
185
428
 
@@ -187,15 +430,21 @@ module Appwrite
187
430
  # 'Content-Disposition: attachment' header that tells the browser to start
188
431
  # downloading the file to user downloads directory.
189
432
  #
433
+ # @param [string] bucket_id Storage bucket ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
190
434
  # @param [string] file_id File ID.
191
435
  #
192
436
  # @return []
193
- def get_file_download(file_id:)
437
+ def get_file_download(bucket_id:, file_id:)
438
+ if bucket_id.nil?
439
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
440
+ end
441
+
194
442
  if file_id.nil?
195
443
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
196
444
  end
197
445
 
198
- path = '/storage/files/{fileId}/download'
446
+ path = '/storage/buckets/{bucketId}/files/{fileId}/download'
447
+ .gsub('{bucketId}', bucket_id)
199
448
  .gsub('{fileId}', file_id)
200
449
 
201
450
  params = {
@@ -208,17 +457,19 @@ module Appwrite
208
457
  @client.call(
209
458
  method: 'GET',
210
459
  path: path,
211
- params: params,
212
460
  headers: headers,
461
+ params: params,
213
462
  )
214
463
  end
215
464
 
216
465
  # Get a file preview image. Currently, this method supports preview for image
217
466
  # files (jpg, png, and gif), other supported formats, like pdf, docs, slides,
218
467
  # and spreadsheets, will return the file icon image. You can also pass query
219
- # string arguments for cutting and resizing your preview image.
468
+ # string arguments for cutting and resizing your preview image. Preview is
469
+ # supported only for image files smaller than 10MB.
220
470
  #
221
- # @param [string] file_id File ID.
471
+ # @param [string] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
472
+ # @param [string] file_id File ID
222
473
  # @param [number] width Resize preview image width, Pass an integer between 0 to 4000.
223
474
  # @param [number] height Resize preview image height, Pass an integer between 0 to 4000.
224
475
  # @param [string] gravity Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right
@@ -232,12 +483,17 @@ module Appwrite
232
483
  # @param [string] output Output format type (jpeg, jpg, png, gif and webp).
233
484
  #
234
485
  # @return []
235
- def get_file_preview(file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil)
486
+ def get_file_preview(bucket_id:, file_id:, width: nil, height: nil, gravity: nil, quality: nil, border_width: nil, border_color: nil, border_radius: nil, opacity: nil, rotation: nil, background: nil, output: nil)
487
+ if bucket_id.nil?
488
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
489
+ end
490
+
236
491
  if file_id.nil?
237
492
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
238
493
  end
239
494
 
240
- path = '/storage/files/{fileId}/preview'
495
+ path = '/storage/buckets/{bucketId}/files/{fileId}/preview'
496
+ .gsub('{bucketId}', bucket_id)
241
497
  .gsub('{fileId}', file_id)
242
498
 
243
499
  params = {
@@ -261,8 +517,8 @@ module Appwrite
261
517
  @client.call(
262
518
  method: 'GET',
263
519
  path: path,
264
- params: params,
265
520
  headers: headers,
521
+ params: params,
266
522
  )
267
523
  end
268
524
 
@@ -270,15 +526,21 @@ module Appwrite
270
526
  # download method but returns with no 'Content-Disposition: attachment'
271
527
  # header.
272
528
  #
529
+ # @param [string] bucket_id Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](/docs/server/storage#createBucket).
273
530
  # @param [string] file_id File ID.
274
531
  #
275
532
  # @return []
276
- def get_file_view(file_id:)
533
+ def get_file_view(bucket_id:, file_id:)
534
+ if bucket_id.nil?
535
+ raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
536
+ end
537
+
277
538
  if file_id.nil?
278
539
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
279
540
  end
280
541
 
281
- path = '/storage/files/{fileId}/view'
542
+ path = '/storage/buckets/{bucketId}/files/{fileId}/view'
543
+ .gsub('{bucketId}', bucket_id)
282
544
  .gsub('{fileId}', file_id)
283
545
 
284
546
  params = {
@@ -291,8 +553,8 @@ module Appwrite
291
553
  @client.call(
292
554
  method: 'GET',
293
555
  path: path,
294
- params: params,
295
556
  headers: headers,
557
+ params: params,
296
558
  )
297
559
  end
298
560