appwrite 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +134 -57
  3. data/lib/appwrite/exception.rb +5 -7
  4. data/lib/appwrite/file.rb +5 -13
  5. data/lib/appwrite/models/attribute_boolean.rb +52 -0
  6. data/lib/appwrite/models/attribute_email.rb +57 -0
  7. data/lib/appwrite/models/attribute_enum.rb +62 -0
  8. data/lib/appwrite/models/attribute_float.rb +62 -0
  9. data/lib/appwrite/models/attribute_integer.rb +62 -0
  10. data/lib/appwrite/models/attribute_ip.rb +57 -0
  11. data/lib/appwrite/models/attribute_list.rb +32 -0
  12. data/lib/appwrite/models/attribute_string.rb +57 -0
  13. data/lib/appwrite/models/attribute_url.rb +57 -0
  14. data/lib/appwrite/models/collection.rb +62 -0
  15. data/lib/appwrite/models/collection_list.rb +32 -0
  16. data/lib/appwrite/models/continent.rb +32 -0
  17. data/lib/appwrite/models/continent_list.rb +32 -0
  18. data/lib/appwrite/models/country.rb +32 -0
  19. data/lib/appwrite/models/country_list.rb +32 -0
  20. data/lib/appwrite/models/currency.rb +57 -0
  21. data/lib/appwrite/models/currency_list.rb +32 -0
  22. data/lib/appwrite/models/document.rb +50 -0
  23. data/lib/appwrite/models/document_list.rb +36 -0
  24. data/lib/appwrite/models/execution.rb +72 -0
  25. data/lib/appwrite/models/execution_list.rb +32 -0
  26. data/lib/appwrite/models/file.rb +62 -0
  27. data/lib/appwrite/models/file_list.rb +32 -0
  28. data/lib/appwrite/models/function.rb +92 -0
  29. data/lib/appwrite/models/function_list.rb +32 -0
  30. data/lib/appwrite/models/health_antivirus.rb +32 -0
  31. data/lib/appwrite/models/health_queue.rb +27 -0
  32. data/lib/appwrite/models/health_status.rb +32 -0
  33. data/lib/appwrite/models/health_time.rb +37 -0
  34. data/lib/appwrite/models/index.rb +47 -0
  35. data/lib/appwrite/models/index_list.rb +32 -0
  36. data/lib/appwrite/models/language.rb +37 -0
  37. data/lib/appwrite/models/language_list.rb +32 -0
  38. data/lib/appwrite/models/locale.rb +57 -0
  39. data/lib/appwrite/models/log.rb +127 -0
  40. data/lib/appwrite/models/log_list.rb +32 -0
  41. data/lib/appwrite/models/membership.rb +67 -0
  42. data/lib/appwrite/models/membership_list.rb +32 -0
  43. data/lib/appwrite/models/phone.rb +37 -0
  44. data/lib/appwrite/models/phone_list.rb +32 -0
  45. data/lib/appwrite/models/preferences.rb +30 -0
  46. data/lib/appwrite/models/runtime.rb +57 -0
  47. data/lib/appwrite/models/runtime_list.rb +32 -0
  48. data/lib/appwrite/models/session.rb +132 -0
  49. data/lib/appwrite/models/session_list.rb +32 -0
  50. data/lib/appwrite/models/tag.rb +47 -0
  51. data/lib/appwrite/models/tag_list.rb +32 -0
  52. data/lib/appwrite/models/team.rb +42 -0
  53. data/lib/appwrite/models/team_list.rb +32 -0
  54. data/lib/appwrite/models/token.rb +42 -0
  55. data/lib/appwrite/models/user.rb +62 -0
  56. data/lib/appwrite/models/user_list.rb +32 -0
  57. data/lib/appwrite/query.rb +42 -0
  58. data/lib/appwrite/service.rb +0 -5
  59. data/lib/appwrite/services/account.rb +380 -133
  60. data/lib/appwrite/services/avatars.rb +189 -125
  61. data/lib/appwrite/services/database.rb +876 -130
  62. data/lib/appwrite/services/functions.rb +366 -184
  63. data/lib/appwrite/services/health.rb +202 -58
  64. data/lib/appwrite/services/locale.rb +134 -32
  65. data/lib/appwrite/services/storage.rb +211 -118
  66. data/lib/appwrite/services/teams.rb +299 -118
  67. data/lib/appwrite/services/users.rb +372 -85
  68. data/lib/appwrite.rb +55 -0
  69. metadata +72 -103
  70. data/.travis.yml +0 -16
  71. data/CHANGELOG.md +0 -1
  72. data/Gemfile +0 -4
  73. data/LICENSE +0 -12
  74. data/README.md +0 -97
  75. data/appwrite.gemspec +0 -11
  76. data/docs/examples/account/create-recovery.md +0 -15
  77. data/docs/examples/account/create-verification.md +0 -15
  78. data/docs/examples/account/delete-session.md +0 -15
  79. data/docs/examples/account/delete-sessions.md +0 -15
  80. data/docs/examples/account/delete.md +0 -15
  81. data/docs/examples/account/get-logs.md +0 -15
  82. data/docs/examples/account/get-prefs.md +0 -15
  83. data/docs/examples/account/get-sessions.md +0 -15
  84. data/docs/examples/account/get.md +0 -15
  85. data/docs/examples/account/update-email.md +0 -15
  86. data/docs/examples/account/update-name.md +0 -15
  87. data/docs/examples/account/update-password.md +0 -15
  88. data/docs/examples/account/update-prefs.md +0 -15
  89. data/docs/examples/account/update-recovery.md +0 -15
  90. data/docs/examples/account/update-verification.md +0 -15
  91. data/docs/examples/avatars/get-browser.md +0 -15
  92. data/docs/examples/avatars/get-credit-card.md +0 -15
  93. data/docs/examples/avatars/get-favicon.md +0 -15
  94. data/docs/examples/avatars/get-flag.md +0 -15
  95. data/docs/examples/avatars/get-image.md +0 -15
  96. data/docs/examples/avatars/get-initials.md +0 -15
  97. data/docs/examples/avatars/get-q-r.md +0 -15
  98. data/docs/examples/database/create-collection.md +0 -15
  99. data/docs/examples/database/create-document.md +0 -15
  100. data/docs/examples/database/delete-collection.md +0 -15
  101. data/docs/examples/database/delete-document.md +0 -15
  102. data/docs/examples/database/get-collection.md +0 -15
  103. data/docs/examples/database/get-document.md +0 -15
  104. data/docs/examples/database/list-collections.md +0 -15
  105. data/docs/examples/database/list-documents.md +0 -15
  106. data/docs/examples/database/update-collection.md +0 -15
  107. data/docs/examples/database/update-document.md +0 -15
  108. data/docs/examples/functions/create-execution.md +0 -15
  109. data/docs/examples/functions/create-tag.md +0 -15
  110. data/docs/examples/functions/create.md +0 -15
  111. data/docs/examples/functions/delete-tag.md +0 -15
  112. data/docs/examples/functions/delete.md +0 -15
  113. data/docs/examples/functions/get-execution.md +0 -15
  114. data/docs/examples/functions/get-tag.md +0 -15
  115. data/docs/examples/functions/get.md +0 -15
  116. data/docs/examples/functions/list-executions.md +0 -15
  117. data/docs/examples/functions/list-tags.md +0 -15
  118. data/docs/examples/functions/list.md +0 -15
  119. data/docs/examples/functions/update-tag.md +0 -15
  120. data/docs/examples/functions/update.md +0 -15
  121. data/docs/examples/health/get-anti-virus.md +0 -15
  122. data/docs/examples/health/get-cache.md +0 -15
  123. data/docs/examples/health/get-d-b.md +0 -15
  124. data/docs/examples/health/get-queue-certificates.md +0 -15
  125. data/docs/examples/health/get-queue-functions.md +0 -15
  126. data/docs/examples/health/get-queue-logs.md +0 -15
  127. data/docs/examples/health/get-queue-tasks.md +0 -15
  128. data/docs/examples/health/get-queue-usage.md +0 -15
  129. data/docs/examples/health/get-queue-webhooks.md +0 -15
  130. data/docs/examples/health/get-storage-local.md +0 -15
  131. data/docs/examples/health/get-time.md +0 -15
  132. data/docs/examples/health/get.md +0 -15
  133. data/docs/examples/locale/get-continents.md +0 -15
  134. data/docs/examples/locale/get-countries-e-u.md +0 -15
  135. data/docs/examples/locale/get-countries-phones.md +0 -15
  136. data/docs/examples/locale/get-countries.md +0 -15
  137. data/docs/examples/locale/get-currencies.md +0 -15
  138. data/docs/examples/locale/get-languages.md +0 -15
  139. data/docs/examples/locale/get.md +0 -15
  140. data/docs/examples/storage/create-file.md +0 -15
  141. data/docs/examples/storage/delete-file.md +0 -15
  142. data/docs/examples/storage/get-file-download.md +0 -15
  143. data/docs/examples/storage/get-file-preview.md +0 -15
  144. data/docs/examples/storage/get-file-view.md +0 -15
  145. data/docs/examples/storage/get-file.md +0 -15
  146. data/docs/examples/storage/list-files.md +0 -15
  147. data/docs/examples/storage/update-file.md +0 -15
  148. data/docs/examples/teams/create-membership.md +0 -15
  149. data/docs/examples/teams/create.md +0 -15
  150. data/docs/examples/teams/delete-membership.md +0 -15
  151. data/docs/examples/teams/delete.md +0 -15
  152. data/docs/examples/teams/get-memberships.md +0 -15
  153. data/docs/examples/teams/get.md +0 -15
  154. data/docs/examples/teams/list.md +0 -15
  155. data/docs/examples/teams/update-membership-roles.md +0 -15
  156. data/docs/examples/teams/update-membership-status.md +0 -15
  157. data/docs/examples/teams/update.md +0 -15
  158. data/docs/examples/users/create.md +0 -15
  159. data/docs/examples/users/delete-session.md +0 -15
  160. data/docs/examples/users/delete-sessions.md +0 -15
  161. data/docs/examples/users/delete.md +0 -15
  162. data/docs/examples/users/get-logs.md +0 -15
  163. data/docs/examples/users/get-prefs.md +0 -15
  164. data/docs/examples/users/get-sessions.md +0 -15
  165. data/docs/examples/users/get.md +0 -15
  166. data/docs/examples/users/list.md +0 -15
  167. data/docs/examples/users/update-prefs.md +0 -15
  168. data/docs/examples/users/update-status.md +0 -15
