appwrite 8.0.0 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -7,25 +7,25 @@ module Appwrite
7
7
  @client = client
8
8
  end
9
9
 
10
- # Get currently logged in user data as JSON object.
10
+ # Get the currently logged in user.
11
11
  #
12
12
  #
13
13
  # @return [User]
14
14
  def get()
15
- path = '/account'
15
+ api_path = '/account'
16
16
 
17
- params = {
17
+ api_params = {
18
18
  }
19
19
 
20
- headers = {
20
+ api_headers = {
21
21
  "content-type": 'application/json',
22
22
  }
23
23
 
24
24
  @client.call(
25
25
  method: 'GET',
26
- path: path,
27
- headers: headers,
28
- params: params,
26
+ path: api_path,
27
+ headers: api_headers,
28
+ params: api_params,
29
29
  response_type: Models::User
30
30
  )
31
31
  end
@@ -45,7 +45,7 @@ module Appwrite
45
45
  #
46
46
  # @return [User]
47
47
  def update_email(email:, password:)
48
- path = '/account/email'
48
+ api_path = '/account/email'
49
49
 
50
50
  if email.nil?
51
51
  raise Appwrite::Exception.new('Missing required parameter: "email"')
@@ -55,47 +55,102 @@ module Appwrite
55
55
  raise Appwrite::Exception.new('Missing required parameter: "password"')
56
56
  end
57
57
 
58
- params = {
58
+ api_params = {
59
59
  email: email,
60
60
  password: password,
61
61
  }
62
62
 
63
- headers = {
63
+ api_headers = {
64
64
  "content-type": 'application/json',
65
65
  }
66
66
 
67
67
  @client.call(
68
68
  method: 'PATCH',
69
- path: path,
70
- headers: headers,
71
- params: params,
69
+ path: api_path,
70
+ headers: api_headers,
71
+ params: api_params,
72
72
  response_type: Models::User
73
73
  )
74
74
  end
75
75
 
76
76
 
77
- # Get currently logged in user list of latest security activity logs. Each
78
- # log returns user IP address, location and date and time of log.
77
+ # Get the list of identities for the currently logged in user.
78
+ #
79
+ # @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: userId, provider, providerUid, providerEmail, providerAccessTokenExpiry
80
+ #
81
+ # @return [IdentityList]
82
+ def list_identities(queries: nil)
83
+ api_path = '/account/identities'
84
+
85
+ api_params = {
86
+ queries: queries,
87
+ }
88
+
89
+ api_headers = {
90
+ "content-type": 'application/json',
91
+ }
92
+
93
+ @client.call(
94
+ method: 'GET',
95
+ path: api_path,
96
+ headers: api_headers,
97
+ params: api_params,
98
+ response_type: Models::IdentityList
99
+ )
100
+ end
101
+
102
+
103
+ # Delete an identity by its unique ID.
104
+ #
105
+ # @param [String] identity_id Identity ID.
106
+ #
107
+ # @return []
108
+ def delete_identity(identity_id:)
109
+ api_path = '/account/identities/{identityId}'
110
+ .gsub('{identityId}', identity_id)
111
+
112
+ if identity_id.nil?
113
+ raise Appwrite::Exception.new('Missing required parameter: "identityId"')
114
+ end
115
+
116
+ api_params = {
117
+ }
118
+
119
+ api_headers = {
120
+ "content-type": 'application/json',
121
+ }
122
+
123
+ @client.call(
124
+ method: 'DELETE',
125
+ path: api_path,
126
+ headers: api_headers,
127
+ params: api_params,
128
+ )
129
+ end
130
+
131
+
132
+ # Get the list of latest security activity logs for the currently logged in
133
+ # user. Each log returns user IP address, location and date and time of log.
79
134
  #
80
135
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Only supported methods are limit and offset
81
136
  #
82
137
  # @return [LogList]
83
138
  def list_logs(queries: nil)
84
- path = '/account/logs'
139
+ api_path = '/account/logs'
85
140
 
86
- params = {
141
+ api_params = {
87
142
  queries: queries,
88
143
  }
89
144
 
90
- headers = {
145
+ api_headers = {
91
146
  "content-type": 'application/json',
92
147
  }
93
148
 
94
149
  @client.call(
95
150
  method: 'GET',
96
- path: path,
97
- headers: headers,
98
- params: params,
151
+ path: api_path,
152
+ headers: api_headers,
153
+ params: api_params,
99
154
  response_type: Models::LogList
100
155
  )
101
156
  end
@@ -107,25 +162,25 @@ module Appwrite
107
162
  #
108
163
  # @return [User]
109
164
  def update_name(name:)
110
- path = '/account/name'
165
+ api_path = '/account/name'
111
166
 
112
167
  if name.nil?
113
168
  raise Appwrite::Exception.new('Missing required parameter: "name"')
114
169
  end
115
170
 
116
- params = {
171
+ api_params = {
117
172
  name: name,
118
173
  }
119
174
 
120
- headers = {
175
+ api_headers = {
121
176
  "content-type": 'application/json',
122
177
  }
123
178
 
124
179
  @client.call(
125
180
  method: 'PATCH',
126
- path: path,
127
- headers: headers,
128
- params: params,
181
+ path: api_path,
182
+ headers: api_headers,
183
+ params: api_params,
129
184
  response_type: Models::User
130
185
  )
131
186
  end
@@ -140,26 +195,26 @@ module Appwrite
140
195
  #
141
196
  # @return [User]
142
197
  def update_password(password:, old_password: nil)
143
- path = '/account/password'
198
+ api_path = '/account/password'
144
199
 
145
200
  if password.nil?
146
201
  raise Appwrite::Exception.new('Missing required parameter: "password"')
147
202
  end
148
203
 
149
- params = {
204
+ api_params = {
150
205
  password: password,
151
206
  oldPassword: old_password,
152
207
  }
153
208
 
154
- headers = {
209
+ api_headers = {
155
210
  "content-type": 'application/json',
156
211
  }
157
212
 
158
213
  @client.call(
159
214
  method: 'PATCH',
160
- path: path,
161
- headers: headers,
162
- params: params,
215
+ path: api_path,
216
+ headers: api_headers,
217
+ params: api_params,
163
218
  response_type: Models::User
164
219
  )
165
220
  end
@@ -176,7 +231,7 @@ module Appwrite
176
231
  #
177
232
  # @return [User]
178
233
  def update_phone(phone:, password:)
179
- path = '/account/phone'
234
+ api_path = '/account/phone'
180
235
 
181
236
  if phone.nil?
182
237
  raise Appwrite::Exception.new('Missing required parameter: "phone"')
@@ -186,44 +241,44 @@ module Appwrite
186
241
  raise Appwrite::Exception.new('Missing required parameter: "password"')
187
242
  end
188
243
 
189
- params = {
244
+ api_params = {
190
245
  phone: phone,
191
246
  password: password,
192
247
  }
193
248
 
194
- headers = {
249
+ api_headers = {
195
250
  "content-type": 'application/json',
196
251
  }
197
252
 
198
253
  @client.call(
199
254
  method: 'PATCH',
200
- path: path,
201
- headers: headers,
202
- params: params,
255
+ path: api_path,
256
+ headers: api_headers,
257
+ params: api_params,
203
258
  response_type: Models::User
204
259
  )
205
260
  end
206
261
 
207
262
 
208
- # Get currently logged in user preferences as a key-value object.
263
+ # Get the preferences as a key-value object for the currently logged in user.
209
264
  #
210
265
  #
211
266
  # @return [Preferences]
212
267
  def get_prefs()
213
- path = '/account/prefs'
268
+ api_path = '/account/prefs'
214
269
 
215
- params = {
270
+ api_params = {
216
271
  }
217
272
 
218
- headers = {
273
+ api_headers = {
219
274
  "content-type": 'application/json',
220
275
  }
221
276
 
222
277
  @client.call(
223
278
  method: 'GET',
224
- path: path,
225
- headers: headers,
226
- params: params,
279
+ path: api_path,
280
+ headers: api_headers,
281
+ params: api_params,
227
282
  response_type: Models::Preferences
228
283
  )
229
284
  end
@@ -237,25 +292,25 @@ module Appwrite
237
292
  #
238
293
  # @return [User]
239
294
  def update_prefs(prefs:)
240
- path = '/account/prefs'
295
+ api_path = '/account/prefs'
241
296
 
242
297
  if prefs.nil?
243
298
  raise Appwrite::Exception.new('Missing required parameter: "prefs"')
244
299
  end
245
300
 
246
- params = {
301
+ api_params = {
247
302
  prefs: prefs,
248
303
  }
249
304
 
250
- headers = {
305
+ api_headers = {
251
306
  "content-type": 'application/json',
252
307
  }
253
308
 
254
309
  @client.call(
255
310
  method: 'PATCH',
256
- path: path,
257
- headers: headers,
258
- params: params,
311
+ path: api_path,
312
+ headers: api_headers,
313
+ params: api_params,
259
314
  response_type: Models::User
260
315
  )
261
316
  end
@@ -275,7 +330,7 @@ module Appwrite
275
330
  #
276
331
  # @return [Token]
277
332
  def create_recovery(email:, url:)
278
- path = '/account/recovery'
333
+ api_path = '/account/recovery'
279
334
 
280
335
  if email.nil?
281
336
  raise Appwrite::Exception.new('Missing required parameter: "email"')
@@ -285,20 +340,20 @@ module Appwrite
285
340
  raise Appwrite::Exception.new('Missing required parameter: "url"')
286
341
  end
287
342
 
288
- params = {
343
+ api_params = {
289
344
  email: email,
290
345
  url: url,
291
346
  }
292
347
 
293
- headers = {
348
+ api_headers = {
294
349
  "content-type": 'application/json',
295
350
  }
296
351
 
297
352
  @client.call(
298
353
  method: 'POST',
299
- path: path,
300
- headers: headers,
301
- params: params,
354
+ path: api_path,
355
+ headers: api_headers,
356
+ params: api_params,
302
357
  response_type: Models::Token
303
358
  )
304
359
  end
@@ -321,7 +376,7 @@ module Appwrite
321
376
  #
322
377
  # @return [Token]
323
378
  def update_recovery(user_id:, secret:, password:, password_again:)
324
- path = '/account/recovery'
379
+ api_path = '/account/recovery'
325
380
 
326
381
  if user_id.nil?
327
382
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -339,47 +394,47 @@ module Appwrite
339
394
  raise Appwrite::Exception.new('Missing required parameter: "passwordAgain"')
340
395
  end
341
396
 
342
- params = {
397
+ api_params = {
343
398
  userId: user_id,
344
399
  secret: secret,
345
400
  password: password,
346
401
  passwordAgain: password_again,
347
402
  }
348
403
 
349
- headers = {
404
+ api_headers = {
350
405
  "content-type": 'application/json',
351
406
  }
352
407
 
353
408
  @client.call(
354
409
  method: 'PUT',
355
- path: path,
356
- headers: headers,
357
- params: params,
410
+ path: api_path,
411
+ headers: api_headers,
412
+ params: api_params,
358
413
  response_type: Models::Token
359
414
  )
360
415
  end
361
416
 
362
417
 
363
- # Get currently logged in user list of active sessions across different
364
- # devices.
418
+ # Get the list of active sessions across different devices for the currently
419
+ # logged in user.
365
420
  #
366
421
  #
367
422
  # @return [SessionList]
368
423
  def list_sessions()
369
- path = '/account/sessions'
424
+ api_path = '/account/sessions'
370
425
 
371
- params = {
426
+ api_params = {
372
427
  }
373
428
 
374
- headers = {
429
+ api_headers = {
375
430
  "content-type": 'application/json',
376
431
  }
377
432
 
378
433
  @client.call(
379
434
  method: 'GET',
380
- path: path,
381
- headers: headers,
382
- params: params,
435
+ path: api_path,
436
+ headers: api_headers,
437
+ params: api_params,
383
438
  response_type: Models::SessionList
384
439
  )
385
440
  end
@@ -391,20 +446,20 @@ module Appwrite
391
446
  #
392
447
  # @return []
393
448
  def delete_sessions()
394
- path = '/account/sessions'
449
+ api_path = '/account/sessions'
395
450
 
396
- params = {
451
+ api_params = {
397
452
  }
398
453
 
399
- headers = {
454
+ api_headers = {
400
455
  "content-type": 'application/json',
401
456
  }
402
457
 
403
458
  @client.call(
404
459
  method: 'DELETE',
405
- path: path,
406
- headers: headers,
407
- params: params,
460
+ path: api_path,
461
+ headers: api_headers,
462
+ params: api_params,
408
463
  )
409
464
  end
410
465
 
@@ -416,25 +471,25 @@ module Appwrite
416
471
  #
417
472
  # @return [Session]
418
473
  def get_session(session_id:)
419
- path = '/account/sessions/{sessionId}'
474
+ api_path = '/account/sessions/{sessionId}'
420
475
  .gsub('{sessionId}', session_id)
421
476
 
422
477
  if session_id.nil?
423
478
  raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
424
479
  end
425
480
 
426
- params = {
481
+ api_params = {
427
482
  }
428
483
 
429
- headers = {
484
+ api_headers = {
430
485
  "content-type": 'application/json',
431
486
  }
432
487
 
433
488
  @client.call(
434
489
  method: 'GET',
435
- path: path,
436
- headers: headers,
437
- params: params,
490
+ path: api_path,
491
+ headers: api_headers,
492
+ params: api_params,
438
493
  response_type: Models::Session
439
494
  )
440
495
  end
@@ -448,58 +503,58 @@ module Appwrite
448
503
  #
449
504
  # @return [Session]
450
505
  def update_session(session_id:)
451
- path = '/account/sessions/{sessionId}'
506
+ api_path = '/account/sessions/{sessionId}'
452
507
  .gsub('{sessionId}', session_id)
453
508
 
454
509
  if session_id.nil?
455
510
  raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
456
511
  end
457
512
 
458
- params = {
513
+ api_params = {
459
514
  }
460
515
 
461
- headers = {
516
+ api_headers = {
462
517
  "content-type": 'application/json',
463
518
  }
464
519
 
465
520
  @client.call(
466
521
  method: 'PATCH',
467
- path: path,
468
- headers: headers,
469
- params: params,
522
+ path: api_path,
523
+ headers: api_headers,
524
+ params: api_params,
470
525
  response_type: Models::Session
471
526
  )
472
527
  end
473
528
 
474
529
 
475
- # Use this endpoint to log out the currently logged in user from all their
476
- # account sessions across all of their different devices. When using the
477
- # Session ID argument, only the unique session ID provided is deleted.
478
- #
530
+ # Logout the user. Use 'current' as the session ID to logout on this device,
531
+ # use a session ID to logout on another device. If you're looking to logout
532
+ # the user on all devices, use [Delete
533
+ # Sessions](/docs/client/account#accountDeleteSessions) instead.
479
534
  #
480
535
  # @param [String] session_id Session ID. Use the string 'current' to delete the current device session.
481
536
  #
482
537
  # @return []
483
538
  def delete_session(session_id:)
484
- path = '/account/sessions/{sessionId}'
539
+ api_path = '/account/sessions/{sessionId}'
485
540
  .gsub('{sessionId}', session_id)
486
541
 
487
542
  if session_id.nil?
488
543
  raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
489
544
  end
490
545
 
491
- params = {
546
+ api_params = {
492
547
  }
493
548
 
494
- headers = {
549
+ api_headers = {
495
550
  "content-type": 'application/json',
496
551
  }
497
552
 
498
553
  @client.call(
499
554
  method: 'DELETE',
500
- path: path,
501
- headers: headers,
502
- params: params,
555
+ path: api_path,
556
+ headers: api_headers,
557
+ params: api_params,
503
558
  )
504
559
  end
505
560
 
@@ -511,20 +566,20 @@ module Appwrite
511
566
  #
512
567
  # @return [User]
513
568
  def update_status()
514
- path = '/account/status'
569
+ api_path = '/account/status'
515
570
 
516
- params = {
571
+ api_params = {
517
572
  }
518
573
 
519
- headers = {
574
+ api_headers = {
520
575
  "content-type": 'application/json',
521
576
  }
522
577
 
523
578
  @client.call(
524
579
  method: 'PATCH',
525
- path: path,
526
- headers: headers,
527
- params: params,
580
+ path: api_path,
581
+ headers: api_headers,
582
+ params: api_params,
528
583
  response_type: Models::User
529
584
  )
530
585
  end
@@ -550,25 +605,25 @@ module Appwrite
550
605
  #
551
606
  # @return [Token]
552
607
  def create_verification(url:)
553
- path = '/account/verification'
608
+ api_path = '/account/verification'
554
609
 
555
610
  if url.nil?
556
611
  raise Appwrite::Exception.new('Missing required parameter: "url"')
557
612
  end
558
613
 
559
- params = {
614
+ api_params = {
560
615
  url: url,
561
616
  }
562
617
 
563
- headers = {
618
+ api_headers = {
564
619
  "content-type": 'application/json',
565
620
  }
566
621
 
567
622
  @client.call(
568
623
  method: 'POST',
569
- path: path,
570
- headers: headers,
571
- params: params,
624
+ path: api_path,
625
+ headers: api_headers,
626
+ params: api_params,
572
627
  response_type: Models::Token
573
628
  )
574
629
  end
@@ -584,7 +639,7 @@ module Appwrite
584
639
  #
585
640
  # @return [Token]
586
641
  def update_verification(user_id:, secret:)
587
- path = '/account/verification'
642
+ api_path = '/account/verification'
588
643
 
589
644
  if user_id.nil?
590
645
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -594,20 +649,20 @@ module Appwrite
594
649
  raise Appwrite::Exception.new('Missing required parameter: "secret"')
595
650
  end
596
651
 
597
- params = {
652
+ api_params = {
598
653
  userId: user_id,
599
654
  secret: secret,
600
655
  }
601
656
 
602
- headers = {
657
+ api_headers = {
603
658
  "content-type": 'application/json',
604
659
  }
605
660
 
606
661
  @client.call(
607
662
  method: 'PUT',
608
- path: path,
609
- headers: headers,
610
- params: params,
663
+ path: api_path,
664
+ headers: api_headers,
665
+ params: api_params,
611
666
  response_type: Models::Token
612
667
  )
613
668
  end
@@ -623,20 +678,20 @@ module Appwrite
623
678
  #
624
679
  # @return [Token]
625
680
  def create_phone_verification()
626
- path = '/account/verification/phone'
681
+ api_path = '/account/verification/phone'
627
682
 
628
- params = {
683
+ api_params = {
629
684
  }
630
685
 
631
- headers = {
686
+ api_headers = {
632
687
  "content-type": 'application/json',
633
688
  }
634
689
 
635
690
  @client.call(
636
691
  method: 'POST',
637
- path: path,
638
- headers: headers,
639
- params: params,
692
+ path: api_path,
693
+ headers: api_headers,
694
+ params: api_params,
640
695
  response_type: Models::Token
641
696
  )
642
697
  end
@@ -652,7 +707,7 @@ module Appwrite
652
707
  #
653
708
  # @return [Token]
654
709
  def update_phone_verification(user_id:, secret:)
655
- path = '/account/verification/phone'
710
+ api_path = '/account/verification/phone'
656
711
 
657
712
  if user_id.nil?
658
713
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -662,20 +717,20 @@ module Appwrite
662
717
  raise Appwrite::Exception.new('Missing required parameter: "secret"')
663
718
  end
664
719
 
665
- params = {
720
+ api_params = {
666
721
  userId: user_id,
667
722
  secret: secret,
668
723
  }
669
724
 
670
- headers = {
725
+ api_headers = {
671
726
  "content-type": 'application/json',
672
727
  }
673
728
 
674
729
  @client.call(
675
730
  method: 'PUT',
676
- path: path,
677
- headers: headers,
678
- params: params,
731
+ path: api_path,
732
+ headers: api_headers,
733
+ params: api_params,
679
734
  response_type: Models::Token
680
735
  )
681
736
  end