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,7 +3,6 @@
3
3
  module Appwrite
4
4
  class Account < Service
5
5
 
6
- include Models
7
6
  # Get currently logged in user data as JSON object.
8
7
  #
9
8
  #
@@ -21,9 +20,9 @@ module Appwrite
21
20
  @client.call(
22
21
  method: 'GET',
23
22
  path: path,
24
- params: params,
25
23
  headers: headers,
26
- response_type: User
24
+ params: params,
25
+ response_type: Models::User
27
26
  )
28
27
  end
29
28
 
@@ -48,8 +47,8 @@ module Appwrite
48
47
  @client.call(
49
48
  method: 'DELETE',
50
49
  path: path,
51
- params: params,
52
50
  headers: headers,
51
+ params: params,
53
52
  )
54
53
  end
55
54
 
@@ -89,9 +88,9 @@ module Appwrite
89
88
  @client.call(
90
89
  method: 'PATCH',
91
90
  path: path,
92
- params: params,
93
91
  headers: headers,
94
- response_type: User
92
+ params: params,
93
+ response_type: Models::User
95
94
  )
96
95
  end
97
96
 
@@ -117,9 +116,9 @@ module Appwrite
117
116
  @client.call(
118
117
  method: 'GET',
119
118
  path: path,
120
- params: params,
121
119
  headers: headers,
122
- response_type: LogList
120
+ params: params,
121
+ response_type: Models::LogList
123
122
  )
124
123
  end
125
124
 
@@ -146,9 +145,9 @@ module Appwrite
146
145
  @client.call(
147
146
  method: 'PATCH',
148
147
  path: path,
149
- params: params,
150
148
  headers: headers,
151
- response_type: User
149
+ params: params,
150
+ response_type: Models::User
152
151
  )
153
152
  end
154
153
 
@@ -179,9 +178,9 @@ module Appwrite
179
178
  @client.call(
180
179
  method: 'PATCH',
181
180
  path: path,
182
- params: params,
183
181
  headers: headers,
184
- response_type: User
182
+ params: params,
183
+ response_type: Models::User
185
184
  )
186
185
  end
187
186
 
@@ -202,14 +201,15 @@ module Appwrite
202
201
  @client.call(
203
202
  method: 'GET',
204
203
  path: path,
205
- params: params,
206
204
  headers: headers,
207
- response_type: Preferences
205
+ params: params,
206
+ response_type: Models::Preferences
208
207
  )
209
208
  end
210
209
 
211
- # Update currently logged in user account preferences. You can pass only the
212
- # specific settings you wish to update.
210
+ # Update currently logged in user account preferences. The object you pass is
211
+ # stored as is, and replaces any previous value. The maximum allowed prefs
212
+ # size is 64kB and throws error if exceeded.
213
213
  #
214
214
  # @param [object] prefs Prefs key-value JSON object.
215
215
  #
@@ -232,9 +232,9 @@ module Appwrite
232
232
  @client.call(
233
233
  method: 'PATCH',
234
234
  path: path,
235
- params: params,
236
235
  headers: headers,
237
- response_type: User
236
+ params: params,
237
+ response_type: Models::User
238
238
  )
239
239
  end
240
240
 
@@ -274,9 +274,9 @@ module Appwrite
274
274
  @client.call(
275
275
  method: 'POST',
276
276
  path: path,
277
- params: params,
278
277
  headers: headers,
279
- response_type: Token
278
+ params: params,
279
+ response_type: Models::Token
280
280
  )
281
281
  end
282
282
 
@@ -329,9 +329,9 @@ module Appwrite
329
329
  @client.call(
330
330
  method: 'PUT',
331
331
  path: path,
332
- params: params,
333
332
  headers: headers,
334
- response_type: Token
333
+ params: params,
334
+ response_type: Models::Token
335
335
  )
336
336
  end
337
337
 