@@ -1,33 +1,58 @@
1
+ #frozen_string_literal: true
2
+
1
3
  module Appwrite
2
4
  class Users < Service
3
5
 
4
- def list(search: nil, limit: nil, offset: nil, order_type: nil)
6
+ include Models
7
+ # Get a list of all the project's users. You can use the query params to
8
+ # filter your results.
9
+ #
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.
15
+ # @param [string] order_type Order result by ASC or DESC order.
16
+ #
17
+ # @return [UserList]
18
+ def list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
5
19
  path = '/users'
6
20
 
7
- params = {}
8
-
9
- if !search.nil?
10
- params[:search] = search
11
- end
12
-
13
- if !limit.nil?
14
- params[:limit] = limit
15
- end
16
-
17
- if !offset.nil?
18
- params[:offset] = offset
19
- end
21
+ params = {
22
+ search: search,
23
+ limit: limit,
24
+ offset: offset,
25
+ cursor: cursor,
26
+ cursorDirection: cursor_direction,
27
+ orderType: order_type,
28
+ }
29
+
30
+ headers = {
31
+ "content-type": 'application/json',
32
+ }
33
+
34
+ @client.call(
35
+ method: 'GET',
36
+ path: path,
37
+ params: params,
38
+ headers: headers,
39
+ response_type: UserList
40
+ )
41
+ end
20
42
 
