appwrite 2.1.1 → 2.4.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +7 -8
  4. data/appwrite.gemspec +1 -1
  5. data/docs/examples/account/create-recovery.md +1 -1
  6. data/docs/examples/account/create-verification.md +1 -1
  7. data/docs/examples/account/delete-session.md +1 -1
  8. data/docs/examples/account/delete-sessions.md +1 -1
  9. data/docs/examples/account/delete.md +1 -1
  10. data/docs/examples/account/get-logs.md +1 -1
  11. data/docs/examples/account/get-prefs.md +1 -1
  12. data/docs/examples/account/get-session.md +15 -0
  13. data/docs/examples/account/get-sessions.md +1 -1
  14. data/docs/examples/account/get.md +1 -1
  15. data/docs/examples/account/update-email.md +1 -1
  16. data/docs/examples/account/update-name.md +1 -1
  17. data/docs/examples/account/update-password.md +1 -1
  18. data/docs/examples/account/update-prefs.md +1 -1
  19. data/docs/examples/account/update-recovery.md +1 -1
  20. data/docs/examples/account/update-verification.md +1 -1
  21. data/docs/examples/avatars/get-q-r.md +1 -1
  22. data/docs/examples/functions/create.md +1 -1
  23. data/docs/examples/health/get-d-b.md +1 -1
  24. data/docs/examples/locale/get-countries-e-u.md +1 -1
  25. data/docs/examples/teams/update-membership-status.md +1 -1
  26. data/docs/examples/users/update-email.md +15 -0
  27. data/docs/examples/users/update-name.md +15 -0
  28. data/docs/examples/users/update-password.md +15 -0
  29. data/docs/examples/users/update-verification.md +15 -0
  30. data/lib/appwrite/client.rb +3 -3
  31. data/lib/appwrite/services/account.rb +151 -46
  32. data/lib/appwrite/services/avatars.rb +125 -42
  33. data/lib/appwrite/services/database.rb +199 -53
  34. data/lib/appwrite/services/functions.rb +223 -61
  35. data/lib/appwrite/services/health.rb +13 -25
  36. data/lib/appwrite/services/locale.rb +8 -15
  37. data/lib/appwrite/services/storage.rb +127 -38
  38. data/lib/appwrite/services/teams.rb +162 -42
  39. data/lib/appwrite/services/users.rb +197 -33
  40. metadata +7 -2
@@ -1,29 +1,56 @@
1
1
  module Appwrite
2
2
  class Users < Service
3
3
 
4
- def list(search: '', limit: 25, offset: 0, order_type: 'ASC')
4
+ def list(search: nil, limit: nil, offset: nil, order_type: nil)
5
5
  path = '/users'
6
6
 
7
- params = {
8
- 'search': search,
9
- 'limit': limit,
10
- 'offset': offset,
11
- 'orderType': order_type
12
- }
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
+
21
+ if !order_type.nil?
22
+ params[:orderType] = order_type
23
+ end
13
24
 
14
25
  return @client.call('get', path, {
15
26
  'content-type' => 'application/json',
16
27
  }, params);
17
28
  end
18
29
 
19
- def create(email:, password:, name: '')
30
+ def create(email:, password:, name: nil)
31
+ if email.nil?
32
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
33
+ end
34
+
35
+ if password.nil?
36
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
37
+ end
38
+
20
39
  path = '/users'
21
40
 
22
- params = {
23
- 'email': email,
24
- 'password': password,
25
- 'name': name
26
- }
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
27
54
 
