appwrite 6.0.0 → 7.0.0.pre.RC1

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 +5 -2
  3. data/lib/appwrite/id.rb +11 -0
  4. data/lib/appwrite/models/account.rb +82 -0
  5. data/lib/appwrite/models/algo_argon2.rb +37 -0
  6. data/lib/appwrite/models/algo_bcrypt.rb +22 -0
  7. data/lib/appwrite/models/algo_md5.rb +22 -0
  8. data/lib/appwrite/models/algo_phpass.rb +22 -0
  9. data/lib/appwrite/models/algo_scrypt.rb +42 -0
  10. data/lib/appwrite/models/algo_scrypt_modified.rb +37 -0
  11. data/lib/appwrite/models/algo_sha.rb +22 -0
  12. data/lib/appwrite/models/attribute_datetime.rb +57 -0
  13. data/lib/appwrite/models/bucket.rb +15 -15
  14. data/lib/appwrite/models/collection.rb +10 -15
  15. data/lib/appwrite/models/database.rb +13 -3
  16. data/lib/appwrite/models/document.rb +5 -10
  17. data/lib/appwrite/models/execution.rb +10 -5
  18. data/lib/appwrite/models/file.rb +5 -10
  19. data/lib/appwrite/models/function.rb +2 -2
  20. data/lib/appwrite/models/index.rb +1 -1
  21. data/lib/appwrite/models/user.rb +15 -0
  22. data/lib/appwrite/models/variable.rb +52 -0
  23. data/lib/appwrite/models/variable_list.rb +32 -0
  24. data/lib/appwrite/permission.rb +21 -0
  25. data/lib/appwrite/query.rb +43 -14
  26. data/lib/appwrite/role.rb +31 -0
  27. data/lib/appwrite/services/account.rb +184 -143
  28. data/lib/appwrite/services/avatars.rb +72 -56
  29. data/lib/appwrite/services/databases.rb +638 -552
  30. data/lib/appwrite/services/functions.rb +380 -176
  31. data/lib/appwrite/services/health.rb +33 -10
  32. data/lib/appwrite/services/locale.rb +24 -7
  33. data/lib/appwrite/services/storage.rb +194 -193
  34. data/lib/appwrite/services/teams.rb +137 -128
  35. data/lib/appwrite/services/users.rb +572 -163
  36. data/lib/appwrite.rb +15 -0
  37. metadata +18 -4
@@ -3,17 +3,21 @@
3
3
  module Appwrite
4
4
  class Account < Service
5
5
 
6
+ def initialize(client)
7
+ @client = client
8
+ end
6
9
 
7
10
  # Get currently logged in user data as JSON object.
8
11
  #
9
12
  #
10
- # @return [User]
13
+ # @return [Account]
11
14
  def get()
15
+
12
16
  path = '/account'
13
17
 
14
18
  params = {
15
19
  }
16
-
20
+
17
21
  headers = {
18
22
  "content-type": 'application/json',
19
23
  }
@@ -23,10 +27,11 @@ module Appwrite
23
27
  path: path,
24
28
  headers: headers,
25
29
  params: params,
26
- response_type: Models::User
30
+ response_type: Models::Account
27
31
  )
28
32
  end
29
33
 
34
+
30
35
  # Update currently logged in user account email address. After changing user
31
36
  # address, the user confirmation status will get reset. A new confirmation
32
37
  # email is not sent automatically however you can use the send confirmation
@@ -36,18 +41,11 @@ module Appwrite
36
41
  # one, by passing an email address and a new password.
37
42
  #
38
43
  #
39
- # @param [string] email User email.
40
- # @param [string] password User password. Must be at least 8 chars.
44
+ # @param [String] email User email.
45
+ # @param [String] password User password. Must be at least 8 chars.
41
46
  #
42
- # @return [User]
47
+ # @return [Account]
43
48
  def update_email(email:, password:)
44
- if email.nil?
45
- raise Appwrite::Exception.new('Missing required parameter: "email"')
46
- end
47
-
48
- if password.nil?
49
- raise Appwrite::Exception.new('Missing required parameter: "password"')
50
- end
51
49
 
52
50
  path = '/account/email'
53
51
 
@@ -55,35 +53,43 @@ module Appwrite
55
53
  email: email,
56
54
  password: password,
57
55
  }
58
-
56
+
59
57
  headers = {
60
58
  "content-type": 'application/json',
61
59
  }