21
- if !order_type.nil?
22
- params[:orderType] = order_type
43
+ # Create a new user.
44
+ #
45
+ # @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&#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.
49
+ #
50
+ # @return [User]
51
+ def create(user_id:, email:, password:, name: nil)
52
+ if user_id.nil?
53
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
23
54
  end
24
55
 
25
- return @client.call('get', path, {
26
- 'content-type' => 'application/json',
27
- }, params);
28
- end
29
-
30
- def create(email:, password:, name: nil)
31
56
  if email.nil?
32
57
  raise Appwrite::Exception.new('Missing required parameter: "email"')
33
58
  end
@@ -38,26 +63,61 @@ module Appwrite
38
63
 
39
64
  path = '/users'
40
65
 
41
- params = {}
66
+ params = {
67
+ userId: user_id,
68
+ email: email,
69
+ password: password,
70
+ name: name,
71
+ }
72
+
73
+ headers = {
74
+ "content-type": 'application/json',
75
+ }
76
+
77
+ @client.call(
78
+ method: 'POST',
79
+ path: path,
80
+ params: params,
81
+ headers: headers,
82
+ response_type: User
83
+ )
84
+ end
42
85
 
43
- if !email.nil?
44
- params[:email] = email
86
+ # Get a user by its unique ID.
87
+ #
88
+ # @param [string] user_id User ID.
89
+ #
90
+ # @return [User]
91
+ def get(user_id:)
92
+ if user_id.nil?
93
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
45
94
  end