28
55
  return @client.call('post', path, {
29
56
  'content-type' => 'application/json',
@@ -31,11 +58,14 @@ module Appwrite
31
58
  end
32
59
 
33
60
  def get(user_id:)
61
+ if user_id.nil?
62
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
63
+ end
64
+
34
65
  path = '/users/{userId}'
35
66
  .gsub('{userId}', user_id)
36
67
 
37
- params = {
38
- }
68
+ params = {}
39
69
 
40
70
  return @client.call('get', path, {
41
71
  'content-type' => 'application/json',
@@ -43,35 +73,113 @@ module Appwrite
43
73
  end
44
74
 
45
75
  def delete(user_id:)
76
+ if user_id.nil?
77
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
78
+ end
79
+
46
80
  path = '/users/{userId}'
47
81
  .gsub('{userId}', user_id)
48
82
 
49
- params = {
50
- }
83
+ params = {}
51
84
 
52
85
  return @client.call('delete', path, {
53
86
  'content-type' => 'application/json',
54
87
  }, params);
55
88
  end
56
89
 
90
+ def update_email(user_id:, email:)
91
+ if user_id.nil?
92
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
93
+ end
94
+
95
+ if email.nil?
96
+ raise Appwrite::Exception.new('Missing required parameter: "email"')
97
+ end
98
+
99
+ path = '/users/{userId}/email'
100
+ .gsub('{userId}', user_id)
101
+
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);
111
+ end
112
+
57
113
  def get_logs(user_id:)
114
+ if user_id.nil?
115
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
116
+ end
117
+
58
118
  path = '/users/{userId}/logs'
59
119
  .gsub('{userId}', user_id)
60
120
 
61
- params = {
62
- }
121
+ params = {}
63
122
 
64
123
  return @client.call('get', path, {
65
124
  'content-type' => 'application/json',
66
125
  }, params);
67
126
  end
68
127
 
128
+ def update_name(user_id:, name:)
129
+ if user_id.nil?
130
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
131
+ end
132
+
133
+ if name.nil?
134
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
135
+ end
136
+
137
+ path = '/users/{userId}/name'
138
+ .gsub('{userId}', user_id)
139
+
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);
149
+ end
150
+
151
+ def update_password(user_id:, password:)
152
+ if user_id.nil?
153
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
154
+ end
155
+
156
+ if password.nil?
157
+ raise Appwrite::Exception.new('Missing required parameter: "password"')
158
+ end
159
+
160
+ path = '/users/{userId}/password'
161
+ .gsub('{userId}', user_id)
162
+
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);
172
+ end
173
+
69
174
  def get_prefs(user_id:)
175
+ if user_id.nil?
176
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
177
+ end
178
+
70
179
  path = '/users/{userId}/prefs'
71
180
  .gsub('{userId}', user_id)
72
181
 
73
- params = {
74
- }
182
+ params = {}
75
183
 
76
184
  return @client.call('get', path, {
77
185
  'content-type' => 'application/json',
@@ -79,12 +187,22 @@ module Appwrite
79
187
  end
80
188
 
81
189
  def update_prefs(user_id:, prefs:)
190
+ if user_id.nil?
191
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
192
+ end
193
+
194
+ if prefs.nil?
195
+ raise Appwrite::Exception.new('Missing required parameter: "prefs"')
196
+ end
197
+
82
198
  path = '/users/{userId}/prefs'
83
199
  .gsub('{userId}', user_id)
84
200
 
85
- params = {
86
- 'prefs': prefs
87
- }
201
+ params = {}
202
+
203
+ if !prefs.nil?
204
+ params[:prefs] = prefs
205
+ end
88
206
 
89
207
  return @client.call('patch', path, {
90
208
  'content-type' => 'application/json',
@@ -92,11 +210,14 @@ module Appwrite
92
210
  end
93
211
 
94
212
  def get_sessions(user_id:)
213
+ if user_id.nil?
214
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
215
+ end
216
+
95
217
  path = '/users/{userId}/sessions'
96
218
  .gsub('{userId}', user_id)
97
219
 
98
- params = {
99
- }
220
+ params = {}
100
221
 
101
222
  return @client.call('get', path, {
102
223
  'content-type' => 'application/json',
@@ -104,11 +225,14 @@ module Appwrite
104
225
  end
105
226
 
106
227
  def delete_sessions(user_id:)
228
+ if user_id.nil?
229
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
230
+ end
231
+
107
232
  path = '/users/{userId}/sessions'
108
233
  .gsub('{userId}', user_id)
109
234
 
110
- params = {
111
- }
235
+ params = {}
112
236
 
113
237
  return @client.call('delete', path, {
114
238
  'content-type' => 'application/json',
@@ -116,12 +240,19 @@ module Appwrite
116
240
  end
117
241
 
118
242
  def delete_session(user_id:, session_id:)
243
+ if user_id.nil?
244
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
245
+ end
246
+
247
+ if session_id.nil?
248
+ raise Appwrite::Exception.new('Missing required parameter: "sessionId"')
249
+ end
250
+
119
251
  path = '/users/{userId}/sessions/{sessionId}'
120
252
  .gsub('{userId}', user_id)
121
253
  .gsub('{sessionId}', session_id)
122
254
 
123
- params = {
124
- }
255
+ params = {}
125
256
 
126
257
  return @client.call('delete', path, {
127
258
  'content-type' => 'application/json',
@@ -129,12 +260,45 @@ module Appwrite
129
260
  end
130
261
 
131
262
  def update_status(user_id:, status:)
263
+ if user_id.nil?
264
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
265
+ end
266
+
267
+ if status.nil?
268
+ raise Appwrite::Exception.new('Missing required parameter: "status"')
269
+ end
270
+
132
271
  path = '/users/{userId}/status'
133
272
  .gsub('{userId}', user_id)
134
273
 
135
- params = {
136
- 'status': status
137
- }
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);
283
+ end
284
+
285
+ def update_verification(user_id:, email_verification:)
286
+ if user_id.nil?
287
+ raise Appwrite::Exception.new('Missing required parameter: "userId"')
288
+ end
289
+
290
+ if email_verification.nil?
291
+ raise Appwrite::Exception.new('Missing required parameter: "emailVerification"')
292
+ end
293
+
294
+ path = '/users/{userId}/verification'
295
+ .gsub('{userId}', user_id)
296
+
297
+ params = {}
298
+
299
+ if !email_verification.nil?
300
+ params[:emailVerification] = email_verification
301
+ end
138
302
 
139
303
  return @client.call('patch', path, {
140
304
  'content-type' => 'application/json',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-21 00:00:00.000000000 Z
11
+ date: 2021-09-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: team@appwrite.io
@@ -29,6 +29,7 @@ files:
29
29
  - docs/examples/account/delete.md
30
30
  - docs/examples/account/get-logs.md
31
31
  - docs/examples/account/get-prefs.md
32
+ - docs/examples/account/get-session.md
32
33
  - docs/examples/account/get-sessions.md
33
34
  - docs/examples/account/get.md
34
35
  - docs/examples/account/update-email.md
@@ -113,8 +114,12 @@ files:
113
114
  - docs/examples/users/get-sessions.md
114
115
  - docs/examples/users/get.md
115
116
  - docs/examples/users/list.md
117
+ - docs/examples/users/update-email.md
118
+ - docs/examples/users/update-name.md
119
+ - docs/examples/users/update-password.md
116
120
  - docs/examples/users/update-prefs.md
117
121
  - docs/examples/users/update-status.md
122
+ - docs/examples/users/update-verification.md
118
123
  - lib/appwrite.rb
119
124
  - lib/appwrite/client.rb
120
125
  - lib/appwrite/exception.rb