60
+ if email.nil?
61
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
62
+ end
63
+
64
+ if password.nil?
65
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
66
+ end
67
+
62
68
 
63
69
  @client.call(
64
70
  method: 'PATCH',
65
71
  path: path,
66
72
  headers: headers,
67
73
  params: params,
68
- response_type: Models::User
74
+ response_type: Models::Account
69
75
  )
70
76
  end
71
77
 
78
+
72
79
  # Get currently logged in user list of latest security activity logs. Each
73
80
  # log returns user IP address, location and date and time of log.
74
81
  #
75
- # @param [number] limit Maximum number of logs to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
76
- # @param [number] offset Offset value. The default value is 0. Use this value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
82
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Only supported methods are limit and offset
77
83
  #
78
84
  # @return [LogList]
79
- def get_logs(limit: nil, offset: nil)
85
+ def get_logs(queries: nil)
86
+
80
87
  path = '/account/logs'
81
88
 
82
89
  params = {
83
- limit: limit,
84
- offset: offset,
90
+ queries: queries,
85
91
  }
86
-
92
+
87
93
  headers = {
88
94
  "content-type": 'application/json',
89
95
  }
@@ -97,47 +103,47 @@ module Appwrite
97
103
  )
98
104
  end
99
105
 
106
+
100
107
  # Update currently logged in user account name.
101
108
  #
102
- # @param [string] name User name. Max length: 128 chars.
109
+ # @param [String] name User name. Max length: 128 chars.
103
110
  #
104
- # @return [User]
111
+ # @return [Account]
105
112
  def update_name(name:)
106
- if name.nil?
107
- raise Appwrite::Exception.new('Missing required parameter: "name"')
108
- end
109
113
 
110
114
  path = '/account/name'
111
115
 
112
116
  params = {
113
117
  name: name,
114
118
  }
115
-
119
+
116
120
  headers = {
117
121
  "content-type": 'application/json',
118
122
  }
123
+ if name.nil?
124
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
125
+ end
126
+
119
127
 
120
128
  @client.call(
121
129
  method: 'PATCH',
122
130
  path: path,
123
131
  headers: headers,
124
132
  params: params,
125
- response_type: Models::User
133
+ response_type: Models::Account
126
134
  )
127
135
  end
128
136
 
137
+
129
138
  # Update currently logged in user password. For validation, user is required
130
139
  # to pass in the new password, and the old password. For users created with
131
140
  # OAuth, Team Invites and Magic URL, oldPassword is optional.
132
141
  #
133
- # @param [string] password New user password. Must be at least 8 chars.
134
- # @param [string] old_password Current user password. Must be at least 8 chars.
142
+ # @param [String] password New user password. Must be at least 8 chars.
143
+ # @param [String] old_password Current user password. Must be at least 8 chars.
135
144
  #
136
- # @return [User]
145
+ # @return [Account]
137
146
  def update_password(password:, old_password: nil)
138
- if password.nil?
139
- raise Appwrite::Exception.new('Missing required parameter: "password"')
140
- end
141
147
 
142
148
  path = '/account/password'
143
149
 
@@ -145,68 +151,77 @@ module Appwrite
145
151
  password: password,
146
152
  oldPassword: old_password,
147
153
  }
148
-
154
+
149
155
  headers = {
150
156
  "content-type": 'application/json',
151
157
  }
158
+ if password.nil?
159
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
160
+ end
161
+
152
162
 
153
163
  @client.call(
154
164
  method: 'PATCH',
155
165
  path: path,
156
166
  headers: headers,
157
167
  params: params,
158
- response_type: Models::User
168
+ response_type: Models::Account
159
169
  )
160
170
  end
161
171
 
162
- # Update currently logged in user account phone number. After changing phone
163
- # number, the user confirmation status will get reset. A new confirmation SMS
164
- # is not sent automatically however you can use the phone confirmation
165
- # endpoint again to send the confirmation SMS.
172
+
173
+ # Update the currently logged in user's phone number. After updating the
174
+ # phone number, the phone verification status will be reset. A confirmation
175
+ # SMS is not sent automatically, however you can use the [POST
176
+ # /account/verification/phone](/docs/client/account#accountCreatePhoneVerification)
177
+ # endpoint to send a confirmation SMS.
166
178
  #
