appwrite 2.0.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/README.md +74 -6
- data/appwrite.gemspec +2 -2
- data/docs/examples/account/create-recovery.md +15 -0
- data/docs/examples/account/create-verification.md +15 -0
- data/docs/examples/account/delete-session.md +15 -0
- data/docs/examples/account/delete-sessions.md +15 -0
- data/docs/examples/account/delete.md +15 -0
- data/docs/examples/account/get-logs.md +15 -0
- data/docs/examples/account/get-prefs.md +15 -0
- data/docs/examples/account/get-session.md +15 -0
- data/docs/examples/account/get-sessions.md +15 -0
- data/docs/examples/account/get.md +15 -0
- data/docs/examples/account/update-email.md +15 -0
- data/docs/examples/account/update-name.md +15 -0
- data/docs/examples/account/update-password.md +15 -0
- data/docs/examples/account/update-prefs.md +15 -0
- data/docs/examples/account/update-recovery.md +15 -0
- data/docs/examples/account/update-verification.md +15 -0
- data/docs/examples/avatars/get-q-r.md +1 -1
- data/docs/examples/database/create-document.md +1 -1
- data/docs/examples/database/update-collection.md +1 -1
- data/docs/examples/database/update-document.md +1 -1
- data/docs/examples/functions/create.md +1 -1
- data/docs/examples/health/get-d-b.md +1 -1
- data/docs/examples/locale/get-countries-e-u.md +1 -1
- data/docs/examples/storage/create-file.md +1 -1
- data/docs/examples/teams/delete-membership.md +1 -1
- data/docs/examples/teams/update-membership-roles.md +15 -0
- data/docs/examples/teams/update-membership-status.md +15 -0
- data/docs/examples/users/{delete-user.md → delete.md} +1 -1
- data/docs/examples/users/update-status.md +1 -1
- data/docs/examples/users/update-verification.md +15 -0
- data/lib/appwrite.rb +2 -0
- data/lib/appwrite/client.rb +21 -5
- data/lib/appwrite/exception.rb +14 -0
- data/lib/appwrite/services/account.rb +295 -0
- data/lib/appwrite/services/avatars.rb +125 -42
- data/lib/appwrite/services/database.rb +199 -53
- data/lib/appwrite/services/functions.rb +223 -60
- data/lib/appwrite/services/health.rb +13 -25
- data/lib/appwrite/services/locale.rb +8 -15
- data/lib/appwrite/services/storage.rb +127 -33
- data/lib/appwrite/services/teams.rb +187 -38
- data/lib/appwrite/services/users.rb +129 -34
- metadata +24 -3
@@ -1,33 +1,76 @@
|
|
1
1
|
module Appwrite
|
2
2
|
class Functions < Service
|
3
3
|
|
4
|
-
def list(search:
|
4
|
+
def list(search: nil, limit: nil, offset: nil, order_type: nil)
|
5
5
|
path = '/functions'
|
6
6
|
|
7
|
-
params = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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:,
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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:
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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,39 +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:
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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:)
|
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
|
-
|
196
|
+
params = {}
|
197
|
+
|
198
|
+
if !data.nil?
|
199
|
+
params[:data] = data
|
200
|
+
end
|
101
201
|
|
102
202
|
return @client.call('post', path, {
|
103
203
|
'content-type' => 'application/json',
|
@@ -105,12 +205,19 @@ module Appwrite
|
|
105
205
|
end
|
106
206
|
|
107
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
|
+
|
108
216
|
path = '/functions/{functionId}/executions/{executionId}'
|
109
217
|
.gsub('{functionId}', function_id)
|
110
218
|
.gsub('{executionId}', execution_id)
|
111
219
|
|
112
|
-
params = {
|
113
|
-
}
|
220
|
+
params = {}
|
114
221
|
|
115
222
|
return @client.call('get', path, {
|
116
223
|
'content-type' => 'application/json',
|
@@ -118,28 +225,53 @@ module Appwrite
|
|
118
225
|
end
|
119
226
|
|
120
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
|
+
|
121
236
|
path = '/functions/{functionId}/tag'
|
122
237
|
.gsub('{functionId}', function_id)
|
123
238
|
|
124
|
-
params = {
|
125
|
-
|
126
|
-
|
239
|
+
params = {}
|
240
|
+
|
241
|
+
if !tag.nil?
|
242
|
+
params[:tag] = tag
|
243
|
+
end
|
127
244
|
|
128
245
|
return @client.call('patch', path, {
|
129
246
|
'content-type' => 'application/json',
|
130
247
|
}, params);
|
131
248
|
end
|
132
249
|
|
133
|
-
def list_tags(function_id:, search:
|
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
|
+
|
134
255
|
path = '/functions/{functionId}/tags'
|
135
256
|
.gsub('{functionId}', function_id)
|
136
257
|
|
137
|
-
params = {
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
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
|
143
275
|
|
144
276
|
return @client.call('get', path, {
|
145
277
|
'content-type' => 'application/json',
|
@@ -147,13 +279,30 @@ module Appwrite
|
|
147
279
|
end
|
148
280
|
|
149
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
|
+
|
150
294
|
path = '/functions/{functionId}/tags'
|
151
295
|
.gsub('{functionId}', function_id)
|
152
296
|
|
153
|
-
params = {
|
154
|
-
|
155
|
-
|
156
|
-
|
297
|
+
params = {}
|
298
|
+
|
299
|
+
if !command.nil?
|
300
|
+
params[:command] = command
|
301
|
+
end
|
302
|
+
|
303
|
+
if !code.nil?
|
304
|
+
params[:code] = code
|
305
|
+
end
|
157
306
|
|
158
307
|
return @client.call('post', path, {
|
159
308
|
'content-type' => 'multipart/form-data',
|
@@ -161,12 +310,19 @@ module Appwrite
|
|
161
310
|
end
|
162
311
|
|
163
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
|
+
|
164
321
|
path = '/functions/{functionId}/tags/{tagId}'
|
165
322
|
.gsub('{functionId}', function_id)
|
166
323
|
.gsub('{tagId}', tag_id)
|
167
324
|
|
168
|
-
params = {
|
169
|
-
}
|
325
|
+
params = {}
|
170
326
|
|
171
327
|
return @client.call('get', path, {
|
172
328
|
'content-type' => 'application/json',
|
@@ -174,12 +330,19 @@ module Appwrite
|
|
174
330
|
end
|
175
331
|
|
176
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
|
+
|
177
341
|
path = '/functions/{functionId}/tags/{tagId}'
|
178
342
|
.gsub('{functionId}', function_id)
|
179
343
|
.gsub('{tagId}', tag_id)
|
180
344
|
|
181
|
-
params = {
|
182
|
-
}
|
345
|
+
params = {}
|
183
346
|
|
184
347
|
return @client.call('delete', path, {
|
185
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
|
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',
|