46
95
 
47
- if !password.nil?
48
- params[:password] = password
49
- end
96
+ path = '/users/{userId}'
97
+ .gsub('{userId}', user_id)
50
98
 
51
- if !name.nil?
52
- params[:name] = name
53
- end
99
+ params = {
100
+ }
101
+
102
+ headers = {
103
+ "content-type": 'application/json',
104
+ }
54
105
 
55
- return @client.call('post', path, {
56
- 'content-type' => 'application/json',
57
- }, params);
106
+ @client.call(
107
+ method: 'GET',
108
+ path: path,
109
+ params: params,
110
+ headers: headers,
111
+ response_type: User
112
+ )
58
113
  end
59
114
 
60
- def get(user_id:)
115
+ # Delete a user by its unique ID.
116
+ #
117
+ # @param [string] user_id User ID.
118
+ #
119
+ # @return []
120
+ def delete(user_id:)
61
121
  if user_id.nil?
62
122
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
63
123
  end
@@ -65,29 +125,64 @@ module Appwrite
65
125
  path = '/users/{userId}'
66
126
  .gsub('{userId}', user_id)
67
127
 
68
- params = {}
128
+ params = {
129
+ }
69
130
 
70
- return @client.call('get', path, {
71
- 'content-type' => 'application/json',
72
- }, params);
131
+ headers = {
132
+ "content-type": 'application/json',
133
+ }
134
+
135
+ @client.call(
136
+ method: 'DELETE',
137
+ path: path,
138
+ params: params,
139
+ headers: headers,
140
+ )
73
141
  end
74
142
 
75
- def delete(user_id:)
143
+ # Update the user email by its unique ID.
144
+ #
145
+ # @param [string] user_id User ID.
146
+ # @param [string] email User email.
147
+ #
148
+ # @return [User]
149
+ def update_email(user_id:, email:)
76
150
  if user_id.nil?
77
151
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
78
152
  end
79
153
 
80
- path = '/users/{userId}'
81
- .gsub('{userId}', user_id)
154
+ if email.nil?
155
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
156
+ end
82
157
 
83
- params = {}
158
+ path = '/users/{userId}/email'
159
+ .gsub('{userId}', user_id)
84
160
 
85
- return @client.call('delete', path, {
86
- 'content-type' => 'application/json',
87
- }, params);
161
+ params = {
162
+ email: email,
163
+ }
164
+
165
+ headers = {
166
+ "content-type": 'application/json',
167
+ }
168
+
169
+ @client.call(
170
+ method: 'PATCH',
171
+ path: path,
172
+ params: params,
173
+ headers: headers,
174
+ response_type: User
175
+ )
88
176
  end
89
177
 
90
- def get_logs(user_id:)
178
+ # Get the user activity logs list by its unique ID.
179
+ #
180
+ # @param [string] user_id User ID.
181
+ # @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.
182
+ # @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)
183
+ #
184
+ # @return [LogList]
185
+ def get_logs(user_id:, limit: nil, offset: nil)
91
186
  if user_id.nil?
92
187
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
93
188
  end
@@ -95,13 +190,99 @@ module Appwrite
95
190
  path = '/users/{userId}/logs'
96
191
  .gsub('{userId}', user_id)