167
- # @param [string] number Phone number. Format this number with a leading &#039;+&#039; and a country code, e.g., +16175551212.
168
- # @param [string] password User password. Must be at least 8 chars.
179
+ # @param [String] phone Phone number. Format this number with a leading &#039;+&#039; and a country code, e.g., +16175551212.
180
+ # @param [String] password User password. Must be at least 8 chars.
169
181
  #
170
- # @return [User]
171
- def update_phone(number:, password:)
172
- if number.nil?
173
- raise Appwrite::Exception.new('Missing required parameter: "number"')
174
- end
175
-
176
- if password.nil?
177
- raise Appwrite::Exception.new('Missing required parameter: "password"')
178
- end
182
+ # @return [Account]
183
+ def update_phone(phone:, password:)
179
184
 
180
185
  path = '/account/phone'
181
186
 
182
187
  params = {
183
- number: number,
188
+ phone: phone,
184
189
  password: password,
185
190
  }
186
-
191
+
187
192
  headers = {
188
193
  "content-type": 'application/json',
189
194
  }
195
+ if phone.nil?
196
+ raise Appwrite::Exception.new('Missing required parameter: "phone"')
197
+ end
198
+
199
+ if password.nil?
200
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
201
+ end
202
+
190
203
 
191
204
  @client.call(
192
205
  method: 'PATCH',
193
206
  path: path,
194
207
  headers: headers,
195
208
  params: params,
196
- response_type: Models::User
209
+ response_type: Models::Account
197
210
  )
198
211
  end
199
212
 
213
+
200
214
  # Get currently logged in user preferences as a key-value object.
201
215
  #
202
216
  #
203
217
  # @return [Preferences]
204
218
  def get_prefs()
219
+
205
220
  path = '/account/prefs'
206
221
 
207
222
  params = {
208
223
  }
209
-
224
+
210
225
  headers = {
211
226
  "content-type": 'application/json',
212
227
  }
@@ -220,37 +235,40 @@ module Appwrite
220
235
  )
221
236
  end
222
237
 
238
+
223
239
  # Update currently logged in user account preferences. The object you pass is
224
240
  # stored as is, and replaces any previous value. The maximum allowed prefs
225
241
  # size is 64kB and throws error if exceeded.
226
242
  #
227
- # @param [object] prefs Prefs key-value JSON object.
243
+ # @param [Hash] prefs Prefs key-value JSON object.
228
244
  #
229
- # @return [User]
245
+ # @return [Account]
230
246
  def update_prefs(prefs:)
231
- if prefs.nil?
232
- raise Appwrite::Exception.new('Missing required parameter: "prefs"')
233
- end
234
247
 
235
248
  path = '/account/prefs'
236
249
 
237
250
  params = {
238
251
  prefs: prefs,
239
252
  }
240
-
253
+
241
254
  headers = {
242
255
  "content-type": 'application/json',
243
256
  }
257
+ if prefs.nil?
258
+ raise Appwrite::Exception.new('Missing required parameter: "prefs"')
259
+ end
260
+
244
261
 
245
262
  @client.call(
246
263
  method: 'PATCH',
247
264
  path: path,
248
265
  headers: headers,
249
266
  params: params,
250
- response_type: Models::User
267
+ response_type: Models::Account
251
268
  )
252
269
  end
253
270
 
271
+
254
272
  # Sends the user an email with a temporary secret key for password reset.
255
273
  # When the user clicks the confirmation link he is redirected back to your
256
274
  # app password reset URL with the secret key and email address values
@@ -260,18 +278,11 @@ module Appwrite
260
278
  # complete the process. The verification link sent to the user's email
261
279
  # address is valid for 1 hour.
262
280
  #
263
- # @param [string] email User email.
264
- # @param [string] url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
281
+ # @param [String] email User email.
282
+ # @param [String] url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
265
283
  #
266
284
  # @return [Token]
267
285
  def create_recovery(email:, url:)
268
- if email.nil?
269
- raise Appwrite::Exception.new('Missing required parameter: "email"')
270
- end
271
-
272
- if url.nil?
273
- raise Appwrite::Exception.new('Missing required parameter: "url"')
274
- end
275
286
 
276
287
  path = '/account/recovery'
277
288
 
@@ -279,10 +290,18 @@ module Appwrite
279
290
  email: email,
280
291
  url: url,
281
292
  }
