appwrite 8.0.0 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +4 -4
  3. data/lib/appwrite/models/attribute_boolean.rb +5 -0
  4. data/lib/appwrite/models/attribute_datetime.rb +5 -0
  5. data/lib/appwrite/models/attribute_email.rb +5 -0
  6. data/lib/appwrite/models/attribute_enum.rb +5 -0
  7. data/lib/appwrite/models/attribute_float.rb +5 -0
  8. data/lib/appwrite/models/attribute_integer.rb +5 -0
  9. data/lib/appwrite/models/attribute_ip.rb +5 -0
  10. data/lib/appwrite/models/attribute_relationship.rb +5 -0
  11. data/lib/appwrite/models/attribute_string.rb +5 -0
  12. data/lib/appwrite/models/attribute_url.rb +5 -0
  13. data/lib/appwrite/models/database.rb +8 -3
  14. data/lib/appwrite/models/deployment.rb +63 -13
  15. data/lib/appwrite/models/execution.rb +40 -20
  16. data/lib/appwrite/models/function.rb +53 -13
  17. data/lib/appwrite/models/headers.rb +32 -0
  18. data/lib/appwrite/models/health_status.rb +5 -0
  19. data/lib/appwrite/models/identity.rb +72 -0
  20. data/lib/appwrite/models/identity_list.rb +32 -0
  21. data/lib/appwrite/models/index.rb +5 -0
  22. data/lib/appwrite/models/locale_code.rb +32 -0
  23. data/lib/appwrite/models/locale_code_list.rb +32 -0
  24. data/lib/appwrite/models/user.rb +13 -3
  25. data/lib/appwrite/models/variable.rb +10 -5
  26. data/lib/appwrite/role.rb +56 -0
  27. data/lib/appwrite/services/account.rb +185 -130
  28. data/lib/appwrite/services/avatars.rb +42 -42
  29. data/lib/appwrite/services/databases.rb +274 -262
  30. data/lib/appwrite/services/functions.rb +229 -143
  31. data/lib/appwrite/services/graphql.rb +12 -12
  32. data/lib/appwrite/services/health.rb +111 -62
  33. data/lib/appwrite/services/locale.rb +67 -42
  34. data/lib/appwrite/services/storage.rb +85 -83
  35. data/lib/appwrite/services/teams.rb +80 -79
  36. data/lib/appwrite/services/users.rb +248 -150
  37. data/lib/appwrite.rb +5 -0
  38. metadata +7 -2
@@ -15,22 +15,22 @@ module Appwrite
15
15
  #
16
16
  # @return [BucketList]
17
17
  def list_buckets(queries: nil, search: nil)
18
- path = '/storage/buckets'
18
+ api_path = '/storage/buckets'
19
19
 
