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,33 +1,76 @@
1
1
  module Appwrite
2
2
  class Functions < 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 = '/functions'
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(name:, execute:, env:, vars: {}, events: [], schedule: '', timeout: 15)
30
+ def create(name:, execute:, runtime:, vars: nil, events: nil, schedule: nil, timeout: nil)
31
+ if name.nil?
32
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
33
+ end
34
+
35
+ if execute.nil?
36
+ raise Appwrite::Exception.new('Missing required parameter: "execute"')
37
+ end
38
+
39
+ if runtime.nil?
40
+ raise Appwrite::Exception.new('Missing required parameter: "runtime"')
41
+ end
42
+
20
43
  path = '/functions'
21
44
 
22
- params = {
23
- 'name': name,
24
- 'execute': execute,
25
- 'env': env,
26
- 'vars': vars,
27
- 'events': events,
28
- 'schedule': schedule,
29
- 'timeout': timeout
30
- }
45
+ params = {}
46
+
47
+ if !name.nil?
48
+ params[:name] = name
49
+ end
50
+
51
+ if !execute.nil?
52
+ params[:execute] = execute
53
+ end
54
+
55
+ if !runtime.nil?
56
+ params[:runtime] = runtime
57
+ end
58
+
59
+ if !vars.nil?
60
+ params[:vars] = vars
61
+ end
62
+
63
+ if !events.nil?
64
+ params[:events] = events
65
+ end
66
+
67
+ if !schedule.nil?
68
+ params[:schedule] = schedule
69
+ end
70
+
71
+ if !timeout.nil?
72
+ params[:timeout] = timeout
73
+ end
31
74
 
