appwrite 5.0.0 → 7.0.0.pre.RC2
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.
- 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 +10 -0
- 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 +250 -103
- data/lib/appwrite/services/avatars.rb +73 -56
- data/lib/appwrite/services/databases.rb +1425 -0
- data/lib/appwrite/services/functions.rb +381 -176
- data/lib/appwrite/services/health.rb +34 -10
- 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 +610 -130
- data/lib/appwrite.rb +19 -2
- metadata +22 -6
- data/lib/appwrite/file.rb +0 -17
- data/lib/appwrite/services/database.rb +0 -1047
@@ -3,29 +3,26 @@
|
|
3
3
|
module Appwrite
|
4
4
|
class Users < Service
|
5
5
|
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
6
10
|
# Get a list of all the project's users. You can use the query params to
|
7
11
|
# filter your results.
|
8
12
|
#
|
9
|
-
# @param [
|
10
|
-
# @param [
|
11
|
-
# @param [number] offset Offset value. The default value is 0. Use this param to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
|
12
|
-
# @param [string] cursor ID of the user used as the starting point for the query, excluding the user itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
|
13
|
-
# @param [string] cursor_direction Direction of the cursor.
|
14
|
-
# @param [string] order_type Order result by ASC or DESC order.
|
13
|
+
# @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). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, email, phone, status, passwordUpdate, registration, emailVerification, phoneVerification
|
14
|
+
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
15
15
|
#
|
16
16
|
# @return [UserList]
|
17
|
-
def list(
|
17
|
+
def list(queries: nil, search: nil)
|
18
|
+
|
18
19
|
path = '/users'
|
19
20
|
|
20
21
|
params = {
|
22
|
+
queries: queries,
|
21
23
|
search: search,
|
22
|
-
limit: limit,
|
23
|
-
offset: offset,
|
24
|
-
cursor: cursor,
|
25
|
-
cursorDirection: cursor_direction,
|
26
|
-
orderType: order_type,
|
27
24
|
}
|
28
|
-
|
25
|
+
|
29
26
|
headers = {
|
30
27
|
"content-type": 'application/json',
|
31
28
|
}
|
@@ -39,15 +36,71 @@ module Appwrite
|
|
39
36
|
)
|
40
37
|
end
|
41
38
|
|
39
|
+
|
42
40
|
# Create a new user.
|
43
41
|
#
|
44
|
-
# @param [
|
45
|
-
# @param [
|
46
|
-
# @param [
|
47
|
-
# @param [
|
42
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
43
|
+
# @param [String] email User email.
|
44
|
+
# @param [String] phone Phone number. Format this number with a leading '+' and a country code, e.g., +16175551212.
|
45
|
+
# @param [String] password Plain text user password. Must be at least 8 chars.
|
46
|
+
# @param [String] name User name. Max length: 128 chars.
|
48
47
|
#
|
49
48
|
# @return [User]
|
50
|
-
def create(user_id:, email
|
49
|
+
def create(user_id:, email: nil, phone: nil, password: nil, name: nil)
|
50
|
+
|
51
|
+
path = '/users'
|
52
|
+
|
53
|
+
params = {
|
54
|
+
userId: user_id,
|
55
|
+
email: email,
|
56
|
+
phone: phone,
|
57
|
+
password: password,
|
58
|
+
name: name,
|
59
|
+
}
|
60
|
+
|
61
|
+
headers = {
|
62
|
+
"content-type": 'application/json',
|
63
|
+
}
|
64
|
+
if user_id.nil?
|
65
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
@client.call(
|
70
|
+
method: 'POST',
|
71
|
+
path: path,
|
72
|
+
headers: headers,
|
73
|
+
params: params,
|
74
|
+
response_type: Models::User
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
# Create a new user. Password provided must be hashed with the
|
80
|
+
# [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST
|
81
|
+
# /users](/docs/server/users#usersCreate) endpoint to create users with a
|
82
|
+
# plain text password.
|
83
|
+
#
|
84
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
85
|
+
# @param [String] email User email.
|
86
|
+
# @param [String] password User password hashed using Argon2.
|
87
|
+
# @param [String] name User name. Max length: 128 chars.
|
88
|
+
#
|
89
|
+
# @return [User]
|
90
|
+
def create_argon2_user(user_id:, email:, password:, name: nil)
|
91
|
+
|
92
|
+
path = '/users/argon2'
|
93
|
+
|
94
|
+
params = {
|
95
|
+
userId: user_id,
|
96
|
+
email: email,
|
97
|
+
password: password,
|
98
|
+
name: name,
|
99
|
+
}
|
100
|
+
|
101
|
+
headers = {
|
102
|
+
"content-type": 'application/json',
|
103
|
+
}
|
51
104
|
if user_id.nil?
|
52
105
|
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
53
106
|
end
|
@@ -60,7 +113,31 @@ module Appwrite
|
|
60
113
|
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
61
114
|
end
|
62
115
|
|
63
|
-
|
116
|
+
|
117
|
+
@client.call(
|
118
|
+
method: 'POST',
|
119
|
+
path: path,
|
120
|
+
headers: headers,
|
121
|
+
params: params,
|
122
|
+
response_type: Models::User
|
123
|
+
)
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
# Create a new user. Password provided must be hashed with the
|
128
|
+
# [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST
|
129
|
+
# /users](/docs/server/users#usersCreate) endpoint to create users with a
|
130
|
+
# plain text password.
|
131
|
+
#
|
132
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
133
|
+
# @param [String] email User email.
|
134
|
+
# @param [String] password User password hashed using Bcrypt.
|
135
|
+
# @param [String] name User name. Max length: 128 chars.
|
136
|
+
#
|
137
|
+
# @return [User]
|
138
|
+
def create_bcrypt_user(user_id:, email:, password:, name: nil)
|
139
|
+
|
140
|
+
path = '/users/bcrypt'
|
64
141
|
|
65
142
|
params = {
|
66
143
|
userId: user_id,
|
@@ -68,10 +145,70 @@ module Appwrite
|
|
68
145
|
password: password,
|
69
146
|
name: name,
|
70
147
|
}
|
148
|
+
|
149
|
+
headers = {
|
150
|
+
"content-type": 'application/json',
|
151
|
+
}
|
152
|
+
if user_id.nil?
|
153
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
154
|
+
end
|
155
|
+
|
156
|
+
if email.nil?
|
157
|
+
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
158
|
+
end
|
71
159
|
|
160
|
+
if password.nil?
|
161
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
162
|
+
end
|
163
|
+
|
164
|
+
|
165
|
+
@client.call(
|
166
|
+
method: 'POST',
|
167
|
+
path: path,
|
168
|
+
headers: headers,
|
169
|
+
params: params,
|
170
|
+
response_type: Models::User
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
# Create a new user. Password provided must be hashed with the
|
176
|
+
# [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST
|
177
|
+
# /users](/docs/server/users#usersCreate) endpoint to create users with a
|
178
|
+
# plain text password.
|
179
|
+
#
|
180
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
181
|
+
# @param [String] email User email.
|
182
|
+
# @param [String] password User password hashed using MD5.
|
183
|
+
# @param [String] name User name. Max length: 128 chars.
|
184
|
+
#
|
185
|
+
# @return [User]
|
186
|
+
def create_md5_user(user_id:, email:, password:, name: nil)
|
187
|
+
|
188
|
+
path = '/users/md5'
|
189
|
+
|
190
|
+
params = {
|
191
|
+
userId: user_id,
|
192
|
+
email: email,
|
193
|
+
password: password,
|
194
|
+
name: name,
|
195
|
+
}
|
196
|
+
|
72
197
|
headers = {
|
73
198
|
"content-type": 'application/json',
|
74
199
|
}
|
200
|
+
if user_id.nil?
|
201
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
202
|
+
end
|
203
|
+
|
204
|
+
if email.nil?
|
205
|
+
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
206
|
+
end
|
207
|
+
|
208
|
+
if password.nil?
|
209
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
210
|
+
end
|
211
|
+
|
75
212
|
|
76
213
|
@client.call(
|
77
214
|
method: 'POST',
|
@@ -82,25 +219,269 @@ module Appwrite
|
|
82
219
|
)
|
83
220
|
end
|
84
221
|
|
85
|
-
|
222
|
+
|
223
|
+
# Create a new user. Password provided must be hashed with the
|
224
|
+
# [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST
|
225
|
+
# /users](/docs/server/users#usersCreate) endpoint to create users with a
|
226
|
+
# plain text password.
|
86
227
|
#
|
87
|
-
# @param [
|
228
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
229
|
+
# @param [String] email User email.
|
230
|
+
# @param [String] password User password hashed using PHPass.
|
231
|
+
# @param [String] name User name. Max length: 128 chars.
|
88
232
|
#
|
89
233
|
# @return [User]
|
90
|
-
def
|
234
|
+
def create_ph_pass_user(user_id:, email:, password:, name: nil)
|
235
|
+
|
236
|
+
path = '/users/phpass'
|
237
|
+
|
238
|
+
params = {
|
239
|
+
userId: user_id,
|
240
|
+
email: email,
|
241
|
+
password: password,
|
242
|
+
name: name,
|
243
|
+
}
|
244
|
+
|
245
|
+
headers = {
|
246
|
+
"content-type": 'application/json',
|
247
|
+
}
|
91
248
|
if user_id.nil?
|
92
249
|
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
93
250
|
end
|
94
251
|
|
95
|
-
|
96
|
-
.
|
252
|
+
if email.nil?
|
253
|
+
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
254
|
+
end
|
255
|
+
|
256
|
+
if password.nil?
|
257
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
258
|
+
end
|
259
|
+
|
260
|
+
|
261
|
+
@client.call(
|
262
|
+
method: 'POST',
|
263
|
+
path: path,
|
264
|
+
headers: headers,
|
265
|
+
params: params,
|
266
|
+
response_type: Models::User
|
267
|
+
)
|
268
|
+
end
|
269
|
+
|
270
|
+
|
271
|
+
# Create a new user. Password provided must be hashed with the
|
272
|
+
# [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST
|
273
|
+
# /users](/docs/server/users#usersCreate) endpoint to create users with a
|
274
|
+
# plain text password.
|
275
|
+
#
|
276
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
277
|
+
# @param [String] email User email.
|
278
|
+
# @param [String] password User password hashed using Scrypt.
|
279
|
+
# @param [String] password_salt Optional salt used to hash password.
|
280
|
+
# @param [Integer] password_cpu Optional CPU cost used to hash password.
|
281
|
+
# @param [Integer] password_memory Optional memory cost used to hash password.
|
282
|
+
# @param [Integer] password_parallel Optional parallelization cost used to hash password.
|
283
|
+
# @param [Integer] password_length Optional hash length used to hash password.
|
284
|
+
# @param [String] name User name. Max length: 128 chars.
|
285
|
+
#
|
286
|
+
# @return [User]
|
287
|
+
def create_scrypt_user(user_id:, email:, password:, password_salt:, password_cpu:, password_memory:, password_parallel:, password_length:, name: nil)
|
288
|
+
|
289
|
+
path = '/users/scrypt'
|
97
290
|
|
98
291
|
params = {
|
292
|
+
userId: user_id,
|
293
|
+
email: email,
|
294
|
+
password: password,
|
295
|
+
passwordSalt: password_salt,
|
296
|
+
passwordCpu: password_cpu,
|
297
|
+
passwordMemory: password_memory,
|
298
|
+
passwordParallel: password_parallel,
|
299
|
+
passwordLength: password_length,
|
300
|
+
name: name,
|
99
301
|
}
|
302
|
+
|
303
|
+
headers = {
|
304
|
+
"content-type": 'application/json',
|
305
|
+
}
|
306
|
+
if user_id.nil?
|
307
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
308
|
+
end
|
309
|
+
|
310
|
+
if email.nil?
|
311
|
+
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
312
|
+
end
|
313
|
+
|
314
|
+
if password.nil?
|
315
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
316
|
+
end
|
317
|
+
|
318
|
+
if password_salt.nil?
|
319
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"')
|
320
|
+
end
|
321
|
+
|
322
|
+
if password_cpu.nil?
|
323
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordCpu"')
|
324
|
+
end
|
325
|
+
|
326
|
+
if password_memory.nil?
|
327
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordMemory"')
|
328
|
+
end
|
329
|
+
|
330
|
+
if password_parallel.nil?
|
331
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordParallel"')
|
332
|
+
end
|
333
|
+
|
334
|
+
if password_length.nil?
|
335
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordLength"')
|
336
|
+
end
|
337
|
+
|
338
|
+
|
339
|
+
@client.call(
|
340
|
+
method: 'POST',
|
341
|
+
path: path,
|
342
|
+
headers: headers,
|
343
|
+
params: params,
|
344
|
+
response_type: Models::User
|
345
|
+
)
|
346
|
+
end
|
347
|
+
|
348
|
+
|
349
|
+
# Create a new user. Password provided must be hashed with the [Scrypt
|
350
|
+
# Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc)
|
351
|
+
# algorithm. Use the [POST /users](/docs/server/users#usersCreate) endpoint
|
352
|
+
# to create users with a plain text password.
|
353
|
+
#
|
354
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
355
|
+
# @param [String] email User email.
|
356
|
+
# @param [String] password User password hashed using Scrypt Modified.
|
357
|
+
# @param [String] password_salt Salt used to hash password.
|
358
|
+
# @param [String] password_salt_separator Salt separator used to hash password.
|
359
|
+
# @param [String] password_signer_key Signer key used to hash password.
|
360
|
+
# @param [String] name User name. Max length: 128 chars.
|
361
|
+
#
|
362
|
+
# @return [User]
|
363
|
+
def create_scrypt_modified_user(user_id:, email:, password:, password_salt:, password_salt_separator:, password_signer_key:, name: nil)
|
364
|
+
|
365
|
+
path = '/users/scrypt-modified'
|
100
366
|
|
367
|
+
params = {
|
368
|
+
userId: user_id,
|
369
|
+
email: email,
|
370
|
+
password: password,
|
371
|
+
passwordSalt: password_salt,
|
372
|
+
passwordSaltSeparator: password_salt_separator,
|
373
|
+
passwordSignerKey: password_signer_key,
|
374
|
+
name: name,
|
375
|
+
}
|
376
|
+
|
101
377
|
headers = {
|
102
378
|
"content-type": 'application/json',
|
103
379
|
}
|
380
|
+
if user_id.nil?
|
381
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
382
|
+
end
|
383
|
+
|
384
|
+
if email.nil?
|
385
|
+
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
386
|
+
end
|
387
|
+
|
388
|
+
if password.nil?
|
389
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
390
|
+
end
|
391
|
+
|
392
|
+
if password_salt.nil?
|
393
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordSalt"')
|
394
|
+
end
|
395
|
+
|
396
|
+
if password_salt_separator.nil?
|
397
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordSaltSeparator"')
|
398
|
+
end
|
399
|
+
|
400
|
+
if password_signer_key.nil?
|
401
|
+
raise Appwrite::Exception.new('Missing required parameter: "passwordSignerKey"')
|
402
|
+
end
|
403
|
+
|
404
|
+
|
405
|
+
@client.call(
|
406
|
+
method: 'POST',
|
407
|
+
path: path,
|
408
|
+
headers: headers,
|
409
|
+
params: params,
|
410
|
+
response_type: Models::User
|
411
|
+
)
|
412
|
+
end
|
413
|
+
|
414
|
+
|
415
|
+
# Create a new user. Password provided must be hashed with the
|
416
|
+
# [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use
|
417
|
+
# the [POST /users](/docs/server/users#usersCreate) endpoint to create users
|
418
|
+
# with a plain text password.
|
419
|
+
#
|
420
|
+
# @param [String] user_id User ID. Choose your own unique ID or pass the string "unique()" to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
421
|
+
# @param [String] email User email.
|
422
|
+
# @param [String] password User password hashed using SHA.
|
423
|
+
# @param [String] password_version Optional SHA version used to hash password. Allowed values are: 'sha1', 'sha224', 'sha256', 'sha384', 'sha512/224', 'sha512/256', 'sha512', 'sha3-224', 'sha3-256', 'sha3-384', 'sha3-512'
|
424
|
+
# @param [String] name User name. Max length: 128 chars.
|
425
|
+
#
|
426
|
+
# @return [User]
|
427
|
+
def create_sha_user(user_id:, email:, password:, password_version: nil, name: nil)
|
428
|
+
|
429
|
+
path = '/users/sha'
|
430
|
+
|
431
|
+
params = {
|
432
|
+
userId: user_id,
|
433
|
+
email: email,
|
434
|
+
password: password,
|
435
|
+
passwordVersion: password_version,
|
436
|
+
name: name,
|
437
|
+
}
|
438
|
+
|
439
|
+
headers = {
|
440
|
+
"content-type": 'application/json',
|
441
|
+
}
|
442
|
+
if user_id.nil?
|
443
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
444
|
+
end
|
445
|
+
|
446
|
+
if email.nil?
|
447
|
+
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
448
|
+
end
|
449
|
+
|
450
|
+
if password.nil?
|
451
|
+
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
452
|
+
end
|
453
|
+
|
454
|
+
|
455
|
+
@client.call(
|
456
|
+
method: 'POST',
|
457
|
+
path: path,
|
458
|
+
headers: headers,
|
459
|
+
params: params,
|
460
|
+
response_type: Models::User
|
461
|
+
)
|
462
|
+
end
|
463
|
+
|
464
|
+
|
465
|
+
# Get a user by its unique ID.
|
466
|
+
#
|
467
|
+
# @param [String] user_id User ID.
|
468
|
+
#
|
469
|
+
# @return [User]
|
470
|
+
def get(user_id:)
|
471
|
+
|
472
|
+
path = '/users/{userId}'
|
473
|
+
|
474
|
+
params = {
|
475
|
+
}
|
476
|
+
|
477
|
+
headers = {
|
478
|
+
"content-type": 'application/json',
|
479
|
+
}
|
480
|
+
if user_id.nil?
|
481
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
482
|
+
end
|
483
|
+
|
484
|
+
.gsub('{userId}', user_id)
|
104
485
|
|
105
486
|
@client.call(
|
106
487
|
method: 'GET',
|
@@ -111,29 +492,31 @@ module Appwrite
|
|
111
492
|
)
|
112
493
|
end
|
113
494
|
|
495
|
+
|
114
496
|
# Delete a user by its unique ID, thereby releasing it's ID. Since ID is
|
115
497
|
# released and can be reused, all user-related resources like documents or
|
116
498
|
# storage files should be deleted before user deletion. If you want to keep
|
117
499
|
# ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
|
118
500
|
# endpoint instead.
|
119
501
|
#
|
120
|
-
# @param [
|
502
|
+
# @param [String] user_id User ID.
|
121
503
|
#
|
122
504
|
# @return []
|
123
505
|
def delete(user_id:)
|
124
|
-
if user_id.nil?
|
125
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
126
|
-
end
|
127
506
|
|
128
507
|
path = '/users/{userId}'
|
129
|
-
.gsub('{userId}', user_id)
|
130
508
|
|
131
509
|
params = {
|
132
510
|
}
|
133
|
-
|
511
|
+
|
134
512
|
headers = {
|
135
513
|
"content-type": 'application/json',
|
136
514
|
}
|
515
|
+
if user_id.nil?
|
516
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
517
|
+
end
|
518
|
+
|
519
|
+
.gsub('{userId}', user_id)
|
137
520
|
|
138
521
|
@client.call(
|
139
522
|
method: 'DELETE',
|
@@ -143,31 +526,33 @@ module Appwrite
|
|
143
526
|
)
|
144
527
|
end
|
145
528
|
|
529
|
+
|
146
530
|
# Update the user email by its unique ID.
|
147
531
|
#
|
148
|
-
# @param [
|
149
|
-
# @param [
|
532
|
+
# @param [String] user_id User ID.
|
533
|
+
# @param [String] email User email.
|
150
534
|
#
|
151
535
|
# @return [User]
|
152
536
|
def update_email(user_id:, email:)
|
153
|
-
if user_id.nil?
|
154
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
155
|
-
end
|
156
|
-
|
157
|
-
if email.nil?
|
158
|
-
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
159
|
-
end
|
160
537
|
|
161
538
|
path = '/users/{userId}/email'
|
162
|
-
.gsub('{userId}', user_id)
|
163
539
|
|
164
540
|
params = {
|
165
541
|
email: email,
|
166
542
|
}
|
167
|
-
|
543
|
+
|
168
544
|
headers = {
|
169
545
|
"content-type": 'application/json',
|
170
546
|
}
|
547
|
+
if user_id.nil?
|
548
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
549
|
+
end
|
550
|
+
|
551
|
+
if email.nil?
|
552
|
+
raise Appwrite::Exception.new('Missing required parameter: "email"')
|
553
|
+
end
|
554
|
+
|
555
|
+
.gsub('{userId}', user_id)
|
171
556
|
|
172
557
|
@client.call(
|
173
558
|
method: 'PATCH',
|
@@ -178,29 +563,29 @@ module Appwrite
|
|
178
563
|
)
|
179
564
|
end
|
180
565
|
|
566
|
+
|
181
567
|
# Get the user activity logs list by its unique ID.
|
182
568
|
#
|
183
|
-
# @param [
|
184
|
-
# @param [
|
185
|
-
# @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)
|
569
|
+
# @param [String] user_id User ID.
|
570
|
+
# @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
|
186
571
|
#
|
187
572
|
# @return [LogList]
|
188
|
-
def get_logs(user_id:,
|
189
|
-
if user_id.nil?
|
190
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
191
|
-
end
|
573
|
+
def get_logs(user_id:, queries: nil)
|
192
574
|
|
193
575
|
path = '/users/{userId}/logs'
|
194
|
-
.gsub('{userId}', user_id)
|
195
576
|
|
196
577
|
params = {
|
197
|
-
|
198
|
-
offset: offset,
|
578
|
+
queries: queries,
|
199
579
|
}
|
200
|
-
|
580
|
+
|
201
581
|
headers = {
|
202
582
|
"content-type": 'application/json',
|
203
583
|
}
|
584
|
+
if user_id.nil?
|
585
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
586
|
+
end
|
587
|
+
|
588
|
+
.gsub('{userId}', user_id)
|
204
589
|
|
205
590
|
@client.call(
|
206
591
|
method: 'GET',
|
@@ -211,25 +596,27 @@ module Appwrite
|
|
211
596
|
)
|
212
597
|
end
|
213
598
|
|
599
|
+
|
214
600
|
# Get the user membership list by its unique ID.
|
215
601
|
#
|
216
|
-
# @param [
|
602
|
+
# @param [String] user_id User ID.
|
217
603
|
#
|
218
604
|
# @return [MembershipList]
|
219
605
|
def get_memberships(user_id:)
|
220
|
-
if user_id.nil?
|
221
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
222
|
-
end
|
223
606
|
|
224
607
|
path = '/users/{userId}/memberships'
|
225
|
-
.gsub('{userId}', user_id)
|
226
608
|
|
227
609
|
params = {
|
228
610
|
}
|
229
|
-
|
611
|
+
|
230
612
|
headers = {
|
231
613
|
"content-type": 'application/json',
|
232
614
|
}
|
615
|
+
if user_id.nil?
|
616
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
617
|
+
end
|
618
|
+
|
619
|
+
.gsub('{userId}', user_id)
|
233
620
|
|
234
621
|
@client.call(
|
235
622
|
method: 'GET',
|
@@ -240,31 +627,33 @@ module Appwrite
|
|
240
627
|
)
|
241
628
|
end
|
242
629
|
|
630
|
+
|
243
631
|
# Update the user name by its unique ID.
|
244
632
|
#
|
245
|
-
# @param [
|
246
|
-
# @param [
|
633
|
+
# @param [String] user_id User ID.
|
634
|
+
# @param [String] name User name. Max length: 128 chars.
|
247
635
|
#
|
248
636
|
# @return [User]
|
249
637
|
def update_name(user_id:, name:)
|
250
|
-
if user_id.nil?
|
251
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
252
|
-
end
|
253
|
-
|
254
|
-
if name.nil?
|
255
|
-
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
256
|
-
end
|
257
638
|
|
258
639
|
path = '/users/{userId}/name'
|
259
|
-
.gsub('{userId}', user_id)
|
260
640
|
|
261
641
|
params = {
|
262
642
|
name: name,
|
263
643
|
}
|
264
|
-
|
644
|
+
|
265
645
|
headers = {
|
266
646
|
"content-type": 'application/json',
|
267
647
|
}
|
648
|
+
if user_id.nil?
|
649
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
650
|
+
end
|
651
|
+
|
652
|
+
if name.nil?
|
653
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
654
|
+
end
|
655
|
+
|
656
|
+
.gsub('{userId}', user_id)
|
268
657
|
|
269
658
|
@client.call(
|
270
659
|
method: 'PATCH',
|
@@ -275,13 +664,24 @@ module Appwrite
|
|
275
664
|
)
|
276
665
|
end
|
277
666
|
|
667
|
+
|
278
668
|
# Update the user password by its unique ID.
|
279
669
|
#
|
280
|
-
# @param [
|
281
|
-
# @param [
|
670
|
+
# @param [String] user_id User ID.
|
671
|
+
# @param [String] password New user password. Must be at least 8 chars.
|
282
672
|
#
|
283
673
|
# @return [User]
|
284
674
|
def update_password(user_id:, password:)
|
675
|
+
|
676
|
+
path = '/users/{userId}/password'
|
677
|
+
|
678
|
+
params = {
|
679
|
+
password: password,
|
680
|
+
}
|
681
|
+
|
682
|
+
headers = {
|
683
|
+
"content-type": 'application/json',
|
684
|
+
}
|
285
685
|
if user_id.nil?
|
286
686
|
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
287
687
|
end
|
@@ -290,16 +690,44 @@ module Appwrite
|
|
290
690
|
raise Appwrite::Exception.new('Missing required parameter: "password"')
|
291
691
|
end
|
292
692
|
|
293
|
-
path = '/users/{userId}/password'
|
294
693
|
.gsub('{userId}', user_id)
|
295
694
|
|
695
|
+
@client.call(
|
696
|
+
method: 'PATCH',
|
697
|
+
path: path,
|
698
|
+
headers: headers,
|
699
|
+
params: params,
|
700
|
+
response_type: Models::User
|
701
|
+
)
|
702
|
+
end
|
703
|
+
|
704
|
+
|
705
|
+
# Update the user phone by its unique ID.
|
706
|
+
#
|
707
|
+
# @param [String] user_id User ID.
|
708
|
+
# @param [String] number User phone number.
|
709
|
+
#
|
710
|
+
# @return [User]
|
711
|
+
def update_phone(user_id:, number:)
|
712
|
+
|
713
|
+
path = '/users/{userId}/phone'
|
714
|
+
|
296
715
|
params = {
|
297
|
-
|
716
|
+
number: number,
|
298
717
|
}
|
299
|
-
|
718
|
+
|
300
719
|
headers = {
|
301
720
|
"content-type": 'application/json',
|
302
721
|
}
|
722
|
+
if user_id.nil?
|
723
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
724
|
+
end
|
725
|
+
|
726
|
+
if number.nil?
|
727
|
+
raise Appwrite::Exception.new('Missing required parameter: "number"')
|
728
|
+
end
|
729
|
+
|
730
|
+
.gsub('{userId}', user_id)
|
303
731
|
|
304
732
|
@client.call(
|
305
733
|
method: 'PATCH',
|
@@ -310,25 +738,27 @@ module Appwrite
|
|
310
738
|
)
|
311
739
|
end
|
312
740
|
|
741
|
+
|
313
742
|
# Get the user preferences by its unique ID.
|
314
743
|
#
|
315
|
-
# @param [
|
744
|
+
# @param [String] user_id User ID.
|
316
745
|
#
|
317
746
|
# @return [Preferences]
|
318
747
|
def get_prefs(user_id:)
|
319
|
-
if user_id.nil?
|
320
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
321
|
-
end
|
322
748
|
|
323
749
|
path = '/users/{userId}/prefs'
|
324
|
-
.gsub('{userId}', user_id)
|
325
750
|
|
326
751
|
params = {
|
327
752
|
}
|
328
|
-
|
753
|
+
|
329
754
|
headers = {
|
330
755
|
"content-type": 'application/json',
|
331
756
|
}
|
757
|
+
if user_id.nil?
|
758
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
759
|
+
end
|
760
|
+
|
761
|
+
.gsub('{userId}', user_id)
|
332
762
|
|
333
763
|
@client.call(
|
334
764
|
method: 'GET',
|
@@ -339,33 +769,35 @@ module Appwrite
|
|
339
769
|
)
|
340
770
|
end
|
341
771
|
|
772
|
+
|
342
773
|
# Update the user preferences by its unique ID. The object you pass is stored
|
343
774
|
# as is, and replaces any previous value. The maximum allowed prefs size is
|
344
775
|
# 64kB and throws error if exceeded.
|
345
776
|
#
|
346
|
-
# @param [
|
347
|
-
# @param [
|
777
|
+
# @param [String] user_id User ID.
|
778
|
+
# @param [Hash] prefs Prefs key-value JSON object.
|
348
779
|
#
|
349
780
|
# @return [Preferences]
|
350
781
|
def update_prefs(user_id:, prefs:)
|
351
|
-
if user_id.nil?
|
352
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
353
|
-
end
|
354
|
-
|
355
|
-
if prefs.nil?
|
356
|
-
raise Appwrite::Exception.new('Missing required parameter: "prefs"')
|
357
|
-
end
|
358
782
|
|
359
783
|
path = '/users/{userId}/prefs'
|
360
|
-
.gsub('{userId}', user_id)
|
361
784
|
|
362
785
|
params = {
|
363
786
|
prefs: prefs,
|
364
787
|
}
|
365
|
-
|
788
|
+
|
366
789
|
headers = {
|
367
790
|
"content-type": 'application/json',
|
368
791
|
}
|
792
|
+
if user_id.nil?
|
793
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
794
|
+
end
|
795
|
+
|
796
|
+
if prefs.nil?
|
797
|
+
raise Appwrite::Exception.new('Missing required parameter: "prefs"')
|
798
|
+
end
|
799
|
+
|
800
|
+
.gsub('{userId}', user_id)
|
369
801
|
|
370
802
|
@client.call(
|
371
803
|
method: 'PATCH',
|
@@ -376,25 +808,27 @@ module Appwrite
|
|
376
808
|
)
|
377
809
|
end
|
378
810
|
|
811
|
+
|
379
812
|
# Get the user sessions list by its unique ID.
|
380
813
|
#
|
381
|
-
# @param [
|
814
|
+
# @param [String] user_id User ID.
|
382
815
|
#
|
383
816
|
# @return [SessionList]
|
384
817
|
def get_sessions(user_id:)
|
385
|
-
if user_id.nil?
|
386
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
387
|
-
end
|
388
818
|
|
389
819
|
path = '/users/{userId}/sessions'
|
390
|
-
.gsub('{userId}', user_id)
|
391
820
|
|
392
821
|
params = {
|
393
822
|
}
|
394
|
-
|
823
|
+
|
395
824
|
headers = {
|
396
825
|
"content-type": 'application/json',
|
397
826
|
}
|
827
|
+
if user_id.nil?
|
828
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
829
|
+
end
|
830
|
+
|
831
|
+
.gsub('{userId}', user_id)
|
398
832
|
|
399
833
|
@client.call(
|
400
834
|
method: 'GET',
|
@@ -405,25 +839,27 @@ module Appwrite
|
|
405
839
|
)
|
406
840
|
end
|
407
841
|
|
842
|
+
|
408
843
|
# Delete all user's sessions by using the user's unique ID.
|
409
844
|
#
|
410
|
-
# @param [
|
845
|
+
# @param [String] user_id User ID.
|
411
846
|
#
|
412
847
|
# @return []
|
413
848
|
def delete_sessions(user_id:)
|
414
|
-
if user_id.nil?
|
415
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
416
|
-
end
|
417
849
|
|
418
850
|
path = '/users/{userId}/sessions'
|
419
|
-
.gsub('{userId}', user_id)
|
420
851
|
|
421
852
|
params = {
|
422
853
|
}
|
423
|
-
|
854
|
+
|
424
855
|
headers = {
|
425
856
|
"content-type": 'application/json',
|
426
857
|
}
|
858
|
+
if user_id.nil?
|
859
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
860
|
+
end
|
861
|
+
|
862
|
+
.gsub('{userId}', user_id)
|
427
863
|
|
428
864
|
@client.call(
|
429
865
|
method: 'DELETE',
|
@@ -433,13 +869,23 @@ module Appwrite
|
|
433
869
|
)
|
434
870
|
end
|
435
871
|
|
872
|
+
|
436
873
|
# Delete a user sessions by its unique ID.
|
437
874
|
#
|
438
|
-
# @param [
|
439
|
-
# @param [
|
875
|
+
# @param [String] user_id User ID.
|
876
|
+
# @param [String] session_id Session ID.
|
440
877
|
#
|
441
878
|
# @return []
|
442
879
|
def delete_session(user_id:, session_id:)
|
880
|
+
|
881
|
+
path = '/users/{userId}/sessions/{sessionId}'
|
882
|
+
|
883
|
+
params = {
|
884
|
+
}
|
885
|
+
|
886
|
+
headers = {
|
887
|
+
"content-type": 'application/json',
|
888
|
+
}
|
443
889
|
if user_id.nil?
|
444
890
|
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
445
891
|
end
|
@@ -448,17 +894,9 @@ module Appwrite
|
|
448
894
|
raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
|
449
895
|
end
|
450
896
|
|
451
|
-
path = '/users/{userId}/sessions/{sessionId}'
|
452
897
|
.gsub('{userId}', user_id)
|
453
898
|
.gsub('{sessionId}', session_id)
|
454
899
|
|
455
|
-
params = {
|
456
|
-
}
|
457
|
-
|
458
|
-
headers = {
|
459
|
-
"content-type": 'application/json',
|
460
|
-
}
|
461
|
-
|
462
900
|
@client.call(
|
463
901
|
method: 'DELETE',
|
464
902
|
path: path,
|
@@ -467,32 +905,34 @@ module Appwrite
|
|
467
905
|
)
|
468
906
|
end
|
469
907
|
|
908
|
+
|
470
909
|
# Update the user status by its unique ID. Use this endpoint as an
|
471
910
|
# alternative to deleting a user if you want to keep user's ID reserved.
|
472
911
|
#
|
473
|
-
# @param [
|
474
|
-
# @param [
|
912
|
+
# @param [String] user_id User ID.
|
913
|
+
# @param [] status User Status. To activate the user pass `true` and to block the user pass `false`.
|
475
914
|
#
|
476
915
|
# @return [User]
|
477
916
|
def update_status(user_id:, status:)
|
478
|
-
if user_id.nil?
|
479
|
-
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
480
|
-
end
|
481
|
-
|
482
|
-
if status.nil?
|
483
|
-
raise Appwrite::Exception.new('Missing required parameter: "status"')
|
484
|
-
end
|
485
917
|
|
486
918
|
path = '/users/{userId}/status'
|
487
|
-
.gsub('{userId}', user_id)
|
488
919
|
|
489
920
|
params = {
|
490
921
|
status: status,
|
491
922
|
}
|
492
|
-
|
923
|
+
|
493
924
|
headers = {
|
494
925
|
"content-type": 'application/json',
|
495
926
|
}
|
927
|
+
if user_id.nil?
|
928
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
929
|
+
end
|
930
|
+
|
931
|
+
if status.nil?
|
932
|
+
raise Appwrite::Exception.new('Missing required parameter: "status"')
|
933
|
+
end
|
934
|
+
|
935
|
+
.gsub('{userId}', user_id)
|
496
936
|
|
497
937
|
@client.call(
|
498
938
|
method: 'PATCH',
|
@@ -503,13 +943,24 @@ module Appwrite
|
|
503
943
|
)
|
504
944
|
end
|
505
945
|
|
946
|
+
|
506
947
|
# Update the user email verification status by its unique ID.
|
507
948
|
#
|
508
|
-
# @param [
|
509
|
-
# @param [
|
949
|
+
# @param [String] user_id User ID.
|
950
|
+
# @param [] email_verification User email verification status.
|
510
951
|
#
|
511
952
|
# @return [User]
|
512
|
-
def
|
953
|
+
def update_email_verification(user_id:, email_verification:)
|
954
|
+
|
955
|
+
path = '/users/{userId}/verification'
|
956
|
+
|
957
|
+
params = {
|
958
|
+
emailVerification: email_verification,
|
959
|
+
}
|
960
|
+
|
961
|
+
headers = {
|
962
|
+
"content-type": 'application/json',
|
963
|
+
}
|
513
964
|
if user_id.nil?
|
514
965
|
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
515
966
|
end
|
@@ -518,16 +969,44 @@ module Appwrite
|
|
518
969
|
raise Appwrite::Exception.new('Missing required parameter: "emailVerification"')
|
519
970
|
end
|
520
971
|
|
521
|
-
path = '/users/{userId}/verification'
|
522
972
|
.gsub('{userId}', user_id)
|
523
973
|
|
974
|
+
@client.call(
|
975
|
+
method: 'PATCH',
|
976
|
+
path: path,
|
977
|
+
headers: headers,
|
978
|
+
params: params,
|
979
|
+
response_type: Models::User
|
980
|
+
)
|
981
|
+
end
|
982
|
+
|
983
|
+
|
984
|
+
# Update the user phone verification status by its unique ID.
|
985
|
+
#
|
986
|
+
# @param [String] user_id User ID.
|
987
|
+
# @param [] phone_verification User phone verification status.
|
988
|
+
#
|
989
|
+
# @return [User]
|
990
|
+
def update_phone_verification(user_id:, phone_verification:)
|
991
|
+
|
992
|
+
path = '/users/{userId}/verification/phone'
|
993
|
+
|
524
994
|
params = {
|
525
|
-
|
995
|
+
phoneVerification: phone_verification,
|
526
996
|
}
|
527
|
-
|
997
|
+
|
528
998
|
headers = {
|
529
999
|
"content-type": 'application/json',
|
530
1000
|
}
|
1001
|
+
if user_id.nil?
|
1002
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
1003
|
+
end
|
1004
|
+
|
1005
|
+
if phone_verification.nil?
|
1006
|
+
raise Appwrite::Exception.new('Missing required parameter: "phoneVerification"')
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
.gsub('{userId}', user_id)
|
531
1010
|
|
532
1011
|
@client.call(
|
533
1012
|
method: 'PATCH',
|
@@ -538,5 +1017,6 @@ module Appwrite
|
|
538
1017
|
)
|
539
1018
|
end
|
540
1019
|
|
1020
|
+
|
541
1021
|
end
|
542
1022
|
end
|