282
-
293
+
283
294
  headers = {
284
295
  "content-type": 'application/json',
285
296
  }
297
+ if email.nil?
298
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
299
+ end
300
+
301
+ if url.nil?
302
+ raise Appwrite::Exception.new('Missing required parameter: "url"')
303
+ end
304
+
286
305
 
287
306
  @client.call(
288
307
  method: 'POST',
@@ -293,6 +312,7 @@ module Appwrite
293
312
  )
294
313
  end
295
314
 
315
+
296
316
  # Use this endpoint to complete the user account password reset. Both the
297
317
  # **userId** and **secret** arguments will be passed as query parameters to
298
318
  # the redirect URL you have provided when sending your request to the [POST
@@ -303,13 +323,26 @@ module Appwrite
303
323
  # the only valid redirect URLs are the ones from domains you have set when
304
324
  # adding your platforms in the console interface.
305
325
  #
306
- # @param [string] user_id User ID.
307
- # @param [string] secret Valid reset token.
308
- # @param [string] password New user password. Must be at least 8 chars.
309
- # @param [string] password_again Repeat new user password. Must be at least 8 chars.
326
+ # @param [String] user_id User ID.
327
+ # @param [String] secret Valid reset token.
328
+ # @param [String] password New user password. Must be at least 8 chars.
329
+ # @param [String] password_again Repeat new user password. Must be at least 8 chars.
310
330
  #
311
331
  # @return [Token]
312
332
  def update_recovery(user_id:, secret:, password:, password_again:)
333
+
334
+ path = '/account/recovery'
335
+
336
+ params = {
337
+ userId: user_id,
338
+ secret: secret,
339
+ password: password,
340
+ passwordAgain: password_again,
341
+ }
342
+
343
+ headers = {
344
+ "content-type": 'application/json',
345
+ }
313
346
  if user_id.nil?
314
347
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
315
348
  end
@@ -326,18 +359,6 @@ module Appwrite
326
359
  raise Appwrite::Exception.new('Missing required parameter: "passwordAgain"')
327
360
  end
328
361
 
329
- path = '/account/recovery'
330
-
331
- params = {
332
- userId: user_id,
333
- secret: secret,
334
- password: password,
335
- passwordAgain: password_again,
336
- }
337
-
338
- headers = {
339
- "content-type": 'application/json',
340
- }
341
362
 
342
363
  @client.call(
343
364
  method: 'PUT',
@@ -348,17 +369,19 @@ module Appwrite
348
369
  )
349
370
  end
350
371
 
372
+
351
373
  # Get currently logged in user list of active sessions across different
352
374
  # devices.
353
375
  #
354
376
  #
355
377
  # @return [SessionList]
356
378
  def get_sessions()
379
+
357
380
  path = '/account/sessions'
358
381
 
359
382
  params = {
360
383
  }
361
-
384
+
362
385
  headers = {
363
386
  "content-type": 'application/json',
364
387
  }
@@ -372,17 +395,19 @@ module Appwrite
372
395
  )
373
396
  end
374
397
 
398
+
375
399
  # Delete all sessions from the user account and remove any sessions cookies
376
400
  # from the end client.
377
401
  #
378
402
  #
379
403
  # @return []
380
404
  def delete_sessions()
405
+
381
406
  path = '/account/sessions'
382
407
 
383
408
  params = {
384
409
  }
385
-
410
+
386
411
  headers = {
387
412
  "content-type": 'application/json',
388
413
  }
@@ -395,26 +420,28 @@ module Appwrite
395
420
  )
396
421
  end
397
422
 
423
+
398
424
  # Use this endpoint to get a logged in user's session using a Session ID.
399
425
  # Inputting 'current' will return the current session being used.
400
426
  #
401
- # @param [string] session_id Session ID. Use the string &#039;current&#039; to get the current device session.
427
+ # @param [String] session_id Session ID. Use the string &#039;current&#039; to get the current device session.
402
428
  #
403
429
  # @return [Session]
404
430
  def get_session(session_id:)
405
- if session_id.nil?
406
- raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
407
- end
408
431
 
409
432
  path = '/account/sessions/{sessionId}'
410
- .gsub('{sessionId}', session_id)
411
433
 
412
434
  params = {
413
435
  }
414
-
436
+
415
437
  headers = {
416
438
  "content-type": 'application/json',
417
439
  }
