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,26 +1,71 @@
1
+ #frozen_string_literal: true
2
+
1
3
  module Appwrite
2
4
  class Account < Service
3
5
 
6
+ include Models
7
+ # Get currently logged in user data as JSON object.
8
+ #
9
+ #
10
+ # @return [User]
4
11
  def get()
5
12
  path = '/account'
6
13
 
7
- params = {}
14
+ params = {
15
+ }
16
+
17
+ headers = {
18
+ "content-type": 'application/json',
19
+ }
8
20
 
9
- return @client.call('get', path, {
10
- 'content-type' => 'application/json',
11
- }, params);
21
+ @client.call(
22
+ method: 'GET',
23
+ path: path,
24
+ params: params,
25
+ headers: headers,
26
+ response_type: User
27
+ )
12
28
  end
13
29
 
30
+ # Delete a currently logged in user account. Behind the scene, the user
31
+ # record is not deleted but permanently blocked from any access. This is done
32
+ # to avoid deleted accounts being overtaken by new users with the same email
33
+ # address. Any user-related resources like documents or storage files should
34
+ # be deleted separately.
35
+ #
36
+ #
37
+ # @return []
14
38
  def delete()
15
39
  path = '/account'
16
40
 
17
- params = {}
41
+ params = {
42
+ }
18
43
 
19
- return @client.call('delete', path, {
20
- 'content-type' => 'application/json',
21
- }, params);
44
+ headers = {
45
+ "content-type": 'application/json',
46
+ }
47
+
48
+ @client.call(
49
+ method: 'DELETE',
50
+ path: path,
51
+ params: params,
52
+ headers: headers,
53
+ )
22
54
  end
23
55
 
56
+ # Update currently logged in user account email address. After changing user
57
+ # address, the user confirmation status will get reset. A new confirmation
58
+ # email is not sent automatically however you can use the send confirmation
59
+ # email endpoint again to send the confirmation email. For security measures,
60
+ # user password is required to complete this request.
61
+ # This endpoint can also be used to convert an anonymous account to a normal
62
+ # one, by passing an email address and a new password.
63
+ #
64
+ #
65
+ # @param [string] email User email.
66
+ # @param [string] password User password. Must be at least 8 chars.
67
+ #
68
+ # @return [User]
24
69
  def update_email(email:, password:)
25
70
  if email.nil?
26
71
  raise Appwrite::Exception.new('Missing required parameter: "email"')
@@ -32,31 +77,57 @@ module Appwrite
32
77
 
33
78
  path = '/account/email'
34
79
 
35
- params = {}
36
-
37
- if !email.nil?
38
- params[:email] = email
39
- end
40
-
41
- if !password.nil?
42
- params[:password] = password
43
- end
44
-
45
- return @client.call('patch', path, {
46
- 'content-type' => 'application/json',
47
- }, params);
80
+ params = {
81
+ email: email,
82
+ password: password,
83
+ }
84
+
85
+ headers = {
86
+ "content-type": 'application/json',
87
+ }
88
+
89
+ @client.call(
90
+ method: 'PATCH',
91
+ path: path,
92
+ params: params,
93
+ headers: headers,
94
+ response_type: User
95
+ )
48
96
  end
49
97
 
50
- def get_logs()
98
+ # Get currently logged in user list of latest security activity logs. Each
99
+ # log returns user IP address, location and date and time of log.
100
+ #
101
+ # @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.
102
+ # @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)
103
+ #
104
+ # @return [LogList]
105
+ def get_logs(limit: nil, offset: nil)
51
106
  path = '/account/logs'
52
107
 
53
- params = {}
54
-
55
- return @client.call('get', path, {
56
- 'content-type' => 'application/json',
57
- }, params);
108
+ params = {
109
+ limit: limit,
110
+ offset: offset,
111
+ }
112
+
113
+ headers = {
114
+ "content-type": 'application/json',
115
+ }
116
+
117
+ @client.call(
118
+ method: 'GET',
119
+ path: path,
120
+ params: params,
121
+ headers: headers,
122
+ response_type: LogList
123
+ )
58
124
  end
59
125
 
126
+ # Update currently logged in user account name.
127
+ #
128
+ # @param [string] name User name. Max length: 128 chars.
129
+ #
130
+ # @return [User]
60
131
  def update_name(name:)
61
132
  if name.nil?
62
133
  raise Appwrite::Exception.new('Missing required parameter: "name"')
@@ -64,17 +135,31 @@ module Appwrite
64
135
 
65
136
  path = '/account/name'
66
137
 