97
192
 
98
- params = {}
193
+ params = {
194
+ limit: limit,
195
+ offset: offset,
196
+ }
197
+
198
+ headers = {
199
+ "content-type": 'application/json',
200
+ }
201
+
202
+ @client.call(
203
+ method: 'GET',
204
+ path: path,
205
+ params: params,
206
+ headers: headers,
207
+ response_type: LogList
208
+ )
209
+ end
210
+
211
+ # Update the user name by its unique ID.
212
+ #
213
+ # @param [string] user_id User ID.
214
+ # @param [string] name User name. Max length: 128 chars.
215
+ #
216
+ # @return [User]
217
+ def update_name(user_id:, name:)
218
+ if user_id.nil?
219
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
220
+ end
221
+
222
+ if name.nil?
223
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
224
+ end
225
+
226
+ path = '/users/{userId}/name'
227
+ .gsub('{userId}', user_id)
228
+
229
+ params = {
230
+ name: name,
231
+ }
232
+
233
+ headers = {
234
+ "content-type": 'application/json',
235
+ }
236
+
237
+ @client.call(
238
+ method: 'PATCH',
239
+ path: path,
240
+ params: params,
241
+ headers: headers,
242
+ response_type: User
243
+ )
244
+ end
245
+
246
+ # Update the user password by its unique ID.
247
+ #
248
+ # @param [string] user_id User ID.
249
+ # @param [string] password New user password. Must be at least 8 chars.
250
+ #
251
+ # @return [User]
252
+ def update_password(user_id:, password:)
253
+ if user_id.nil?
254
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
255
+ end
256
+
257
+ if password.nil?
258
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
259
+ end
99
260
 
100
- return @client.call('get', path, {
101
- 'content-type' => 'application/json',
102
- }, params);
261
+ path = '/users/{userId}/password'
262
+ .gsub('{userId}', user_id)
263
+
264
+ params = {
265
+ password: password,
266
+ }
267
+
268
+ headers = {
269
+ "content-type": 'application/json',
270
+ }
271
+
272
+ @client.call(
273
+ method: 'PATCH',
274
+ path: path,
275
+ params: params,
276
+ headers: headers,
277
+ response_type: User
278
+ )
103
279
  end
104
280
 
281
+ # Get the user preferences by its unique ID.
282
+ #
283
+ # @param [string] user_id User ID.
284
+ #
285
+ # @return [Preferences]
105
286
  def get_prefs(user_id:)
106
287
  if user_id.nil?
107
288
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -110,13 +291,29 @@ module Appwrite
110
291
  path = '/users/{userId}/prefs'
111
292
  .gsub('{userId}', user_id)
112
293
 
113
- params = {}
294
+ params = {
295
+ }
114
296
 
115
- return @client.call('get', path, {
116
- 'content-type' => 'application/json',
117
- }, params);
297
+ headers = {
298
+ "content-type": 'application/json',
299
+ }
300
+
301
+ @client.call(
302
+ method: 'GET',
303
+ path: path,
304
+ params: params,
305
+ headers: headers,
306
+ response_type: Preferences
307
+ )
118
308
  end
119
309
 
310
+ # Update the user preferences by its unique ID. You can pass only the
311
+ # specific settings you wish to update.
312
+ #
313
+ # @param [string] user_id User ID.
314
+ # @param [object] prefs Prefs key-value JSON object.
315
+ #
316
+ # @return [Preferences]
120
317
  def update_prefs(user_id:, prefs:)
121
318
  if user_id.nil?
122
319
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -129,17 +326,28 @@ module Appwrite
129
326
  path = '/users/{userId}/prefs'
130
327
  .gsub('{userId}', user_id)
131
328
 
132
- params = {}
133
-
134
- if !prefs.nil?
135
- params[:prefs] = prefs
136
- end
137
-
138
- return @client.call('patch', path, {
139
- 'content-type' => 'application/json',
140
- }, params);
329
+ params = {
330
+ prefs: prefs,
331
+ }
332
+
333
+ headers = {
334
+ "content-type": 'application/json',
335
+ }
336
+
337
+ @client.call(
338
+ method: 'PATCH',
339
+ path: path,
340
+ params: params,
341
+ headers: headers,
342
+ response_type: Preferences
343
+ )
141
344
  end