32
75
  return @client.call('post', path, {
33
76
  'content-type' => 'application/json',
@@ -35,29 +78,61 @@ module Appwrite
35
78
  end
36
79
 
37
80
  def get(function_id:)
81
+ if function_id.nil?
82
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
83
+ end
84
+
38
85
  path = '/functions/{functionId}'
39
86
  .gsub('{functionId}', function_id)
40
87
 
41
- params = {
42
- }
88
+ params = {}
43
89
 
44
90
  return @client.call('get', path, {
45
91
  'content-type' => 'application/json',
46
92
  }, params);
47
93
  end
48
94
 
49
- def update(function_id:, name:, execute:, vars: {}, events: [], schedule: '', timeout: 15)
95
+ def update(function_id:, name:, execute:, vars: nil, events: nil, schedule: nil, timeout: nil)
96
+ if function_id.nil?
97
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
98
+ end
99
+
100
+ if name.nil?
101
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
102
+ end
103
+
104
+ if execute.nil?
105
+ raise Appwrite::Exception.new('Missing required parameter: "execute"')
106
+ end
107
+
50
108
  path = '/functions/{functionId}'
51
109
  .gsub('{functionId}', function_id)
52
110
 
53
- params = {
54
- 'name': name,
55
- 'execute': execute,
56
- 'vars': vars,
57
- 'events': events,
58
- 'schedule': schedule,
59
- 'timeout': timeout
60
- }
111
+ params = {}
112
+
113
+ if !name.nil?
114
+ params[:name] = name
115
+ end
116
+
117
+ if !execute.nil?
118
+ params[:execute] = execute
119
+ end
120
+
121
+ if !vars.nil?
122
+ params[:vars] = vars
123
+ end
124
+
125
+ if !events.nil?
126
+ params[:events] = events
127
+ end
128
+
129
+ if !schedule.nil?
130
+ params[:schedule] = schedule
131
+ end
132
+
133
+ if !timeout.nil?
134
+ params[:timeout] = timeout
135
+ end
61
136
 
62
137
  return @client.call('put', path, {
63
138
  'content-type' => 'application/json',
@@ -65,40 +140,64 @@ module Appwrite
65
140
  end
66
141
 
67
142
  def delete(function_id:)
143
+ if function_id.nil?
144
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
145
+ end
146
+
68
147
  path = '/functions/{functionId}'
69
148
  .gsub('{functionId}', function_id)
70
149
 
71
- params = {
72
- }
150
+ params = {}
73
151
 
74
152
  return @client.call('delete', path, {
75
153
  'content-type' => 'application/json',
76
154
  }, params);
77
155
  end
78
156
 
79
- def list_executions(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
157
+ def list_executions(function_id:, search: nil, limit: nil, offset: nil, order_type: nil)
158
+ if function_id.nil?
159
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
160
+ end
161
+
80
162
  path = '/functions/{functionId}/executions'
81
163
  .gsub('{functionId}', function_id)
82
164
 
83
- params = {
84
- 'search': search,
85
- 'limit': limit,
86
- 'offset': offset,
87
- 'orderType': order_type
88
- }
165
+ params = {}
166
+
167
+ if !search.nil?
168
+ params[:search] = search
169
+ end
170
+
171
+ if !limit.nil?
172
+ params[:limit] = limit
173
+ end
174
+
175
+ if !offset.nil?
176
+ params[:offset] = offset
177
+ end
178
+
179
+ if !order_type.nil?
180
+ params[:orderType] = order_type
181
+ end
89
182
 
90
183
  return @client.call('get', path, {
91
184
  'content-type' => 'application/json',
92
185
  }, params);
93
186
  end
94
187
 
95
- def create_execution(function_id:, data: '')
188
+ def create_execution(function_id:, data: nil)
189
+ if function_id.nil?
190
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
191
+ end
192
+
96
193
  path = '/functions/{functionId}/executions'
97
194
  .gsub('{functionId}', function_id)
98
195
 
99
- params = {
100
- 'data': data
101
- }
196
+ params = {}
197
+
198
+ if !data.nil?
199
+ params[:data] = data
200
+ end
102
201
 
103
202
  return @client.call('post', path, {
104
203
  'content-type' => 'application/json',
@@ -106,12 +205,19 @@ module Appwrite
106
205
  end
107
206
 
108
207
  def get_execution(function_id:, execution_id:)
208
+ if function_id.nil?
209
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
210
+ end
211
+
212
+ if execution_id.nil?
213
+ raise Appwrite::Exception.new('Missing required parameter: "executionId"')
214
+ end
215
+
109
216
  path = '/functions/{functionId}/executions/{executionId}'
110
217
  .gsub('{functionId}', function_id)
111
218
  .gsub('{executionId}', execution_id)
112
219
 
113
- params = {
114
- }
220
+ params = {}
115
221
 
116
222
  return @client.call('get', path, {
117
223
  'content-type' => 'application/json',
@@ -119,28 +225,53 @@ module Appwrite
119
225
  end
120
226
 
121
227
  def update_tag(function_id:, tag:)
228
+ if function_id.nil?
229
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
230
+ end
231
+
232
+ if tag.nil?
233
+ raise Appwrite::Exception.new('Missing required parameter: "tag"')
234
+ end
235
+
122
236
  path = '/functions/{functionId}/tag'
123
237
  .gsub('{functionId}', function_id)
124
238
 
125
- params = {
126
- 'tag': tag
127
- }
239
+ params = {}
240
+
241
+ if !tag.nil?
242
+ params[:tag] = tag
243
+ end
128
244
 
129
245
  return @client.call('patch', path, {
130
246
  'content-type' => 'application/json',
131
247
  }, params);
132
248
  end
133
249
 
134
- def list_tags(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC')
250
+ def list_tags(function_id:, search: nil, limit: nil, offset: nil, order_type: nil)
251
+ if function_id.nil?
252
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
253
+ end
254
+
135
255
  path = '/functions/{functionId}/tags'
136
256
  .gsub('{functionId}', function_id)
137
257
 
138
- params = {
139
- 'search': search,
140
- 'limit': limit,
141
- 'offset': offset,
142
- 'orderType': order_type
143
- }
258
+ params = {}
259
+
260
+ if !search.nil?
261
+ params[:search] = search
262
+ end
263
+
264
+ if !limit.nil?
265
+ params[:limit] = limit
266
+ end
267
+
268
+ if !offset.nil?
269
+ params[:offset] = offset
270
+ end
271
+
272
+ if !order_type.nil?
273
+ params[:orderType] = order_type
274
+ end
144
275
 
145
276
  return @client.call('get', path, {
146
277
  'content-type' => 'application/json',
@@ -148,13 +279,30 @@ module Appwrite
148
279
  end
149
280
 
150
281
  def create_tag(function_id:, command:, code:)
282
+ if function_id.nil?
283
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
284
+ end
285
+
286
+ if command.nil?
287
+ raise Appwrite::Exception.new('Missing required parameter: "command"')
288
+ end
289
+
290
+ if code.nil?
291
+ raise Appwrite::Exception.new('Missing required parameter: "code"')
292
+ end
293
+
151
294
  path = '/functions/{functionId}/tags'
152
295
  .gsub('{functionId}', function_id)
153
296
 
154
- params = {
155
- 'command': command,
156
- 'code': code
157
- }
297
+ params = {}
298
+
299
+ if !command.nil?
300
+ params[:command] = command
301
+ end
302
+
303
+ if !code.nil?
304
+ params[:code] = code
305
+ end
158
306
 
159
307
  return @client.call('post', path, {
160
308
  'content-type' => 'multipart/form-data',
@@ -162,12 +310,19 @@ module Appwrite
162
310
  end
163
311
 
164
312
  def get_tag(function_id:, tag_id:)
313
+ if function_id.nil?
314
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
315
+ end
316
+
317
+ if tag_id.nil?
318
+ raise Appwrite::Exception.new('Missing required parameter: "tagId"')
319
+ end
320
+
165
321
  path = '/functions/{functionId}/tags/{tagId}'
166
322
  .gsub('{functionId}', function_id)
167
323
  .gsub('{tagId}', tag_id)
168
324
 
169
- params = {
170
- }
325
+ params = {}
171
326
 
172
327
  return @client.call('get', path, {
173
328
  'content-type' => 'application/json',
@@ -175,12 +330,19 @@ module Appwrite
175
330
  end
176
331
 
177
332
  def delete_tag(function_id:, tag_id:)
333
+ if function_id.nil?
334
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
335
+ end
336
+
337
+ if tag_id.nil?
338
+ raise Appwrite::Exception.new('Missing required parameter: "tagId"')
339
+ end
340
+
178
341
  path = '/functions/{functionId}/tags/{tagId}'
179
342
  .gsub('{functionId}', function_id)
180
343
  .gsub('{tagId}', tag_id)
181
344
 
182
- params = {
183
- }
345
+ params = {}
184
346
 
185
347
  return @client.call('delete', path, {
186
348
  'content-type' => 'application/json',
@@ -4,8 +4,7 @@ module Appwrite
4
4
  def get()
5
5
  path = '/health'
6
6
 
7
- params = {
8
- }
7
+ params = {}
9
8
 
10
9
  return @client.call('get', path, {
11
10
  'content-type' => 'application/json',
@@ -15,8 +14,7 @@ module Appwrite
15
14
  def get_anti_virus()
16
15
  path = '/health/anti-virus'
17
16
 
18
- params = {
19
- }
17
+ params = {}
20
18
 
21
19
  return @client.call('get', path, {
22
20
  'content-type' => 'application/json',
@@ -26,19 +24,17 @@ module Appwrite
26
24
  def get_cache()
27
25
  path = '/health/cache'
28
26
 
29
- params = {
30
- }
27
+ params = {}
31
28
 
32
29
  return @client.call('get', path, {
33
30
  'content-type' => 'application/json',
34
31
  }, params);
35
32
  end
36
33
 
37
- def get_d_b()
34
+ def get_db()
38
35
  path = '/health/db'
39
36
 
40
- params = {
41
- }
37
+ params = {}
42
38
 
43
39
  return @client.call('get', path, {
44
40
  'content-type' => 'application/json',
@@ -48,8 +44,7 @@ module Appwrite
48
44
  def get_queue_certificates()
49
45
  path = '/health/queue/certificates'
50
46
 
51
- params = {
52
- }
47
+ params = {}
53
48
 
54
49
  return @client.call('get', path, {
55
50
  'content-type' => 'application/json',
@@ -59,8 +54,7 @@ module Appwrite
59
54
  def get_queue_functions()
60
55
  path = '/health/queue/functions'
61
56
 
62
- params = {
63
- }
57
+ params = {}
64
58
 
65
59
  return @client.call('get', path, {
66
60
  'content-type' => 'application/json',
@@ -70,8 +64,7 @@ module Appwrite
70
64
  def get_queue_logs()
71
65
  path = '/health/queue/logs'
72
66
 
73
- params = {
74
- }
67
+ params = {}
75
68
 
76
69
  return @client.call('get', path, {
77
70
  'content-type' => 'application/json',
@@ -81,8 +74,7 @@ module Appwrite
81
74
  def get_queue_tasks()
82
75
  path = '/health/queue/tasks'
83
76
 
84
- params = {
85
- }
77
+ params = {}
86
78
 
87
79
  return @client.call('get', path, {
88
80
  'content-type' => 'application/json',
@@ -92,8 +84,7 @@ module Appwrite
92
84
  def get_queue_usage()
93
85
  path = '/health/queue/usage'
94
86
 
95
- params = {
96
- }
87
+ params = {}
97
88
 
98
89
  return @client.call('get', path, {
99
90
  'content-type' => 'application/json',
@@ -103,8 +94,7 @@ module Appwrite
103
94
  def get_queue_webhooks()
104
95
  path = '/health/queue/webhooks'
105
96
 
106
- params = {
107
- }
97
+ params = {}
108
98
 
109
99
  return @client.call('get', path, {
110
100
  'content-type' => 'application/json',
@@ -114,8 +104,7 @@ module Appwrite
114
104
  def get_storage_local()
115
105
  path = '/health/storage/local'
116
106
 
117
- params = {
118
- }
107
+ params = {}
119
108
 
120
109
  return @client.call('get', path, {
121
110
  'content-type' => 'application/json',
@@ -125,8 +114,7 @@ module Appwrite
125
114
  def get_time()
126
115
  path = '/health/time'
127
116
 
128
- params = {
129
- }
117
+ params = {}
130
118
 
131
119
  return @client.call('get', path, {
132
120
  'content-type' => 'application/json',