67
- params = {}
68
-
69
- if !name.nil?
70
- params[:name] = name
71
- end
72
-
73
- return @client.call('patch', path, {
74
- 'content-type' => 'application/json',
75
- }, params);
138
+ params = {
139
+ name: name,
140
+ }
141
+
142
+ headers = {
143
+ "content-type": 'application/json',
144
+ }
145
+
146
+ @client.call(
147
+ method: 'PATCH',
148
+ path: path,
149
+ params: params,
150
+ headers: headers,
151
+ response_type: User
152
+ )
76
153
  end
77
154
 
155
+ # Update currently logged in user password. For validation, user is required
156
+ # to pass in the new password, and the old password. For users created with
157
+ # OAuth and Team Invites, oldPassword is optional.
158
+ #
159
+ # @param [string] password New user password. Must be at least 8 chars.
160
+ # @param [string] old_password Current user password. Must be at least 8 chars.
161
+ #
162
+ # @return [User]
78
163
  def update_password(password:, old_password: nil)
79
164
  if password.nil?
80
165
  raise Appwrite::Exception.new('Missing required parameter: "password"')
@@ -82,31 +167,53 @@ module Appwrite
82
167
 
83
168
  path = '/account/password'
84
169
 
85
- params = {}
86
-
87
- if !password.nil?
88
- params[:password] = password
89
- end
90
-
91
- if !old_password.nil?
92
- params[:oldPassword] = old_password
93
- end
94
-
95
- return @client.call('patch', path, {
96
- 'content-type' => 'application/json',
97
- }, params);
170
+ params = {
171
+ password: password,
172
+ oldPassword: old_password,
173
+ }
174
+
175
+ headers = {
176
+ "content-type": 'application/json',
177
+ }
178
+
179
+ @client.call(
180
+ method: 'PATCH',
181
+ path: path,
182
+ params: params,
183
+ headers: headers,
184
+ response_type: User
185
+ )
98
186
  end
99
187
 
188
+ # Get currently logged in user preferences as a key-value object.
189
+ #
190
+ #
191
+ # @return [Preferences]
100
192
  def get_prefs()
101
193
  path = '/account/prefs'
102
194
 
103
- params = {}
195
+ params = {
196
+ }
104
197
 
105
- return @client.call('get', path, {
106
- 'content-type' => 'application/json',
107
- }, params);
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: Preferences
208
+ )
108
209
  end
109
210
 
211
+ # Update currently logged in user account preferences. You can pass only the
212
+ # specific settings you wish to update.
213
+ #
214
+ # @param [object] prefs Prefs key-value JSON object.
215
+ #
216
+ # @return [User]
110
217
  def update_prefs(prefs:)
111
218
  if prefs.nil?
112
219
  raise Appwrite::Exception.new('Missing required parameter: "prefs"')
@@ -114,17 +221,36 @@ module Appwrite
114
221
 
115
222
  path = '/account/prefs'
116
223
 
117
- params = {}
118
-
119
- if !prefs.nil?
120
- params[:prefs] = prefs
121
- end
122
-
123
- return @client.call('patch', path, {
124
- 'content-type' => 'application/json',
125
- }, params);
224
+ params = {
225
+ prefs: prefs,
226
+ }
227
+
228
+ headers = {
229
+ "content-type": 'application/json',
230
+ }
231
+
232
+ @client.call(
233
+ method: 'PATCH',
234
+ path: path,
235
+ params: params,
236
+ headers: headers,
237
+ response_type: User
238
+ )
126
239
  end
127
240
 
241
+ # Sends the user an email with a temporary secret key for password reset.
242
+ # When the user clicks the confirmation link he is redirected back to your
243
+ # app password reset URL with the secret key and email address values
244
+ # attached to the URL query string. Use the query string params to submit a
245
+ # request to the [PUT
246
+ # /account/recovery](/docs/client/account#accountUpdateRecovery) endpoint to
247
+ # complete the process. The verification link sent to the user's email
248
+ # address is valid for 1 hour.
249
+ #
250
+ # @param [string] email User email.
251
+ # @param [string] url URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
252
+ #
253
+ # @return [Token]
128
254
  def create_recovery(email:, url:)
129
255
  if email.nil?
130
256
  raise Appwrite::Exception.new('Missing required parameter: "email"')
@@ -136,21 +262,40 @@ module Appwrite
136
262
 
137
263
  path = '/account/recovery'
138
264
 