@@ -353,9 +353,9 @@ module Appwrite
353
353
  @client.call(
354
354
  method: 'GET',
355
355
  path: path,
356
- params: params,
357
356
  headers: headers,
358
- response_type: SessionList
357
+ params: params,
358
+ response_type: Models::SessionList
359
359
  )
360
360
  end
361
361
 
@@ -377,8 +377,8 @@ module Appwrite
377
377
  @client.call(
378
378
  method: 'DELETE',
379
379
  path: path,
380
- params: params,
381
380
  headers: headers,
381
+ params: params,
382
382
  )
383
383
  end
384
384
 
@@ -406,15 +406,45 @@ module Appwrite
406
406
  @client.call(
407
407
  method: 'GET',
408
408
  path: path,
409
+ headers: headers,
409
410
  params: params,
411
+ response_type: Models::Session
412
+ )
413
+ end
414
+
415
+ #
416
+ #
417
+ # @param [string] session_id Session ID. Use the string &#039;current&#039; to update the current device session.
418
+ #
419
+ # @return [Session]
420
+ def update_session(session_id:)
421
+ if session_id.nil?
422
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
423
+ end
424
+
425
+ path = '/account/sessions/{sessionId}'
426
+ .gsub('{sessionId}', session_id)
427
+
428
+ params = {
429
+ }
430
+
431
+ headers = {
432
+ "content-type": 'application/json',
433
+ }
434
+
435
+ @client.call(
436
+ method: 'PATCH',
437
+ path: path,
410
438
  headers: headers,
411
- response_type: Session
439
+ params: params,
440
+ response_type: Models::Session
412
441
  )
413
442
  end
414
443
 
415
444
  # Use this endpoint to log out the currently logged in user from all their
416
445
  # account sessions across all of their different devices. When using the
417
- # option id argument, only the session unique ID provider will be deleted.
446
+ # Session ID argument, only the unique session ID provided is deleted.
447
+ #
418
448
  #
419
449
  # @param [string] session_id Session ID. Use the string &#039;current&#039; to delete the current device session.
420
450
  #
@@ -437,8 +467,8 @@ module Appwrite
437
467
  @client.call(
438
468
  method: 'DELETE',
439
469
  path: path,
440
- params: params,
441
470
  headers: headers,
471
+ params: params,
442
472
  )
443
473
  end
444
474
 
@@ -479,9 +509,9 @@ module Appwrite
479
509
  @client.call(
480
510
  method: 'POST',
481
511
  path: path,
482
- params: params,
483
512
  headers: headers,
484
- response_type: Token
513
+ params: params,
514
+ response_type: Models::Token
485
515
  )
486
516
  end
487
517
 
@@ -517,9 +547,9 @@ module Appwrite
517
547
  @client.call(
518
548
  method: 'PUT',
519
549
  path: path,
520
- params: params,
521
550
  headers: headers,
522
- response_type: Token
551
+ params: params,
552
+ response_type: Models::Token
523
553
  )
524
554
  end
525
555
 
@@ -3,7 +3,6 @@
3
3
  module Appwrite
4
4
  class Avatars < Service
5
5
 
6
- include Models
7
6
  # You can use this endpoint to show different browser icons to your users.
8
7
  # The code argument receives the browser code as it appears in your user
9
8
  # /account/sessions endpoint. Use width, height and quality arguments to
@@ -36,8 +35,8 @@ module Appwrite
36
35
  @client.call(
37
36
  method: 'GET',
38
37
  path: path,
39
- params: params,
40
38
  headers: headers,
39
+ params: params,
41
40
  )
42
41
  end
43
42
 
@@ -72,8 +71,8 @@ module Appwrite
72
71
  @client.call(
73
72
  method: 'GET',
74
73
  path: path,
75
- params: params,
76
74
  headers: headers,
75
+ params: params,
77
76
  )
78
77
  end
79
78
 
@@ -102,8 +101,8 @@ module Appwrite
102
101
  @client.call(
103
102
  method: 'GET',
104
103
  path: path,
105
- params: params,
106
104
  headers: headers,
105
+ params: params,
107
106
  )
108
107
  end