440
+ if session_id.nil?
441
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
442
+ end
443
+
444
+ .gsub('{sessionId}', session_id)
418
445
 
419
446
  @client.call(
420
447
  method: 'GET',
@@ -425,27 +452,29 @@ module Appwrite
425
452
  )
426
453
  end
427
454
 
455
+
428
456
  # Access tokens have limited lifespan and expire to mitigate security risks.
429
457
  # If session was created using an OAuth provider, this route can be used to
430
458
  # "refresh" the access token.
431
459
  #
432
- # @param [string] session_id Session ID. Use the string &#039;current&#039; to update the current device session.
460
+ # @param [String] session_id Session ID. Use the string &#039;current&#039; to update the current device session.
433
461
  #
434
462
  # @return [Session]
435
463
  def update_session(session_id:)
436
- if session_id.nil?
437
- raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
438
- end
439
464
 
440
465
  path = '/account/sessions/{sessionId}'
441
- .gsub('{sessionId}', session_id)
442
466
 
443
467
  params = {
444
468
  }
445
-
469
+
446
470
  headers = {
447
471
  "content-type": 'application/json',
448
472
  }
473
+ if session_id.nil?
474
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
475
+ end
476
+
477
+ .gsub('{sessionId}', session_id)
449
478
 
450
479
  @client.call(
451
480
  method: 'PATCH',
@@ -456,28 +485,30 @@ module Appwrite
456
485
  )
457
486
  end
458
487
 
488
+
459
489
  # Use this endpoint to log out the currently logged in user from all their
460
490
  # account sessions across all of their different devices. When using the
461
491
  # Session ID argument, only the unique session ID provided is deleted.
462
492
  #
463
493
  #
464
- # @param [string] session_id Session ID. Use the string &#039;current&#039; to delete the current device session.
494
+ # @param [String] session_id Session ID. Use the string &#039;current&#039; to delete the current device session.
465
495
  #
466
496
  # @return []
467
497
  def delete_session(session_id:)
468
- if session_id.nil?
469
- raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
470
- end
471
498
 
472
499
  path = '/account/sessions/{sessionId}'
473
- .gsub('{sessionId}', session_id)
474
500
 
475
501
  params = {
476
502
  }
477
-
503
+
478
504
  headers = {
479
505
  "content-type": 'application/json',
480
506
  }
507
+ if session_id.nil?
508
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
509
+ end
510
+
511
+ .gsub('{sessionId}', session_id)
481
512
 
482
513
  @client.call(
483
514
  method: 'DELETE',
@@ -487,18 +518,20 @@ module Appwrite
487
518
  )
488
519
  end
489
520
 
521
+
490
522
  # Block the currently logged in user account. Behind the scene, the user
491
523
  # record is not deleted but permanently blocked from any access. To
492
524
  # completely delete a user, use the Users API instead.
493
525
  #
494
526
  #
495
- # @return [User]
527
+ # @return [Account]
496
528
  def update_status()
529
+
497
530
  path = '/account/status'
498
531
 
499
532
  params = {
500
533
  }
501
-
534
+
502
535
  headers = {
503
536
  "content-type": 'application/json',
504
537
  }
@@ -508,10 +541,11 @@ module Appwrite
508
541
  path: path,
509
542
  headers: headers,
510
543
  params: params,
511
- response_type: Models::User
544
+ response_type: Models::Account
512
545
  )
513
546
  end
514
547
 
548
+
515
549
  # Use this endpoint to send a verification message to your user email address
516
550
  # to confirm they are the valid owners of that address. Both the **userId**
517
551
  # and **secret** arguments will be passed as query parameters to the URL you
@@ -528,23 +562,24 @@ module Appwrite
528
562
  # adding your platforms in the console interface.
529
563
  #
530
564
  #
531
- # @param [string] url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
565
+ # @param [String] url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
532
566
  #
533
567
  # @return [Token]
534
568
  def create_verification(url:)
535
- if url.nil?
536
- raise Appwrite::Exception.new('Missing required parameter: "url"')
537
- end
538
569
 
539
570
  path = '/account/verification'
540
571
 
541
572
  params = {
542
573
  url: url,
543
574
  }
544
-
575
+
545
576
  headers = {
546
577
  "content-type": 'application/json',
547
578
  }
579
+ if url.nil?
580
+ raise Appwrite::Exception.new('Missing required parameter: "url"')
581
+ end
582
+
548
583
 