139
- params = {}
140
-
141
- if !email.nil?
142
- params[:email] = email
143
- end
144
-
145
- if !url.nil?
146
- params[:url] = url
147
- end
148
-
149
- return @client.call('post', path, {
150
- 'content-type' => 'application/json',
151
- }, params);
265
+ params = {
266
+ email: email,
267
+ url: url,
268
+ }
269
+
270
+ headers = {
271
+ "content-type": 'application/json',
272
+ }
273
+
274
+ @client.call(
275
+ method: 'POST',
276
+ path: path,
277
+ params: params,
278
+ headers: headers,
279
+ response_type: Token
280
+ )
152
281
  end
153
282
 
283
+ # Use this endpoint to complete the user account password reset. Both the
284
+ # **userId** and **secret** arguments will be passed as query parameters to
285
+ # the redirect URL you have provided when sending your request to the [POST
286
+ # /account/recovery](/docs/client/account#accountCreateRecovery) endpoint.
287
+ #
288
+ # Please note that in order to avoid a [Redirect
289
+ # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md)
290
+ # the only valid redirect URLs are the ones from domains you have set when
291
+ # adding your platforms in the console interface.
292
+ #
293
+ # @param [string] user_id User ID.
294
+ # @param [string] secret Valid reset token.
295
+ # @param [string] password New user password. Must be at least 8 chars.
296
+ # @param [string] password_again Repeat new user password. Must be at least 8 chars.
297
+ #
298
+ # @return [Token]
154
299
  def update_recovery(user_id:, secret:, password:, password_again:)
155
300
  if user_id.nil?
156
301
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -170,49 +315,110 @@ module Appwrite
170
315
 
171
316
  path = '/account/recovery'
172
317
 
173
- params = {}
174
-
175
- if !user_id.nil?
176
- params[:userId] = user_id
177
- end
318
+ params = {
319
+ userId: user_id,
320
+ secret: secret,
321
+ password: password,
322
+ passwordAgain: password_again,
323
+ }
324
+
325
+ headers = {
326
+ "content-type": 'application/json',
327
+ }
328
+
329
+ @client.call(
330
+ method: 'PUT',
331
+ path: path,
332
+ params: params,
333
+ headers: headers,
334
+ response_type: Token
335
+ )
336
+ end
178
337
 
179
- if !secret.nil?
180
- params[:secret] = secret
181
- end
338
+ # Get currently logged in user list of active sessions across different
339
+ # devices.
340
+ #
341
+ #
342
+ # @return [SessionList]
343
+ def get_sessions()
344
+ path = '/account/sessions'
182
345
 
183
- if !password.nil?
184
- params[:password] = password
185
- end
346
+ params = {
347
+ }
186
348
 
187
- if !password_again.nil?
188
- params[:passwordAgain] = password_again
189
- end
349
+ headers = {
350
+ "content-type": 'application/json',
351
+ }
190
352
 
191
- return @client.call('put', path, {
192
- 'content-type' => 'application/json',
193
- }, params);
353
+ @client.call(
354
+ method: 'GET',
355
+ path: path,
356
+ params: params,
357
+ headers: headers,
358
+ response_type: SessionList
359
+ )
194
360
  end
195
361
 
196
- def get_sessions()
362
+ # Delete all sessions from the user account and remove any sessions cookies
363
+ # from the end client.
364
+ #
365
+ #
366
+ # @return []
367
+ def delete_sessions()
197
368
  path = '/account/sessions'
198
369
 
199
- params = {}
370
+ params = {
371
+ }
200
372
 
201
- return @client.call('get', path, {
202
- 'content-type' => 'application/json',
203
- }, params);
373
+ headers = {
374
+ "content-type": 'application/json',
375
+ }
376
+
377
+ @client.call(
378
+ method: 'DELETE',
379
+ path: path,
380
+ params: params,
381
+ headers: headers,
382
+ )
204
383
  end
205
384
 
206
- def delete_sessions()
207
- path = '/account/sessions'
385
+ # Use this endpoint to get a logged in user's session using a Session ID.
386
+ # Inputting 'current' will return the current session being used.
387
+ #
388
+ # @param [string] session_id Session ID. Use the string &#039;current&#039; to get the current device session.
389
+ #
390
+ # @return [Session]
391
+ def get_session(session_id:)
392
+ if session_id.nil?
393
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
394
+ end
395
+
396
+ path = '/account/sessions/{sessionId}'
397
+ .gsub('{sessionId}', session_id)
208
398
 
209
- params = {}
399
+ params = {
400
+ }
210
401
 