109
108
 
@@ -138,8 +137,8 @@ module Appwrite
138
137
  @client.call(
139
138
  method: 'GET',
140
139
  path: path,
141
- params: params,
142
140
  headers: headers,
141
+ params: params,
143
142
  )
144
143
  end
145
144
 
@@ -173,8 +172,8 @@ module Appwrite
173
172
  @client.call(
174
173
  method: 'GET',
175
174
  path: path,
176
- params: params,
177
175
  headers: headers,
176
+ params: params,
178
177
  )
179
178
  end
180
179
 
@@ -214,8 +213,8 @@ module Appwrite
214
213
  @client.call(
215
214
  method: 'GET',
216
215
  path: path,
217
- params: params,
218
216
  headers: headers,
217
+ params: params,
219
218
  )
220
219
  end
221
220
 
@@ -249,8 +248,8 @@ module Appwrite
249
248
  @client.call(
250
249
  method: 'GET',
251
250
  path: path,
252
- params: params,
253
251
  headers: headers,
252
+ params: params,
254
253
  )
255
254
  end
256
255
 
@@ -3,7 +3,6 @@
3
3
  module Appwrite
4
4
  class Database < Service
5
5
 
6
- include Models
7
6
  # Get a list of all the user collections. You can use the query params to
8
7
  # filter your results. On admin mode, this endpoint will return a list of all
9
8
  # of the project's collections. [Learn more about different API
@@ -36,15 +35,15 @@ module Appwrite
36
35
  @client.call(
37
36
  method: 'GET',
38
37
  path: path,
39
- params: params,
40
38
  headers: headers,
41
- response_type: CollectionList
39
+ params: params,
40
+ response_type: Models::CollectionList
42
41
  )
43
42
  end
44
43
 
45
44
  # Create a new Collection.
46
45
  #
47
- # @param [string] collection_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.
46
+ # @param [string] collection_id Unique 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.
48
47
  # @param [string] name Collection name. Max length: 128 chars.
49
48
  # @param [string] permission Permissions type model to use for reading documents in this collection. You can use collection-level permission set once on the collection using the `read` and `write` params, or you can set document-level permission where each document read and write params will decide who has access to read and write to each document individually. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
50
49
  # @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.
@@ -89,9 +88,9 @@ module Appwrite
89
88
  @client.call(
90
89
  method: 'POST',
91
90
  path: path,
92
- params: params,
93
91
  headers: headers,
94
- response_type: Collection
92
+ params: params,
93
+ response_type: Models::Collection
95
94
  )
96
95
  end
97
96
 
@@ -119,9 +118,9 @@ module Appwrite
119
118
  @client.call(
120
119
  method: 'GET',
121
120
  path: path,
122
- params: params,
123
121
  headers: headers,
124
- response_type: Collection
122
+ params: params,
123
+ response_type: Models::Collection
125
124
  )
126
125
  end
127
126
 
@@ -166,9 +165,9 @@ module Appwrite
166
165
  @client.call(
167
166
  method: 'PUT',
168
167
  path: path,
169
- params: params,
170
168
  headers: headers,
171
- response_type: Collection
169
+ params: params,
170
+ response_type: Models::Collection
172
171
  )
173
172
  end
174
173
 
@@ -196,8 +195,8 @@ module Appwrite
196
195
  @client.call(
197
196
  method: 'DELETE',
198
197
  path: path,
199
- params: params,
200
198
  headers: headers,
199
+ params: params,
201
200
  )
202
201
  end
203
202
 
@@ -224,9 +223,9 @@ module Appwrite
224
223
  @client.call(
225
224
  method: 'GET',
226
225
  path: path,
227
- params: params,
228
226
  headers: headers,
229
- response_type: AttributeList
227
+ params: params,
228
+ response_type: Models::AttributeList
230
229
  )
231
230
  end
232
231
 
