appwrite 6.0.0 → 7.0.0.pre.RC1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,30 +3,26 @@
3
3
  module Appwrite
4
4
  class Users < Service
5
5
 
6
+ def initialize(client)
7
+ @client = client
8
+ end
6
9
 
7
10
  # Get a list of all the project's users. You can use the query params to
8
11
  # filter your results.
9
12
  #
10
- # @param [string] search Search term to filter your list results. Max length: 256 chars.
11
- # @param [number] limit Maximum number of users to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
12
- # @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)
13
- # @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)
14
- # @param [string] cursor_direction Direction of the cursor, can be either &#039;before&#039; or &#039;after&#039;.
15
- # @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.
16
15
  #
17
16
  # @return [UserList]
18
- def list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
17
+ def list(queries: nil, search: nil)
18
+
19
19
  path = '/users'
20
20
 
21
21
  params = {
22
+ queries: queries,
22
23
  search: search,
23
- limit: limit,
24
- offset: offset,
25
- cursor: cursor,
26
- cursorDirection: cursor_direction,
27
- orderType: order_type,
28
24
  }
29
-
25
+
30
26
  headers = {
31
27
  "content-type": 'application/json',
32
28
  }
@@ -40,15 +36,71 @@ module Appwrite
40
36
  )
41
37
  end
42
38
 
39
+
43
40
  # Create a new user.
44
41
  #
45
- # @param [string] user_id User ID. Choose your own unique ID or pass the string &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;t start with a special char. Max length is 36 chars.
46
- # @param [string] email User email.
47
- # @param [string] password User password. Must be at least 8 chars.
48
- # @param [string] name User name. Max length: 128 chars.
42
+ # @param [String] user_id User ID. Choose your own unique ID or pass the string &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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 &#039;+&#039; 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.
47
+ #
48
+ # @return [User]
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 &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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.
49
88
  #
50
89
  # @return [User]
51
- def create(user_id:, email:, password:, name: nil)
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
+ }
52
104
  if user_id.nil?
53
105
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
54
106
  end
@@ -61,7 +113,31 @@ module Appwrite
61
113
  raise Appwrite::Exception.new('Missing required parameter: "password"')
62
114
  end
63
115
 
64
- path = '/users'
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 &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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'
65
141
 
