appwrite 8.0.0 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +2 -2
  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/services/account.rb +105 -50
  27. data/lib/appwrite/services/avatars.rb +14 -14
  28. data/lib/appwrite/services/databases.rb +106 -94
  29. data/lib/appwrite/services/functions.rb +149 -63
  30. data/lib/appwrite/services/graphql.rb +4 -4
  31. data/lib/appwrite/services/health.rb +71 -22
  32. data/lib/appwrite/services/locale.rb +39 -14
  33. data/lib/appwrite/services/storage.rb +33 -31
  34. data/lib/appwrite/services/teams.rb +28 -27
  35. data/lib/appwrite/services/users.rb +148 -50
  36. data/lib/appwrite.rb +5 -0
  37. metadata +7 -2
@@ -7,12 +7,12 @@ 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
17
  params = {
18
18
  }
@@ -23,7 +23,7 @@ module Appwrite
23
23
 
24
24
  @client.call(
25
25
  method: 'GET',
26
- path: path,
26
+ path: api_path,
27
27
  headers: headers,
28
28
  params: params,
29
29
  response_type: Models::User
@@ -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"')
@@ -66,7 +66,7 @@ module Appwrite
66
66
 
67
67
  @client.call(
68
68
  method: 'PATCH',
69
- path: path,
69
+ path: api_path,
70
70
  headers: headers,
71
71
  params: params,
72
72
  response_type: Models::User
@@ -74,14 +74,69 @@ module Appwrite
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
+ params = {
86
+ queries: queries,
87
+ }
88
+
89
+ headers = {
90
+ "content-type": 'application/json',
91
+ }
92
+
93
+ @client.call(
94
+ method: 'GET',
95
+ path: api_path,
96
+ headers: headers,
97
+ params: 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
+ params = {
117
+ }
118
+
119
+ headers = {
120
+ "content-type": 'application/json',
121
+ }
122
+
123
+ @client.call(
124
+ method: 'DELETE',
125
+ path: api_path,
126
+ headers: headers,
127
+ params: 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
141
  params = {
87
142
  queries: queries,
@@ -93,7 +148,7 @@ module Appwrite
93
148
 
94
149
  @client.call(
95
150
  method: 'GET',
96
- path: path,
151
+ path: api_path,
97
152
  headers: headers,
98
153
  params: params,
99
154
  response_type: Models::LogList
@@ -107,7 +162,7 @@ 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"')
@@ -123,7 +178,7 @@ module Appwrite
123
178
 
124
179
  @client.call(
125
180
  method: 'PATCH',
126
- path: path,
181
+ path: api_path,
127
182
  headers: headers,
128
183
  params: params,
129
184
  response_type: Models::User
@@ -140,7 +195,7 @@ 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"')
@@ -157,7 +212,7 @@ module Appwrite
157
212
 
158
213
  @client.call(
159
214
  method: 'PATCH',
160
- path: path,
215
+ path: api_path,
161
216
  headers: headers,
162
217
  params: params,
163
218
  response_type: Models::User
@@ -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"')
@@ -197,7 +252,7 @@ module Appwrite
197
252
 
198
253
  @client.call(
199
254
  method: 'PATCH',
200
- path: path,
255
+ path: api_path,
201
256
  headers: headers,
202
257
  params: params,
203
258
  response_type: Models::User
@@ -205,12 +260,12 @@ module Appwrite
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
270
  params = {
216
271
  }
@@ -221,7 +276,7 @@ module Appwrite
221
276
 
222
277
  @client.call(
223
278
  method: 'GET',
224
- path: path,
279
+ path: api_path,
225
280
  headers: headers,
226
281
  params: params,
227
282
  response_type: Models::Preferences
@@ -237,7 +292,7 @@ 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"')
@@ -253,7 +308,7 @@ module Appwrite
253
308
 
254
309
  @client.call(
255
310
  method: 'PATCH',
256
- path: path,
311
+ path: api_path,
257
312
  headers: headers,
258
313
  params: params,
259
314
  response_type: Models::User
@@ -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"')
@@ -296,7 +351,7 @@ module Appwrite
296
351
 
297
352
  @client.call(
298
353
  method: 'POST',
299
- path: path,
354
+ path: api_path,
300
355
  headers: headers,
301
356
  params: params,
302
357
  response_type: Models::Token
@@ -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"')
@@ -352,7 +407,7 @@ module Appwrite
352
407
 
353
408
  @client.call(
354
409
  method: 'PUT',
355
- path: path,
410
+ path: api_path,
356
411
  headers: headers,
357
412
  params: params,
358
413
  response_type: Models::Token
@@ -360,13 +415,13 @@ module Appwrite
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
426
  params = {
372
427
  }
@@ -377,7 +432,7 @@ module Appwrite
377
432
 
378
433
  @client.call(
379
434
  method: 'GET',
380
- path: path,
435
+ path: api_path,
381
436
  headers: headers,
382
437
  params: params,
383
438
  response_type: Models::SessionList
@@ -391,7 +446,7 @@ module Appwrite
391
446
  #
392
447
  # @return []
393
448
  def delete_sessions()
394
- path = '/account/sessions'
449
+ api_path = '/account/sessions'
395
450
 
396
451
  params = {
397
452
  }
@@ -402,7 +457,7 @@ module Appwrite
402
457
 
403
458
  @client.call(
404
459
  method: 'DELETE',
405
- path: path,
460
+ path: api_path,
406
461
  headers: headers,
407
462
  params: params,
408
463
  )
@@ -416,7 +471,7 @@ 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?
@@ -432,7 +487,7 @@ module Appwrite
432
487
 
433
488
  @client.call(
434
489
  method: 'GET',
435
- path: path,
490
+ path: api_path,
436
491
  headers: headers,
437
492
  params: params,
438
493
  response_type: Models::Session
@@ -448,7 +503,7 @@ 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?
@@ -464,7 +519,7 @@ module Appwrite
464
519
 
465
520
  @client.call(
466
521
  method: 'PATCH',
467
- path: path,
522
+ path: api_path,
468
523
  headers: headers,
469
524
  params: params,
470
525
  response_type: Models::Session
@@ -472,16 +527,16 @@ module Appwrite
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?
@@ -497,7 +552,7 @@ module Appwrite
497
552
 
498
553
  @client.call(
499
554
  method: 'DELETE',
500
- path: path,
555
+ path: api_path,
501
556
  headers: headers,
502
557
  params: params,
503
558
  )
@@ -511,7 +566,7 @@ 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
571
  params = {
517
572
  }
@@ -522,7 +577,7 @@ module Appwrite
522
577
 
523
578
  @client.call(
524
579
  method: 'PATCH',
525
- path: path,
580
+ path: api_path,
526
581
  headers: headers,
527
582
  params: params,
528
583
  response_type: Models::User
@@ -550,7 +605,7 @@ 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"')
@@ -566,7 +621,7 @@ module Appwrite
566
621
 
567
622
  @client.call(
568
623
  method: 'POST',
569
- path: path,
624
+ path: api_path,
570
625
  headers: headers,
571
626
  params: params,
572
627
  response_type: Models::Token
@@ -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"')
@@ -605,7 +660,7 @@ module Appwrite
605
660
 
606
661
  @client.call(
607
662
  method: 'PUT',
608
- path: path,
663
+ path: api_path,
609
664
  headers: headers,
610
665
  params: params,
611
666
  response_type: Models::Token
@@ -623,7 +678,7 @@ 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
683
  params = {
629
684
  }
@@ -634,7 +689,7 @@ module Appwrite
634
689
 
635
690
  @client.call(
636
691
  method: 'POST',
637
- path: path,
692
+ path: api_path,
638
693
  headers: headers,
639
694
  params: params,
640
695
  response_type: Models::Token
@@ -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"')
@@ -673,7 +728,7 @@ module Appwrite
673
728
 
674
729
  @client.call(
675
730
  method: 'PUT',
676
- path: path,
731
+ path: api_path,
677
732
  headers: headers,
678
733
  params: params,
679
734
  response_type: Models::Token
@@ -24,7 +24,7 @@ module Appwrite
24
24
  #
25
25
  # @return []
26
26
  def get_browser(code:, width: nil, height: nil, quality: nil)
27
- path = '/avatars/browsers/{code}'
27
+ api_path = '/avatars/browsers/{code}'
28
28
  .gsub('{code}', code)
29
29
 
30
30
  if code.nil?
@@ -43,7 +43,7 @@ module Appwrite
43
43
 
44
44
  @client.call(
45
45
  method: 'GET',
46
- path: path,
46
+ path: api_path,
47
47
  headers: headers,
48
48
  params: params,
49
49
  )
@@ -67,7 +67,7 @@ module Appwrite
67
67
  #
68
68
  # @return []
69
69
  def get_credit_card(code:, width: nil, height: nil, quality: nil)
70
- path = '/avatars/credit-cards/{code}'
70
+ api_path = '/avatars/credit-cards/{code}'
71
71
  .gsub('{code}', code)
72
72
 
73
73
  if code.nil?
@@ -86,7 +86,7 @@ module Appwrite
86
86
 
87
87
  @client.call(
88
88
  method: 'GET',
89
- path: path,
89
+ path: api_path,
90
90
  headers: headers,
91
91
  params: params,
92
92
  )
@@ -101,7 +101,7 @@ module Appwrite
101
101
  #
102
102
  # @return []
103
103
  def get_favicon(url:)
104
- path = '/avatars/favicon'
104
+ api_path = '/avatars/favicon'
105
105
 
106
106
  if url.nil?
107
107
  raise Appwrite::Exception.new('Missing required parameter: "url"')
@@ -117,7 +117,7 @@ module Appwrite
117
117
 
118
118
  @client.call(
119
119
  method: 'GET',
120
- path: path,
120
+ path: api_path,
121
121
  headers: headers,
122
122
  params: params,
123
123
  )
@@ -142,7 +142,7 @@ module Appwrite
142
142
  #
143
143
  # @return []
144
144
  def get_flag(code:, width: nil, height: nil, quality: nil)
145
- path = '/avatars/flags/{code}'
145
+ api_path = '/avatars/flags/{code}'
146
146
  .gsub('{code}', code)
147
147
 
148
148
  if code.nil?
@@ -161,7 +161,7 @@ module Appwrite
161
161
 
162
162
  @client.call(
163
163
  method: 'GET',
164
- path: path,
164
+ path: api_path,
165
165
  headers: headers,
166
166
  params: params,
167
167
  )
@@ -185,7 +185,7 @@ module Appwrite
185
185
  #
186
186
  # @return []
187
187
  def get_image(url:, width: nil, height: nil)
188
- path = '/avatars/image'
188
+ api_path = '/avatars/image'
189
189
 
190
190
  if url.nil?
191
191
  raise Appwrite::Exception.new('Missing required parameter: "url"')
@@ -203,7 +203,7 @@ module Appwrite
203
203
 
204
204
  @client.call(
205
205
  method: 'GET',
206
- path: path,
206
+ path: api_path,
207
207
  headers: headers,
208
208
  params: params,
209
209
  )
@@ -234,7 +234,7 @@ module Appwrite
234
234
  #
235
235
  # @return []
236
236
  def get_initials(name: nil, width: nil, height: nil, background: nil)
237
- path = '/avatars/initials'
237
+ api_path = '/avatars/initials'
238
238
 
239
239
  params = {
240
240
  name: name,
@@ -249,7 +249,7 @@ module Appwrite
249
249
 
250
250
  @client.call(
251
251
  method: 'GET',
252
- path: path,
252
+ path: api_path,
253
253
  headers: headers,
254
254
  params: params,
255
255
  )
@@ -267,7 +267,7 @@ module Appwrite
267
267
  #
268
268
  # @return []
269
269
  def get_qr(text:, size: nil, margin: nil, download: nil)
270
- path = '/avatars/qr'
270
+ api_path = '/avatars/qr'
271
271
 
272
272
  if text.nil?
273
273
  raise Appwrite::Exception.new('Missing required parameter: "text"')
@@ -286,7 +286,7 @@ module Appwrite
286
286
 
287
287
  @client.call(
288
288
  method: 'GET',
289
- path: path,
289
+ path: api_path,
290
290
  headers: headers,
291
291
  params: params,
292
292
  )