@@ -270,9 +269,9 @@ module Appwrite
270
269
  @client.call(
271
270
  method: 'POST',
272
271
  path: path,
273
- params: params,
274
272
  headers: headers,
275
- response_type: AttributeBoolean
273
+ params: params,
274
+ response_type: Models::AttributeBoolean
276
275
  )
277
276
  end
278
277
 
@@ -316,9 +315,9 @@ module Appwrite
316
315
  @client.call(
317
316
  method: 'POST',
318
317
  path: path,
319
- params: params,
320
318
  headers: headers,
321
- response_type: AttributeEmail
319
+ params: params,
320
+ response_type: Models::AttributeEmail
322
321
  )
323
322
  end
324
323
 
@@ -367,9 +366,9 @@ module Appwrite
367
366
  @client.call(
368
367
  method: 'POST',
369
368
  path: path,
370
- params: params,
371
369
  headers: headers,
372
- response_type: AttributeEnum
370
+ params: params,
371
+ response_type: Models::AttributeEnum
373
372
  )
374
373
  end
375
374
 
@@ -380,9 +379,9 @@ module Appwrite
380
379
  # @param [string] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).
381
380
  # @param [string] key Attribute Key.
382
381
  # @param [boolean] required Is attribute required?
383
- # @param [string] min Minimum value to enforce on new documents
384
- # @param [string] max Maximum value to enforce on new documents
385
- # @param [string] default Default value for attribute when not provided. Cannot be set when attribute is required.
382
+ # @param [number] min Minimum value to enforce on new documents
383
+ # @param [number] max Maximum value to enforce on new documents
384
+ # @param [number] default Default value for attribute when not provided. Cannot be set when attribute is required.
386
385
  # @param [boolean] array Is attribute an array?
387
386
  #
388
387
  # @return [AttributeFloat]
@@ -418,9 +417,9 @@ module Appwrite
418
417
  @client.call(
419
418
  method: 'POST',
420
419
  path: path,
421
- params: params,
422
420
  headers: headers,
423
- response_type: AttributeFloat
421
+ params: params,
422
+ response_type: Models::AttributeFloat
424
423
  )
425
424
  end
426
425
 
@@ -469,9 +468,9 @@ module Appwrite
469
468
  @client.call(
470
469
  method: 'POST',
471
470
  path: path,
472
- params: params,
473
471
  headers: headers,
474
- response_type: AttributeInteger
472
+ params: params,
473
+ response_type: Models::AttributeInteger
475
474
  )
476
475
  end
477
476
 
@@ -515,9 +514,9 @@ module Appwrite
515
514
  @client.call(
516
515
  method: 'POST',
517
516
  path: path,
518
- params: params,
519
517
  headers: headers,
520
- response_type: AttributeIp
518
+ params: params,
519
+ response_type: Models::AttributeIp
521
520
  )
522
521
  end
523
522
 
@@ -567,9 +566,9 @@ module Appwrite
567
566
  @client.call(
568
567
  method: 'POST',
569
568
  path: path,
570
- params: params,
571
569
  headers: headers,
572
- response_type: AttributeString
570
+ params: params,
571
+ response_type: Models::AttributeString
573
572
  )
574
573
  end
575
574
 
@@ -613,9 +612,9 @@ module Appwrite
613
612
  @client.call(
614
613
  method: 'POST',
615
614
  path: path,
616
- params: params,
617
615
  headers: headers,
618
- response_type: AttributeUrl
616
+ params: params,
617
+ response_type: Models::AttributeUrl
619
618
  )
620
619
  end
621
620
 
@@ -648,8 +647,8 @@ module Appwrite
648
647
  @client.call(
649
648
  method: 'GET',
650
649
  path: path,
651
- params: params,
652
650
  headers: headers,
651
+ params: params,
653
652
  )
654
653
  end
655
654
 
@@ -682,8 +681,8 @@ module Appwrite
682
681
  @client.call(
683
682
  method: 'DELETE',
684
683
  path: path,
685
- params: params,
686
684
  headers: headers,
685
+ params: params,
687
686
  )
688
687
  end
689
688
 