66
142
  params = {
67
143
  userId: user_id,
@@ -69,10 +145,70 @@ module Appwrite
69
145
  password: password,
70
146
  name: name,
71
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
159
+
160
+ if password.nil?
161
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
162
+ end
72
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 &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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
+
73
197
  headers = {
74
198
  "content-type": 'application/json',
75
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
+
76
212
 
77
213
  @client.call(
78
214
  method: 'POST',
@@ -83,25 +219,269 @@ module Appwrite
83
219
  )
84
220
  end
85
221
 
86
- # Get a user by its unique ID.
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.
87
227
  #
88
- # @param [string] user_id User ID.
228
+ # @param [String] user_id User ID. Choose your own unique ID or pass the string &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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.
89
232
  #
90
233
  # @return [User]
91
- def get(user_id:)
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
+ }
92
248
  if user_id.nil?
93
249
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
94
250
  end
95
251
 
96
- path = '/users/{userId}'
97
- .gsub('{userId}', user_id)
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 &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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'
98
290
 
99
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,
100
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 &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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'
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
+
377
+ headers = {
378
+ "content-type": 'application/json',
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 &quot;unique()&quot; to auto generate it. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can&#039;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: &#039;sha1&#039;, &#039;sha224&#039;, &#039;sha256&#039;, &#039;sha384&#039;, &#039;sha512/224&#039;, &#039;sha512/256&#039;, &#039;sha512&#039;, &#039;sha3-224&#039;, &#039;sha3-256&#039;, &#039;sha3-384&#039;, &#039;sha3-512&#039;
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
101
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
+
102
477
  headers = {
103
478
  "content-type": 'application/json',
104
479
  }
480
+ if user_id.nil?
481
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
482
+ end
483
+
484
+ .gsub('{userId}', user_id)
105
485
 
106
486
  @client.call(
107
487
  method: 'GET',
@@ -112,29 +492,31 @@ module Appwrite
112
492
  )
113
493
  end
114
494
 
495
+
115
496
  # Delete a user by its unique ID, thereby releasing it's ID. Since ID is
116
497
  # released and can be reused, all user-related resources like documents or
117
498
  # storage files should be deleted before user deletion. If you want to keep
118
499
  # ID reserved, use the [updateStatus](/docs/server/users#usersUpdateStatus)
119
500
  # endpoint instead.
120
501
  #
121
- # @param [string] user_id User ID.
502
+ # @param [String] user_id User ID.
122
503
  #
123
504
  # @return []
124
505
  def delete(user_id:)
125
- if user_id.nil?
126
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
127
- end
128
506
 
129
507
  path = '/users/{userId}'
130
- .gsub('{userId}', user_id)
131
508
 
132
509
  params = {
133
510
  }
134
-
511
+
135
512
  headers = {
136
513
  "content-type": 'application/json',
137
514
  }
515
+ if user_id.nil?
516
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
517
+ end
518
+
519
+ .gsub('{userId}', user_id)
138
520
 
139
521
  @client.call(
140
522
  method: 'DELETE',
@@ -144,31 +526,33 @@ module Appwrite
144
526
  )
145
527
  end
146
528
 
529
+
147
530
  # Update the user email by its unique ID.
148
531
  #
149
- # @param [string] user_id User ID.
150
- # @param [string] email User email.
532
+ # @param [String] user_id User ID.
533
+ # @param [String] email User email.
151
534
  #
152
535
  # @return [User]
153
536
  def update_email(user_id:, email:)
154
- if user_id.nil?
155
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
156
- end
157
-
158
- if email.nil?
159
- raise Appwrite::Exception.new('Missing required parameter: "email"')
160
- end
161
537
 
162
538
  path = '/users/{userId}/email'
163
- .gsub('{userId}', user_id)
164
539
 
165
540
  params = {
166
541
  email: email,
167
542
  }
168
-
543
+
169
544
  headers = {
170
545
  "content-type": 'application/json',
171
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)
172
556
 
173
557
  @client.call(
174
558
  method: 'PATCH',
@@ -179,29 +563,29 @@ module Appwrite
179
563
  )
180
564
  end
181
565
 
566
+
182
567
  # Get the user activity logs list by its unique ID.
183
568
  #
184
- # @param [string] user_id User ID.
185
- # @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.
186
- # @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
187
571
  #
188
572
  # @return [LogList]
189
- def get_logs(user_id:, limit: nil, offset: nil)
190
- if user_id.nil?
191
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
192
- end
573
+ def get_logs(user_id:, queries: nil)
193
574
 
194
575
  path = '/users/{userId}/logs'
195
- .gsub('{userId}', user_id)
196
576
 
197
577
  params = {
198
- limit: limit,
199
- offset: offset,
578
+ queries: queries,
200
579
  }
201
-
580
+
202
581
  headers = {
203
582
  "content-type": 'application/json',
204
583
  }
584
+ if user_id.nil?
585
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
586
+ end
587
+
588
+ .gsub('{userId}', user_id)
205
589
 
206
590
  @client.call(
207
591
  method: 'GET',
@@ -212,25 +596,27 @@ module Appwrite
212
596
  )
213
597
  end
214
598
 
599
+
215
600
  # Get the user membership list by its unique ID.
216
601
  #
217
- # @param [string] user_id User ID.
602
+ # @param [String] user_id User ID.
218
603
  #
219
604
  # @return [MembershipList]
220
605
  def get_memberships(user_id:)
221
- if user_id.nil?
222
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
223
- end
224
606
 
225
607
  path = '/users/{userId}/memberships'
226
- .gsub('{userId}', user_id)
227
608
 
228
609
  params = {
229
610
  }
230
-
611
+
231
612
  headers = {
232
613
  "content-type": 'application/json',
233
614
  }
615
+ if user_id.nil?
616
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
617
+ end
618
+
619
+ .gsub('{userId}', user_id)
234
620
 
235
621
  @client.call(
236
622
  method: 'GET',
@@ -241,31 +627,33 @@ module Appwrite
241
627
  )
242
628
  end
243
629
 
630
+
244
631
  # Update the user name by its unique ID.
245
632
  #
246
- # @param [string] user_id User ID.
247
- # @param [string] name User name. Max length: 128 chars.
633
+ # @param [String] user_id User ID.
634
+ # @param [String] name User name. Max length: 128 chars.
248
635
  #
249
636
  # @return [User]
250
637
  def update_name(user_id:, name:)
251
- if user_id.nil?
252
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
253
- end
254
-
255
- if name.nil?
256
- raise Appwrite::Exception.new('Missing required parameter: "name"')
257
- end
258
638
 
259
639
  path = '/users/{userId}/name'
260
- .gsub('{userId}', user_id)
261
640
 
262
641
  params = {
263
642
  name: name,
264
643
  }
265
-
644
+
266
645
  headers = {
267
646
  "content-type": 'application/json',
268
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)
269
657
 
270
658
  @client.call(
271
659
  method: 'PATCH',
@@ -276,31 +664,33 @@ module Appwrite
276
664
  )
277
665
  end
278
666
 
667
+
279
668
  # Update the user password by its unique ID.
280
669
  #
281
- # @param [string] user_id User ID.
282
- # @param [string] password New user password. Must be at least 8 chars.
670
+ # @param [String] user_id User ID.
671
+ # @param [String] password New user password. Must be at least 8 chars.
283
672
  #
284
673
  # @return [User]
285
674
  def update_password(user_id:, password:)
286
- if user_id.nil?
287
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
288
- end
289
-
290
- if password.nil?
291
- raise Appwrite::Exception.new('Missing required parameter: "password"')
292
- end
293
675
 
294
676
  path = '/users/{userId}/password'
295
- .gsub('{userId}', user_id)
296
677
 
297
678
  params = {
298
679
  password: password,
299
680
  }
300
-
681
+
301
682
  headers = {
302
683
  "content-type": 'application/json',
303
684
  }
685
+ if user_id.nil?
686
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
687
+ end
688
+
689
+ if password.nil?
690
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
691
+ end
692
+
693
+ .gsub('{userId}', user_id)
304
694
 
305
695
  @client.call(
306
696
  method: 'PATCH',
@@ -311,31 +701,33 @@ module Appwrite
311
701
  )
312
702
  end
313
703
 
704
+
314
705
  # Update the user phone by its unique ID.
315
706
  #
316
- # @param [string] user_id User ID.
317
- # @param [string] number User phone number.
707
+ # @param [String] user_id User ID.
708
+ # @param [String] number User phone number.
318
709
  #
319
710
  # @return [User]
320
711
  def update_phone(user_id:, number:)
321
- if user_id.nil?
322
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
323
- end
324
-
325
- if number.nil?
326
- raise Appwrite::Exception.new('Missing required parameter: "number"')
327
- end
328
712
 
329
713
  path = '/users/{userId}/phone'
330
- .gsub('{userId}', user_id)
331
714
 
332
715
  params = {
333
716
  number: number,
334
717
  }
335
-
718
+
336
719
  headers = {
337
720
  "content-type": 'application/json',
338
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)
339
731
 
340
732
  @client.call(
341
733
  method: 'PATCH',
@@ -346,25 +738,27 @@ module Appwrite
346
738
  )
347
739
  end
348
740
 
741
+
349
742
  # Get the user preferences by its unique ID.
350
743
  #
351
- # @param [string] user_id User ID.
744
+ # @param [String] user_id User ID.
352
745
  #
353
746
  # @return [Preferences]
354
747
  def get_prefs(user_id:)
355
- if user_id.nil?
356
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
357
- end
358
748
 
359
749
  path = '/users/{userId}/prefs'
360
- .gsub('{userId}', user_id)
361
750
 
362
751
  params = {
363
752
  }
364
-
753
+
365
754
  headers = {
366
755
  "content-type": 'application/json',
367
756
  }
757
+ if user_id.nil?
758
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
759
+ end
760
+
761
+ .gsub('{userId}', user_id)
368
762
 
369
763
  @client.call(
370
764
  method: 'GET',
@@ -375,33 +769,35 @@ module Appwrite
375
769
  )
376
770
  end
377
771
 
772
+
378
773
  # Update the user preferences by its unique ID. The object you pass is stored
379
774
  # as is, and replaces any previous value. The maximum allowed prefs size is
380
775
  # 64kB and throws error if exceeded.
381
776
  #
382
- # @param [string] user_id User ID.
383
- # @param [object] prefs Prefs key-value JSON object.
777
+ # @param [String] user_id User ID.
778
+ # @param [Hash] prefs Prefs key-value JSON object.
384
779
  #
385
780
  # @return [Preferences]
386
781
  def update_prefs(user_id:, prefs:)
387
- if user_id.nil?
388
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
389
- end
390
-
391
- if prefs.nil?
392
- raise Appwrite::Exception.new('Missing required parameter: "prefs"')
393
- end
394
782
 
395
783
  path = '/users/{userId}/prefs'
396
- .gsub('{userId}', user_id)
397
784
 
398
785
  params = {
399
786
  prefs: prefs,
400
787
  }
401
-
788
+
402
789
  headers = {
403
790
  "content-type": 'application/json',
404
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)
405
801
 
406
802
  @client.call(
407
803
  method: 'PATCH',
@@ -412,25 +808,27 @@ module Appwrite
412
808
  )
413
809
  end
414
810
 
811
+
415
812
  # Get the user sessions list by its unique ID.
416
813
  #
417
- # @param [string] user_id User ID.
814
+ # @param [String] user_id User ID.
418
815
  #
419
816
  # @return [SessionList]
420
817
  def get_sessions(user_id:)
421
- if user_id.nil?
422
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
423
- end
424
818
 
425
819
  path = '/users/{userId}/sessions'
426
- .gsub('{userId}', user_id)
427
820
 
428
821
  params = {
429
822
  }
430
-
823
+
431
824
  headers = {
432
825
  "content-type": 'application/json',
433
826
  }
827
+ if user_id.nil?
828
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
829
+ end
830
+
831
+ .gsub('{userId}', user_id)
434
832
 
435
833
  @client.call(
436
834
  method: 'GET',
@@ -441,25 +839,27 @@ module Appwrite
441
839
  )
442
840
  end
443
841
 
842
+
444
843
  # Delete all user's sessions by using the user's unique ID.
445
844
  #
446
- # @param [string] user_id User ID.
845
+ # @param [String] user_id User ID.
447
846
  #
448
847
  # @return []
449
848
  def delete_sessions(user_id:)
450
- if user_id.nil?
451
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
452
- end
453
849
 
454
850
  path = '/users/{userId}/sessions'
455
- .gsub('{userId}', user_id)
456
851
 
457
852
  params = {
458
853
  }
459
-
854
+
460
855
  headers = {
461
856
  "content-type": 'application/json',
462
857
  }
858
+ if user_id.nil?
859
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
860
+ end
861
+
862
+ .gsub('{userId}', user_id)
463
863
 
464
864
  @client.call(
465
865
  method: 'DELETE',
@@ -469,13 +869,23 @@ module Appwrite
469
869
  )
470
870
  end
471
871
 
872
+
472
873
  # Delete a user sessions by its unique ID.
473
874
  #
474
- # @param [string] user_id User ID.
475
- # @param [string] session_id Session ID.
875
+ # @param [String] user_id User ID.
876
+ # @param [String] session_id Session ID.
476
877
  #
477
878
  # @return []
478
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
+ }
479
889
  if user_id.nil?
480
890
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
481
891
  end
@@ -484,17 +894,9 @@ module Appwrite
484
894
  raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
485
895
  end
486
896
 
487
- path = '/users/{userId}/sessions/{sessionId}'
488
897
  .gsub('{userId}', user_id)
489
898
  .gsub('{sessionId}', session_id)
490
899
 
491
- params = {
492
- }
493
-
494
- headers = {
495
- "content-type": 'application/json',
496
- }
497
-
498
900
  @client.call(
499
901
  method: 'DELETE',
500
902
  path: path,
@@ -503,32 +905,34 @@ module Appwrite
503
905
  )
504
906
  end
505
907
 
908
+
506
909
  # Update the user status by its unique ID. Use this endpoint as an
507
910
  # alternative to deleting a user if you want to keep user's ID reserved.
508
911
  #
509
- # @param [string] user_id User ID.
510
- # @param [boolean] status User Status. To activate the user pass `true` and to block the user pass `false`.
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`.
511
914
  #
512
915
  # @return [User]
513
916
  def update_status(user_id:, status:)
514
- if user_id.nil?
515
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
516
- end
517
-
518
- if status.nil?
519
- raise Appwrite::Exception.new('Missing required parameter: "status"')
520
- end
521
917
 
522
918
  path = '/users/{userId}/status'
523
- .gsub('{userId}', user_id)
524
919
 
525
920
  params = {
526
921
  status: status,
527
922
  }
528
-
923
+
529
924
  headers = {
530
925
  "content-type": 'application/json',
531
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)
532
936
 
533
937
  @client.call(
534
938
  method: 'PATCH',
@@ -539,31 +943,33 @@ module Appwrite
539
943
  )
540
944
  end
541
945
 
946
+
542
947
  # Update the user email verification status by its unique ID.
543
948
  #
544
- # @param [string] user_id User ID.
545
- # @param [boolean] email_verification User email verification status.
949
+ # @param [String] user_id User ID.
950
+ # @param [] email_verification User email verification status.
546
951
  #
547
952
  # @return [User]
548
953
  def update_email_verification(user_id:, email_verification:)
549
- if user_id.nil?
550
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
551
- end
552
-
553
- if email_verification.nil?
554
- raise Appwrite::Exception.new('Missing required parameter: "emailVerification"')
555
- end
556
954
 
557
955
  path = '/users/{userId}/verification'
558
- .gsub('{userId}', user_id)
559
956
 
560
957
  params = {
561
958
  emailVerification: email_verification,
562
959
  }
563
-
960
+
564
961
  headers = {
565
962
  "content-type": 'application/json',
566
963
  }
964
+ if user_id.nil?
965
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
966
+ end
967
+
968
+ if email_verification.nil?
969
+ raise Appwrite::Exception.new('Missing required parameter: "emailVerification"')
970
+ end
971
+
972
+ .gsub('{userId}', user_id)
567
973
 
568
974
  @client.call(
569
975
  method: 'PATCH',
@@ -574,31 +980,33 @@ module Appwrite
574
980
  )
575
981
  end
576
982
 
983
+
577
984
  # Update the user phone verification status by its unique ID.
578
985
  #
579
- # @param [string] user_id User ID.
580
- # @param [boolean] phone_verification User phone verification status.
986
+ # @param [String] user_id User ID.
987
+ # @param [] phone_verification User phone verification status.
581
988
  #
582
989
  # @return [User]
583
990
  def update_phone_verification(user_id:, phone_verification:)
584
- if user_id.nil?
585
- raise Appwrite::Exception.new('Missing required parameter: "userId"')
586
- end
587
-
588
- if phone_verification.nil?
589
- raise Appwrite::Exception.new('Missing required parameter: "phoneVerification"')
590
- end
591
991
 
592
992
  path = '/users/{userId}/verification/phone'
593
- .gsub('{userId}', user_id)
594
993
 
595
994
  params = {
596
995
  phoneVerification: phone_verification,
597
996
  }
598
-
997
+
599
998
  headers = {
600
999
  "content-type": 'application/json',
601
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)
602
1010
 
603
1011
  @client.call(
604
1012
  method: 'PATCH',
@@ -609,5 +1017,6 @@ module Appwrite
609
1017
  )
610
1018
  end
611
1019
 
1020
+
612
1021
  end
613
1022
  end