142
345
 
346
+ # Get the user sessions list by its unique ID.
347
+ #
348
+ # @param [string] user_id User ID.
349
+ #
350
+ # @return [SessionList]
143
351
  def get_sessions(user_id:)
144
352
  if user_id.nil?
145
353
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -148,13 +356,27 @@ module Appwrite
148
356
  path = '/users/{userId}/sessions'
149
357
  .gsub('{userId}', user_id)
150
358
 
151
- params = {}
359
+ params = {
360
+ }
152
361
 
153
- return @client.call('get', path, {
154
- 'content-type' => 'application/json',
155
- }, params);
362
+ headers = {
363
+ "content-type": 'application/json',
364
+ }
365
+
366
+ @client.call(
367
+ method: 'GET',
368
+ path: path,
369
+ params: params,
370
+ headers: headers,
371
+ response_type: SessionList
372
+ )
156
373
  end
157
374
 
375
+ # Delete all user's sessions by using the user's unique ID.
376
+ #
377
+ # @param [string] user_id User ID.
378
+ #
379
+ # @return []
158
380
  def delete_sessions(user_id:)
159
381
  if user_id.nil?
160
382
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -163,13 +385,27 @@ module Appwrite
163
385
  path = '/users/{userId}/sessions'
164
386
  .gsub('{userId}', user_id)
165
387
 
166
- params = {}
388
+ params = {
389
+ }
390
+
391
+ headers = {
392
+ "content-type": 'application/json',
393
+ }
167
394
 
168
- return @client.call('delete', path, {
169
- 'content-type' => 'application/json',
170
- }, params);
395
+ @client.call(
396
+ method: 'DELETE',
397
+ path: path,
398
+ params: params,
399
+ headers: headers,
400
+ )
171
401
  end
172
402
 
403
+ # Delete a user sessions by its unique ID.
404
+ #
405
+ # @param [string] user_id User ID.
406
+ # @param [string] session_id Session ID.
407
+ #
408
+ # @return []
173
409
  def delete_session(user_id:, session_id:)
174
410
  if user_id.nil?
175
411
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -183,13 +419,27 @@ module Appwrite
183
419
  .gsub('{userId}', user_id)
184
420
  .gsub('{sessionId}', session_id)
185
421
 
186
- params = {}
422
+ params = {
423
+ }
187
424
 
188
- return @client.call('delete', path, {
189
- 'content-type' => 'application/json',
190
- }, params);
425
+ headers = {
426
+ "content-type": 'application/json',
427
+ }
428
+
429
+ @client.call(
430
+ method: 'DELETE',
431
+ path: path,
432
+ params: params,
433
+ headers: headers,
434
+ )
191
435
  end
192
436
 
437
+ # Update the user status by its unique ID.
438
+ #
439
+ # @param [string] user_id User ID.
440
+ # @param [boolean] status User Status. To activate the user pass `true` and to block the user pass `false`.
441
+ #
442
+ # @return [User]
193
443
  def update_status(user_id:, status:)
194
444
  if user_id.nil?
195
445
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -202,20 +452,57 @@ module Appwrite
202
452
  path = '/users/{userId}/status'
203
453
  .gsub('{userId}', user_id)
204
454
 
205
- params = {}
455
+ params = {
456
+ status: status,
457
+ }
458
+
459
+ headers = {
460
+ "content-type": 'application/json',
461
+ }
462
+
463
+ @client.call(
464
+ method: 'PATCH',
465
+ path: path,
466
+ params: params,
467
+ headers: headers,
468
+ response_type: User
469
+ )
470
+ end
206
471
 
207
- if !status.nil?
208
- params[:status] = status
472
+ # Update the user email verification status by its unique ID.
473
+ #
474
+ # @param [string] user_id User ID.
475
+ # @param [boolean] email_verification User email verification status.
476
+ #
477
+ # @return [User]
478
+ def update_verification(user_id:, email_verification:)
479
+ if user_id.nil?
480
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
209
481
  end
210
482
 