20
- params = {
20
+ api_params = {
21
21
  queries: queries,
22
22
  search: search,
23
23
  }
24
24
 
25
- headers = {
25
+ api_headers = {
26
26
  "content-type": 'application/json',
27
27
  }
28
28
 
29
29
  @client.call(
30
30
  method: 'GET',
31
- path: path,
32
- headers: headers,
33
- params: params,
31
+ path: api_path,
32
+ headers: api_headers,
33
+ params: api_params,
34
34
  response_type: Models::BucketList
35
35
  )
36
36
  end
@@ -42,8 +42,8 @@ module Appwrite
42
42
  # @param [String] name Bucket name
43
43
  # @param [Array] permissions An array of permission strings. By default, no user is granted with any permissions. [Learn more about permissions](/docs/permissions).
44
44
  # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).
45
- # @param [] enabled Is bucket enabled?
46
- # @param [Integer] 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)
45
+ # @param [] 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.
46
+ # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
47
47
  # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
48
48
  # @param [String] compression Compression algorithm choosen 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
49
49
  # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
@@ -51,7 +51,7 @@ module Appwrite
51
51
  #
52
52
  # @return [Bucket]
53
53
  def create_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil)
54
- path = '/storage/buckets'
54
+ api_path = '/storage/buckets'
55
55
 
56
56
  if bucket_id.nil?
57
57
  raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
@@ -61,7 +61,7 @@ module Appwrite
61
61
  raise Appwrite::Exception.new('Missing required parameter: "name"')
62
62
  end
63
63
 
64
- params = {
64
+ api_params = {
65
65
  bucketId: bucket_id,
66
66
  name: name,
67
67
  permissions: permissions,
@@ -74,15 +74,15 @@ module Appwrite
74
74
  antivirus: antivirus,
75
75
  }
76
76
 
77
- headers = {
77
+ api_headers = {
78
78
  "content-type": 'application/json',
79
79
  }
80
80
 
81
81
  @client.call(
82
82
  method: 'POST',
83
- path: path,
84
- headers: headers,
85
- params: params,
83
+ path: api_path,
84
+ headers: api_headers,
85
+ params: api_params,
86
86
  response_type: Models::Bucket
87
87
  )
88
88
  end
@@ -95,25 +95,25 @@ module Appwrite
95
95
  #
96
96
  # @return [Bucket]
97
97
  def get_bucket(bucket_id:)
98
- path = '/storage/buckets/{bucketId}'
98
+ api_path = '/storage/buckets/{bucketId}'
99
99
  .gsub('{bucketId}', bucket_id)
100
100
 
101
101
  if bucket_id.nil?
102
102
  raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
103
103
  end
104
104
 
105
- params = {
105
+ api_params = {
106
106
  }
107
107
 
108
- headers = {
108
+ api_headers = {
109
109
  "content-type": 'application/json',
110
110
  }
111
111
 
112
112
  @client.call(
113
113
  method: 'GET',
114
- path: path,
115
- headers: headers,
116
- params: params,
114
+ path: api_path,
115
+ headers: api_headers,
116
+ params: api_params,
117
117
  response_type: Models::Bucket
118
118
  )
119
119
  end
@@ -125,8 +125,8 @@ module Appwrite
125
125
  # @param [String] name Bucket name
126
126
  # @param [Array] permissions An array of permission strings. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
127
127
  # @param [] file_security Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. [Learn more about permissions](/docs/permissions).
128
- # @param [] enabled Is bucket enabled?
129
- # @param [Integer] 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)
128
+ # @param [] 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.
129
+ # @param [Integer] maximum_file_size Maximum file size allowed in bytes. Maximum allowed value is 30MB.
130
130
  # @param [Array] allowed_file_extensions Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.
131
131
  # @param [String] compression Compression algorithm choosen 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
132
132
  # @param [] encryption Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled
@@ -134,7 +134,7 @@ module Appwrite
134
134
  #
135
135
  # @return [Bucket]
136
136
  def update_bucket(bucket_id:, name:, permissions: nil, file_security: nil, enabled: nil, maximum_file_size: nil, allowed_file_extensions: nil, compression: nil, encryption: nil, antivirus: nil)
137
- path = '/storage/buckets/{bucketId}'
137
+ api_path = '/storage/buckets/{bucketId}'
138
138
  .gsub('{bucketId}', bucket_id)
139
139
 
140
140
  if bucket_id.nil?
@@ -145,7 +145,7 @@ module Appwrite
145
145
  raise Appwrite::Exception.new('Missing required parameter: "name"')
146
146
  end
147
147
 
148
- params = {
148
+ api_params = {
149
149
  name: name,
150
150
  permissions: permissions,
151
151
  fileSecurity: file_security,
@@ -157,15 +157,15 @@ module Appwrite
157
157
  antivirus: antivirus,
158
158
  }
159
159
 
160
- headers = {
160
+ api_headers = {
161
161
  "content-type": 'application/json',
162
162
  }
163
163
 
164
164
  @client.call(
165
165
  method: 'PUT',
166
- path: path,
167
- headers: headers,
168
- params: params,
166
+ path: api_path,
167
+ headers: api_headers,
168
+ params: api_params,
169
169
  response_type: Models::Bucket
170
170
  )
171
171
  end
@@ -177,25 +177,25 @@ module Appwrite
177
177
  #
178
178
  # @return []
179
179
  def delete_bucket(bucket_id:)
180
- path = '/storage/buckets/{bucketId}'
180
+ api_path = '/storage/buckets/{bucketId}'
181
181
  .gsub('{bucketId}', bucket_id)
182
182
 
183
183
  if bucket_id.nil?
184
184
  raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
185
185
  end
186
186
 
187
- params = {
187
+ api_params = {
188
188
  }
189
189
 
190
- headers = {
190
+ api_headers = {
191
191
  "content-type": 'application/json',
192
192
  }
193
193
 
194
194
  @client.call(
195
195
  method: 'DELETE',
196
- path: path,
197
- headers: headers,
198
- params: params,
196
+ path: api_path,
197
+ headers: api_headers,
198
+ params: api_params,
199
199
  )
200
200
  end
201
201
 
@@ -209,27 +209,27 @@ module Appwrite
209
209
  #
210
210
  # @return [FileList]
211
211
  def list_files(bucket_id:, queries: nil, search: nil)
212
- path = '/storage/buckets/{bucketId}/files'
212
+ api_path = '/storage/buckets/{bucketId}/files'
213
213
  .gsub('{bucketId}', bucket_id)
214
214
 
215
215
  if bucket_id.nil?
216
216
  raise Appwrite::Exception.new('Missing required parameter: "bucketId"')
217
217
  end
218
218
 
219
- params = {
219
+ api_params = {
220
220
  queries: queries,
221
221
  search: search,
222
222
  }
223
223
 
224
- headers = {
224
+ api_headers = {
225
225
  "content-type": 'application/json',
226
226
  }
227
227
 
228
228
  @client.call(
229
229
  method: 'GET',
230
- path: path,
231
- headers: headers,
232
- params: params,
230
+ path: api_path,
231
+ headers: api_headers,
232
+ params: api_params,
233
233
  response_type: Models::FileList
234
234
  )
235
235
  end
@@ -261,7 +261,7 @@ module Appwrite
261
261
  #
262
262
  # @return [File]
263
263
  def create_file(bucket_id:, file_id:, file:, permissions: nil, on_progress: nil)
264
- path = '/storage/buckets/{bucketId}/files'
264
+ api_path = '/storage/buckets/{bucketId}/files'
265
265
  .gsub('{bucketId}', bucket_id)
266
266
 
267
267
  if bucket_id.nil?
@@ -276,13 +276,13 @@ module Appwrite
276
276
  raise Appwrite::Exception.new('Missing required parameter: "file"')
277
277
  end
278
278
 
279
- params = {
279
+ api_params = {
280
280
  fileId: file_id,
281
281
  file: file,
282
282
  permissions: permissions,
283
283
  }
284
284
 
285
- headers = {
285
+ api_headers = {
286
286
  "content-type": 'multipart/form-data',
287
287
  }
288
288
 
@@ -290,9 +290,9 @@ module Appwrite
290
290
  param_name = 'file'
291
291
 
292
292
  @client.chunked_upload(
293
- path: path,
294
- headers: headers,
295
- params: params,
293
+ path: api_path,
294
+ headers: api_headers,
295
+ params: api_params,
296
296
  param_name: param_name,
297
297
  id_param_name: id_param_name,
298
298
  on_progress: on_progress,
@@ -309,7 +309,7 @@ module Appwrite
309
309
  #
310
310
  # @return [File]
311
311
  def get_file(bucket_id:, file_id:)
312
- path = '/storage/buckets/{bucketId}/files/{fileId}'
312
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}'
313
313
  .gsub('{bucketId}', bucket_id)
314
314
  .gsub('{fileId}', file_id)
315
315
 
@@ -321,18 +321,18 @@ module Appwrite
321
321
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
322
322
  end
323
323
 
324
- params = {
324
+ api_params = {
325
325
  }
326
326
 
327
- headers = {
327
+ api_headers = {
328
328
  "content-type": 'application/json',
329
329
  }
330
330
 
331
331
  @client.call(
332
332
  method: 'GET',
333
- path: path,
334
- headers: headers,
335
- params: params,
333
+ path: api_path,
334
+ headers: api_headers,
335
+ params: api_params,
336
336
  response_type: Models::File
337
337
  )
338
338
  end
@@ -343,11 +343,12 @@ module Appwrite
343
343
  #
344
344
  # @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).
345
345
  # @param [String] file_id File unique ID.
346
+ # @param [String] name Name of the file
346
347
  # @param [Array] permissions An array of permission string. By default, the current permissions are inherited. [Learn more about permissions](/docs/permissions).
347
348
  #
348
349
  # @return [File]
349
- def update_file(bucket_id:, file_id:, permissions: nil)
350
- path = '/storage/buckets/{bucketId}/files/{fileId}'
350
+ def update_file(bucket_id:, file_id:, name: nil, permissions: nil)
351
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}'
351
352
  .gsub('{bucketId}', bucket_id)
352
353
  .gsub('{fileId}', file_id)
353
354
 
@@ -359,19 +360,20 @@ module Appwrite
359
360
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
360
361
  end
361
362
 
362
- params = {
363
+ api_params = {
364
+ name: name,
363
365
  permissions: permissions,
364
366
  }
365
367
 
366
- headers = {
368
+ api_headers = {
367
369
  "content-type": 'application/json',
368
370
  }
369
371
 
370
372
  @client.call(
371
373
  method: 'PUT',
372
- path: path,
373
- headers: headers,
374
- params: params,
374
+ path: api_path,
375
+ headers: api_headers,
376
+ params: api_params,
375
377
  response_type: Models::File
376
378
  )
377
379
  end
@@ -385,7 +387,7 @@ module Appwrite
385
387
  #
386
388
  # @return []
387
389
  def delete_file(bucket_id:, file_id:)
388
- path = '/storage/buckets/{bucketId}/files/{fileId}'
390
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}'
389
391
  .gsub('{bucketId}', bucket_id)
390
392
  .gsub('{fileId}', file_id)
391
393
 
@@ -397,18 +399,18 @@ module Appwrite
397
399
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
398
400
  end
399
401
 
400
- params = {
402
+ api_params = {
401
403
  }
402
404
 
403
- headers = {
405
+ api_headers = {
404
406
  "content-type": 'application/json',
405
407
  }
406
408
 
407
409
  @client.call(
408
410
  method: 'DELETE',
409
- path: path,
410
- headers: headers,
411
- params: params,
411
+ path: api_path,
412
+ headers: api_headers,
413
+ params: api_params,
412
414
  )
413
415
  end
414
416
 
@@ -422,7 +424,7 @@ module Appwrite
422
424
  #
423
425
  # @return []
424
426
  def get_file_download(bucket_id:, file_id:)
425
- path = '/storage/buckets/{bucketId}/files/{fileId}/download'
427
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}/download'
426
428
  .gsub('{bucketId}', bucket_id)
427
429
  .gsub('{fileId}', file_id)
428
430
 
@@ -434,18 +436,18 @@ module Appwrite
434
436
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
435
437
  end
436
438
 
437
- params = {
439
+ api_params = {
438
440
  }
439
441
 
440
- headers = {
442
+ api_headers = {
441
443
  "content-type": 'application/json',
442
444
  }
443
445
 
444
446
  @client.call(
445
447
  method: 'GET',
446
- path: path,
447
- headers: headers,
448
- params: params,
448
+ path: api_path,
449
+ headers: api_headers,
450
+ params: api_params,
449
451
  )
450
452
  end
451
453
 
@@ -472,7 +474,7 @@ module Appwrite
472
474
  #
473
475
  # @return []
474
476
  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)
475
- path = '/storage/buckets/{bucketId}/files/{fileId}/preview'
477
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}/preview'
476
478
  .gsub('{bucketId}', bucket_id)
477
479
  .gsub('{fileId}', file_id)
478
480
 
@@ -484,7 +486,7 @@ module Appwrite
484
486
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
485
487
  end
486
488
 
487
- params = {
489
+ api_params = {
488
490
  width: width,
489
491
  height: height,
490
492
  gravity: gravity,
@@ -498,15 +500,15 @@ module Appwrite
498
500
  output: output,
499
501
  }
500
502
 
501
- headers = {
503
+ api_headers = {
502
504
  "content-type": 'application/json',
503
505
  }
504
506
 
505
507
  @client.call(
506
508
  method: 'GET',
507
- path: path,
508
- headers: headers,
509
- params: params,
509
+ path: api_path,
510
+ headers: api_headers,
511
+ params: api_params,
510
512
  )
511
513
  end
512
514
 
@@ -520,7 +522,7 @@ module Appwrite
520
522
  #
521
523
  # @return []
522
524
  def get_file_view(bucket_id:, file_id:)
523
- path = '/storage/buckets/{bucketId}/files/{fileId}/view'
525
+ api_path = '/storage/buckets/{bucketId}/files/{fileId}/view'
524
526
  .gsub('{bucketId}', bucket_id)
525
527
  .gsub('{fileId}', file_id)
526
528
 
@@ -532,18 +534,18 @@ module Appwrite
532
534
  raise Appwrite::Exception.new('Missing required parameter: "fileId"')
533
535
  end
534
536
 
535
- params = {
537
+ api_params = {
536
538
  }
537
539
 
538
- headers = {
540
+ api_headers = {
539
541
  "content-type": 'application/json',
540
542
  }
541
543
 
542
544
  @client.call(
543
545
  method: 'GET',
544
- path: path,
545
- headers: headers,
546
- params: params,
546
+ path: api_path,
547
+ headers: api_headers,
548
+ params: api_params,
547
549
  )
548
550
  end
549
551