211
- return @client.call('delete', path, {
212
- 'content-type' => 'application/json',
213
- }, params);
402
+ headers = {
403
+ "content-type": 'application/json',
404
+ }
405
+
406
+ @client.call(
407
+ method: 'GET',
408
+ path: path,
409
+ params: params,
410
+ headers: headers,
411
+ response_type: Session
412
+ )
214
413
  end
215
414
 
415
+ # Use this endpoint to log out the currently logged in user from all their
416
+ # account sessions across all of their different devices. When using the
417
+ # option id argument, only the session unique ID provider will be deleted.
418
+ #
419
+ # @param [string] session_id Session ID. Use the string &#039;current&#039; to delete the current device session.
420
+ #
421
+ # @return []
216
422
  def delete_session(session_id:)
217
423
  if session_id.nil?
218
424
  raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
@@ -221,13 +427,40 @@ module Appwrite
221
427
  path = '/account/sessions/{sessionId}'
222
428
  .gsub('{sessionId}', session_id)
223
429
 
224
- params = {}
430
+ params = {
431
+ }
432
+
433
+ headers = {
434
+ "content-type": 'application/json',
435
+ }
225
436
 
226
- return @client.call('delete', path, {
227
- 'content-type' => 'application/json',
228
- }, params);
437
+ @client.call(
438
+ method: 'DELETE',
439
+ path: path,
440
+ params: params,
441
+ headers: headers,
442
+ )
229
443
  end
230
444
 
445
+ # Use this endpoint to send a verification message to your user email address
446
+ # to confirm they are the valid owners of that address. Both the **userId**
447
+ # and **secret** arguments will be passed as query parameters to the URL you
448
+ # have provided to be attached to the verification email. The provided URL
449
+ # should redirect the user back to your app and allow you to complete the
450
+ # verification process by verifying both the **userId** and **secret**
451
+ # parameters. Learn more about how to [complete the verification
452
+ # process](/docs/client/account#accountUpdateVerification). The verification
453
+ # link sent to the user's email address is valid for 7 days.
454
+ #
455
+ # Please note that in order to avoid a [Redirect
456
+ # Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
457
+ # the only valid redirect URLs are the ones from domains you have set when
458
+ # adding your platforms in the console interface.
459
+ #
460
+ #
461
+ # @param [string] url URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
462
+ #
463
+ # @return [Token]
231
464
  def create_verification(url:)
232
465
  if url.nil?
233
466
  raise Appwrite::Exception.new('Missing required parameter: "url"')
@@ -235,17 +468,32 @@ module Appwrite
235
468
 
236
469
  path = '/account/verification'
237
470
 
238
- params = {}
239
-
240
- if !url.nil?
241
- params[:url] = url
242
- end
243
-
244
- return @client.call('post', path, {
245
- 'content-type' => 'application/json',
246
- }, params);
471
+ params = {
472
+ url: url,
473
+ }
474
+
475
+ headers = {
476
+ "content-type": 'application/json',
477
+ }
478
+
479
+ @client.call(
480
+ method: 'POST',
481
+ path: path,
482
+ params: params,
483
+ headers: headers,
484
+ response_type: Token
485
+ )
247
486
  end
248
487
 
488
+ # Use this endpoint to complete the user email verification process. Use both
489
+ # the **userId** and **secret** parameters that were attached to your app URL
490
+ # to verify the user email ownership. If confirmed this route will return a
491
+ # 200 status code.
492
+ #
493
+ # @param [string] user_id User ID.
494
+ # @param [string] secret Valid verification token.
495
+ #
496
+ # @return [Token]
249
497
  def update_verification(user_id:, secret:)
250
498
  if user_id.nil?
251
499
  raise Appwrite::Exception.new('Missing required parameter: "userId"')
@@ -257,24 +505,23 @@ module Appwrite
257
505
 
258
506
  path = '/account/verification'
259
507
 
260
- params = {}
261
-
262
- if !user_id.nil?
263
- params[:userId] = user_id
264
- end
265
-
266
- if !secret.nil?
267
- params[:secret] = secret
268
- end
269
-
270
- return @client.call('put', path, {
271
- 'content-type' => 'application/json',
272
- }, params);
508
+ params = {
509
+ userId: user_id,
510
+ secret: secret,
511
+ }
512
+
513
+ headers = {
514
+ "content-type": 'application/json',
515
+ }
516
+
517
+ @client.call(
518
+ method: 'PUT',
519
+ path: path,
520
+ params: params,
521
+ headers: headers,
522
+ response_type: Token
523
+ )
273
524
  end
274
525
 
275
-
276
- protected
277
-
278
- private
279
526
  end
280
527
  end