@@ -727,9 +726,9 @@ module Appwrite
727
726
  @client.call(
728
727
  method: 'GET',
729
728
  path: path,
730
- params: params,
731
729
  headers: headers,
732
- response_type: DocumentList
730
+ params: params,
731
+ response_type: Models::DocumentList
733
732
  )
734
733
  end
735
734
 
@@ -738,8 +737,8 @@ module Appwrite
738
737
  # integration](/docs/server/database#databaseCreateCollection) API or
739
738
  # directly from your database console.
740
739
  #
741
- # @param [string] collection_id Collection ID. You can create a new collection with validation rules using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).
742
- # @param [string] document_id Document 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.
740
+ # @param [string] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection). Make sure to define attributes before creating documents.
741
+ # @param [string] document_id Document 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.
743
742
  # @param [object] data Document data as JSON object.
744
743
  # @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.
745
744
  # @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.
@@ -775,9 +774,9 @@ module Appwrite
775
774
  @client.call(
776
775
  method: 'POST',
777
776
  path: path,
778
- params: params,
779
777
  headers: headers,
780
- response_type: Document
778
+ params: params,
779
+ response_type: Models::Document
781
780
  )
782
781
  end
783
782
 
@@ -811,16 +810,16 @@ module Appwrite
811
810
  @client.call(
812
811
  method: 'GET',
813
812
  path: path,
814
- params: params,
815
813
  headers: headers,
816
- response_type: Document
814
+ params: params,
815
+ response_type: Models::Document
817
816
  )
818
817
  end
819
818
 
820
819
  # Update a document by its unique ID. Using the patch method you can pass
821
820
  # only specific fields that will get updated.
822
821
  #
823
- # @param [string] collection_id Collection ID. You can create a new collection with validation rules using the Database service [server integration](https://appwrite.io/docs/server/database#createCollection).
822
+ # @param [string] collection_id Collection ID.
824
823
  # @param [string] document_id Document ID.
825
824
  # @param [object] data Document data as JSON object.
826
825
  # @param [array] read An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
@@ -857,9 +856,9 @@ module Appwrite
857
856
  @client.call(
858
857
  method: 'PATCH',
859
858
  path: path,
860
- params: params,
861
859
  headers: headers,
862
- response_type: Document
860
+ params: params,
861
+ response_type: Models::Document
863
862
  )
864
863
  end
865
864
 
@@ -894,8 +893,8 @@ module Appwrite
894
893
  @client.call(
895
894
  method: 'DELETE',
896
895
  path: path,
897
- params: params,
898
896
  headers: headers,
897
+ params: params,
899
898
  )
900
899
  end
901
900
 
@@ -922,9 +921,9 @@ module Appwrite
922
921
  @client.call(
923
922
  method: 'GET',
924
923
  path: path,
925
- params: params,
926
924
  headers: headers,
927
- response_type: IndexList
925
+ params: params,
926
+ response_type: Models::IndexList
928
927
  )
929
928
  end
930
929
 
@@ -971,9 +970,9 @@ module Appwrite
971
970
  @client.call(
972
971
  method: 'POST',
973
972
  path: path,
974
- params: params,
975
973
  headers: headers,
976
- response_type: Index
974
+ params: params,
975
+ response_type: Models::Index
977
976
  )
978
977
  end
979
978
 
@@ -1006,9 +1005,9 @@ module Appwrite
1006
1005
  @client.call(
1007
1006
  method: 'GET',
1008
1007
  path: path,
1009
- params: params,
1010
1008
  headers: headers,
1011
- response_type: Index
1009
+ params: params,
1010
+ response_type: Models::Index
1012
1011
  )
1013
1012
  end
1014
1013
 
@@ -1041,8 +1040,8 @@ module Appwrite
1041
1040
  @client.call(
1042
1041
  method: 'DELETE',
1043
1042
  path: path,
1044
- params: params,
1045
1043
  headers: headers,
1044
+ params: params,
1046
1045
  )
1047
1046
  end
1048
1047