549
584
  @client.call(
550
585
  method: 'POST',
@@ -555,23 +590,17 @@ module Appwrite
555
590
  )
556
591
  end
557
592
 
593
+
558
594
  # Use this endpoint to complete the user email verification process. Use both
559
595
  # the **userId** and **secret** parameters that were attached to your app URL
560
596
  # to verify the user email ownership. If confirmed this route will return a
561
597
  # 200 status code.
562
598
  #
563
- # @param [string] user_id User ID.
564
- # @param [string] secret Valid verification token.
599
+ # @param [String] user_id User ID.
600
+ # @param [String] secret Valid verification token.
565
601
  #
566
602
  # @return [Token]
567
603
  def update_verification(user_id:, secret:)
568
- if user_id.nil?
569
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
570
- end
571
-
572
- if secret.nil?
573
- raise Appwrite::Exception.new('Missing required parameter: "secret"')
574
- end
575
604
 
576
605
  path = '/account/verification'
577
606
 
@@ -579,10 +608,18 @@ module Appwrite
579
608
  userId: user_id,
580
609
  secret: secret,
581
610
  }
582
-
611
+
583
612
  headers = {
584
613
  "content-type": 'application/json',
585
614
  }
615
+ if user_id.nil?
616
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
617
+ end
618
+
619
+ if secret.nil?
620
+ raise Appwrite::Exception.new('Missing required parameter: "secret"')
621
+ end
622
+
586
623
 
587
624
  @client.call(
588
625
  method: 'PUT',
@@ -593,22 +630,23 @@ module Appwrite
593
630
  )
594
631
  end
595
632
 
596
- # Use this endpoint to send a verification message to your user's phone
597
- # number to confirm they are the valid owners of that address. The provided
598
- # secret should allow you to complete the verification process by verifying
599
- # both the **userId** and **secret** parameters. Learn more about how to
600
- # [complete the verification
633
+
634
+ # Use this endpoint to send a verification SMS to the currently logged in
635
+ # user. This endpoint is meant for use after updating a user's phone number
636
+ # using the [accountUpdatePhone](/docs/client/account#accountUpdatePhone)
637
+ # endpoint. Learn more about how to [complete the verification
601
638
  # process](/docs/client/account#accountUpdatePhoneVerification). The
602
- # verification link sent to the user's phone number is valid for 15 minutes.
639
+ # verification code sent to the user's phone number is valid for 15 minutes.
603
640
  #
604
641
  #
605
642
  # @return [Token]
606
643
  def create_phone_verification()
644
+
607
645
  path = '/account/verification/phone'
608
646
 
609
647
  params = {
610
648
  }
611
-
649
+
612
650
  headers = {
613
651
  "content-type": 'application/json',
614
652
  }
@@ -622,23 +660,17 @@ module Appwrite
622
660
  )
623
661
  end
624
662
 
663
+
625
664
  # Use this endpoint to complete the user phone verification process. Use the
626
665
  # **userId** and **secret** that were sent to your user's phone number to
627
666
  # verify the user email ownership. If confirmed this route will return a 200
628
667
  # status code.
629
668
  #
630
- # @param [string] user_id User ID.
631
- # @param [string] secret Valid verification token.
669
+ # @param [String] user_id User ID.
670
+ # @param [String] secret Valid verification token.
632
671
  #
633
672
  # @return [Token]
634
673
  def update_phone_verification(user_id:, secret:)
635
- if user_id.nil?
636
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
637
- end
638
-
639
- if secret.nil?
640
- raise Appwrite::Exception.new('Missing required parameter: "secret"')
641
- end
642
674
 
643
675
  path = '/account/verification/phone'
644
676
 
@@ -646,10 +678,18 @@ module Appwrite
646
678
  userId: user_id,
647
679
  secret: secret,
648
680
  }
649
-
681
+
650
682
  headers = {
651
683
  "content-type": 'application/json',
652
684
  }
685
+ if user_id.nil?
686
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
687
+ end
688
+
689
+ if secret.nil?
690
+ raise Appwrite::Exception.new('Missing required parameter: "secret"')
691
+ end
692
+
653
693
 
654
694
  @client.call(
655
695
  method: 'PUT',
@@ -660,5 +700,6 @@ module Appwrite
660
700
  )
661
701
  end
662
702
 
703
+
663
704
  end
664
705
  end