211
- return @client.call('patch', path, {
212
- 'content-type' => 'application/json',
213
- }, params);
214
- end
483
+ if email_verification.nil?
484
+ raise Appwrite::Exception.new('Missing required parameter: "emailVerification"')
485
+ end
215
486
 
487
+ path = '/users/{userId}/verification'
488
+ .gsub('{userId}', user_id)
216
489
 
217
- protected
490
+ params = {
491
+ emailVerification: email_verification,
492
+ }
493
+
494
+ headers = {
495
+ "content-type": 'application/json',
496
+ }
497
+
498
+ @client.call(
499
+ method: 'PATCH',
500
+ path: path,
501
+ params: params,
502
+ headers: headers,
503
+ response_type: User
504
+ )
505
+ end
218
506
 
219
- private
220
507
  end
221
508
  end
data/lib/appwrite.rb CHANGED
@@ -2,10 +2,65 @@ require 'net/http'
2
2
  require 'uri'
3
3
  require 'json'
4
4
  require 'mime/types'
5
+
5
6
  require_relative 'appwrite/client'
6
7
  require_relative 'appwrite/service'
7
8
  require_relative 'appwrite/exception'
8
9
  require_relative 'appwrite/file'
10
+
11
+ require_relative 'appwrite/models/collection_list'
12
+ require_relative 'appwrite/models/index_list'
13
+ require_relative 'appwrite/models/document_list'
14
+ require_relative 'appwrite/models/user_list'
15
+ require_relative 'appwrite/models/session_list'
16
+ require_relative 'appwrite/models/log_list'
17
+ require_relative 'appwrite/models/file_list'
18
+ require_relative 'appwrite/models/team_list'
19
+ require_relative 'appwrite/models/membership_list'
20
+ require_relative 'appwrite/models/function_list'
21
+ require_relative 'appwrite/models/runtime_list'
22
+ require_relative 'appwrite/models/tag_list'
23
+ require_relative 'appwrite/models/execution_list'
24
+ require_relative 'appwrite/models/country_list'
25
+ require_relative 'appwrite/models/continent_list'
26
+ require_relative 'appwrite/models/language_list'
27
+ require_relative 'appwrite/models/currency_list'
28
+ require_relative 'appwrite/models/phone_list'
29
+ require_relative 'appwrite/models/collection'
30
+ require_relative 'appwrite/models/attribute_list'
31
+ require_relative 'appwrite/models/attribute_string'
32
+ require_relative 'appwrite/models/attribute_integer'
33
+ require_relative 'appwrite/models/attribute_float'
34
+ require_relative 'appwrite/models/attribute_boolean'
35
+ require_relative 'appwrite/models/attribute_email'
36
+ require_relative 'appwrite/models/attribute_enum'
37
+ require_relative 'appwrite/models/attribute_ip'
38
+ require_relative 'appwrite/models/attribute_url'
39
+ require_relative 'appwrite/models/index'
40
+ require_relative 'appwrite/models/document'
41
+ require_relative 'appwrite/models/log'
42
+ require_relative 'appwrite/models/user'
43
+ require_relative 'appwrite/models/preferences'
44
+ require_relative 'appwrite/models/session'
45
+ require_relative 'appwrite/models/token'
46
+ require_relative 'appwrite/models/locale'
47
+ require_relative 'appwrite/models/file'
48
+ require_relative 'appwrite/models/team'
49
+ require_relative 'appwrite/models/membership'
50
+ require_relative 'appwrite/models/function'
51
+ require_relative 'appwrite/models/runtime'
52
+ require_relative 'appwrite/models/tag'
53
+ require_relative 'appwrite/models/execution'
54
+ require_relative 'appwrite/models/country'
55
+ require_relative 'appwrite/models/continent'
56
+ require_relative 'appwrite/models/language'
57
+ require_relative 'appwrite/models/currency'
58
+ require_relative 'appwrite/models/phone'
59
+ require_relative 'appwrite/models/health_antivirus'
60
+ require_relative 'appwrite/models/health_queue'
61
+ require_relative 'appwrite/models/health_status'
62
+ require_relative 'appwrite/models/health_time'
63
+
9
64
  require_relative 'appwrite/services/account'
10
65
  require_relative 'appwrite/services/avatars'
11
66
  require_relative 'appwrite/services/database'