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