appwrite 2.4.1 → 4.1.0

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