appwrite 4.1.0 → 7.0.0.pre.RC1

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +32 -11
  3. data/lib/appwrite/id.rb +11 -0
  4. data/lib/appwrite/input_file.rb +33 -0
  5. data/lib/appwrite/models/account.rb +82 -0
  6. data/lib/appwrite/models/algo_argon2.rb +37 -0
  7. data/lib/appwrite/models/algo_bcrypt.rb +22 -0
  8. data/lib/appwrite/models/algo_md5.rb +22 -0
  9. data/lib/appwrite/models/algo_phpass.rb +22 -0
  10. data/lib/appwrite/models/algo_scrypt.rb +42 -0
  11. data/lib/appwrite/models/algo_scrypt_modified.rb +37 -0
  12. data/lib/appwrite/models/algo_sha.rb +22 -0
  13. data/lib/appwrite/models/attribute_datetime.rb +57 -0
  14. data/lib/appwrite/models/bucket.rb +25 -25
  15. data/lib/appwrite/models/collection.rb +25 -15
  16. data/lib/appwrite/models/database.rb +42 -0
  17. data/lib/appwrite/models/database_list.rb +32 -0
  18. data/lib/appwrite/models/deployment.rb +10 -5
  19. data/lib/appwrite/models/document.rb +15 -10
  20. data/lib/appwrite/models/execution.rb +20 -10
  21. data/lib/appwrite/models/file.rb +15 -15
  22. data/lib/appwrite/models/function.rb +12 -12
  23. data/lib/appwrite/models/index.rb +1 -1
  24. data/lib/appwrite/models/membership.rb +25 -10
  25. data/lib/appwrite/models/session.rb +5 -0
  26. data/lib/appwrite/models/team.rb +10 -5
  27. data/lib/appwrite/models/token.rb +5 -0
  28. data/lib/appwrite/models/user.rb +35 -0
  29. data/lib/appwrite/models/variable.rb +52 -0
  30. data/lib/appwrite/models/variable_list.rb +32 -0
  31. data/lib/appwrite/permission.rb +21 -0
  32. data/lib/appwrite/query.rb +43 -14
  33. data/lib/appwrite/role.rb +31 -0
  34. data/lib/appwrite/services/account.rb +274 -126
  35. data/lib/appwrite/services/avatars.rb +106 -59
  36. data/lib/appwrite/services/databases.rb +1425 -0
  37. data/lib/appwrite/services/functions.rb +381 -176
  38. data/lib/appwrite/services/health.rb +34 -34
  39. data/lib/appwrite/services/locale.rb +25 -7
  40. data/lib/appwrite/services/storage.rb +195 -193
  41. data/lib/appwrite/services/teams.rb +138 -128
  42. data/lib/appwrite/services/users.rb +637 -123
  43. data/lib/appwrite.rb +19 -2
  44. metadata +22 -6
  45. data/lib/appwrite/file.rb +0 -17
  46. data/lib/appwrite/services/database.rb +0 -1049
@@ -3,29 +3,26 @@
3
3
  module Appwrite
4
4
  class Functions < Service
5
5
 
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
6
10
  # Get a list of all the project's functions. You can use the query params to
7
11
  # filter your results.
8
12
  #
9
- # @param [string] search Search term to filter your list results. Max length: 256 chars.
10
- # @param [number] limit Maximum number of functions 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 value to manage pagination. [learn more about pagination](https://appwrite.io/docs/pagination)
12
- # @param [string] cursor ID of the function used as the starting point for the query, excluding the function 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.
13
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, status, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout
14
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
15
15
  #
16
16
  # @return [FunctionList]
17
- def list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
17
+ def list(queries: nil, search: nil)
18
+
18
19
  path = '/functions'
19
20
 
20
21
  params = {
22
+ queries: queries,
21
23
  search: search,
22
- limit: limit,
23
- offset: offset,
24
- cursor: cursor,
25
- cursorDirection: cursor_direction,
26
- orderType: order_type,
27
24
  }
28
-
25
+
29
26
  headers = {
30
27
  "content-type": 'application/json',
31
28
  }
@@ -39,21 +36,37 @@ module Appwrite
39
36
  )
40
37
  end
41
38
 
39
+
42
40
  # Create a new function. You can pass a list of
43
41
  # [permissions](/docs/permissions) to allow different project users or team
44
42
  # with access to execute the function using the client API.
45
43
  #
46
- # @param [string] function_id Function 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.
47
- # @param [string] name Function name. Max length: 128 chars.
48
- # @param [array] execute An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
49
- # @param [string] runtime Execution runtime.
50
- # @param [object] vars Key-value JSON object that will be passed to the function as environment variables.
51
- # @param [array] events Events list.
52
- # @param [string] schedule Schedule CRON syntax.
53
- # @param [number] timeout Function maximum execution time in seconds.
44
+ # @param [String] function_id Function 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] name Function name. Max length: 128 chars.
46
+ # @param [Array] execute An array of strings with execution roles. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 64 characters long.
47
+ # @param [String] runtime Execution runtime.
48
+ # @param [Array] events Events list. Maximum of 100 events are allowed.
49
+ # @param [String] schedule Schedule CRON syntax.
50
+ # @param [Integer] timeout Function maximum execution time in seconds.
54
51
  #
55
52
  # @return [Function]
56
- def create(function_id:, name:, execute:, runtime:, vars: nil, events: nil, schedule: nil, timeout: nil)
53
+ def create(function_id:, name:, execute:, runtime:, events: nil, schedule: nil, timeout: nil)
54
+
55
+ path = '/functions'
56
+
57
+ params = {
58
+ functionId: function_id,
59
+ name: name,
60
+ execute: execute,
61
+ runtime: runtime,
62
+ events: events,
63
+ schedule: schedule,
64
+ timeout: timeout,
65
+ }
66
+
67
+ headers = {
68
+ "content-type": 'application/json',
69
+ }
57
70
  if function_id.nil?
58
71
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
59
72
  end
@@ -70,22 +83,6 @@ module Appwrite
70
83
  raise Appwrite::Exception.new('Missing required parameter: "runtime"')
71
84
  end
72
85
 
73
- path = '/functions'
74
-
75
- params = {
76
- functionId: function_id,
77
- name: name,
78
- execute: execute,
79
- runtime: runtime,
80
- vars: vars,
81
- events: events,
82
- schedule: schedule,
83
- timeout: timeout,
84
- }
85
-
86
- headers = {
87
- "content-type": 'application/json',
88
- }
89
86
 
90
87
  @client.call(
91
88
  method: 'POST',
@@ -96,16 +93,18 @@ module Appwrite
96
93
  )
97
94
  end
98
95
 
96
+
99
97
  # Get a list of all runtimes that are currently active on your instance.
100
98
  #
101
99
  #
102
100
  # @return [RuntimeList]
103
101
  def list_runtimes()
102
+
104
103
  path = '/functions/runtimes'
105
104
 
106
105
  params = {
107
106
  }
108
-
107
+
109
108
  headers = {
110
109
  "content-type": 'application/json',
111
110
  }
@@ -119,25 +118,27 @@ module Appwrite
119
118
  )
120
119
  end
121
120
 
121
+
122
122
  # Get a function by its unique ID.
123
123
  #
124
- # @param [string] function_id Function ID.
124
+ # @param [String] function_id Function ID.
125
125
  #
126
126
  # @return [Function]
127
127
  def get(function_id:)
128
- if function_id.nil?
129
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
130
- end
131
128
 
132
129
  path = '/functions/{functionId}'
133
- .gsub('{functionId}', function_id)
134
130
 
135
131
  params = {
136
132
  }
137
-
133
+
138
134
  headers = {
139
135
  "content-type": 'application/json',
140
136
  }
137
+ if function_id.nil?
138
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
139
+ end
140
+
141
+ .gsub('{functionId}', function_id)
141
142
 
142
143
  @client.call(
143
144
  method: 'GET',
@@ -148,45 +149,45 @@ module Appwrite
148
149
  )
149
150
  end
150
151
 
152
+
151
153
  # Update function by its unique ID.
152
154
  #
153
- # @param [string] function_id Function ID.
154
- # @param [string] name Function name. Max length: 128 chars.
155
- # @param [array] execute An array of strings with execution permissions. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions) and get a full list of available permissions.
156
- # @param [object] vars Key-value JSON object that will be passed to the function as environment variables.
157
- # @param [array] events Events list.
158
- # @param [string] schedule Schedule CRON syntax.
159
- # @param [number] timeout Maximum execution time in seconds.
155
+ # @param [String] function_id Function ID.
156
+ # @param [String] name Function name. Max length: 128 chars.
157
+ # @param [Array] execute An array of strings with execution roles. By default no user is granted with any execute permissions. [learn more about permissions](https://appwrite.io/docs/permissions). Maximum of 100 roles are allowed, each 64 characters long.
158
+ # @param [Array] events Events list. Maximum of 100 events are allowed.
159
+ # @param [String] schedule Schedule CRON syntax.
160
+ # @param [Integer] timeout Maximum execution time in seconds.
160
161
  #
161
162
  # @return [Function]
162
- def update(function_id:, name:, execute:, vars: nil, events: nil, schedule: nil, timeout: nil)
163
- if function_id.nil?
164
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
165
- end
166
-
167
- if name.nil?
168
- raise Appwrite::Exception.new('Missing required parameter: "name"')
169
- end
170
-
171
- if execute.nil?
172
- raise Appwrite::Exception.new('Missing required parameter: "execute"')
173
- end
163
+ def update(function_id:, name:, execute:, events: nil, schedule: nil, timeout: nil)
174
164
 
175
165
  path = '/functions/{functionId}'
176
- .gsub('{functionId}', function_id)
177
166
 
178
167
  params = {
179
168
  name: name,
180
169
  execute: execute,
181
- vars: vars,
182
170
  events: events,
183
171
  schedule: schedule,
184
172
  timeout: timeout,
185
173
  }
186
-
174
+
187
175
  headers = {
188
176
  "content-type": 'application/json',
189
177
  }
178
+ if function_id.nil?
179
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
180
+ end
181
+
182
+ if name.nil?
183
+ raise Appwrite::Exception.new('Missing required parameter: "name"')
184
+ end
185
+
186
+ if execute.nil?
187
+ raise Appwrite::Exception.new('Missing required parameter: "execute"')
188
+ end
189
+
190
+ .gsub('{functionId}', function_id)
190
191
 
191
192
  @client.call(
192
193
  method: 'PUT',
@@ -197,25 +198,27 @@ module Appwrite
197
198
  )
198
199
  end
199
200
 
201
+
200
202
  # Delete a function by its unique ID.
201
203
  #
202
- # @param [string] function_id Function ID.
204
+ # @param [String] function_id Function ID.
203
205
  #
204
206
  # @return []
205
207
  def delete(function_id:)
206
- if function_id.nil?
207
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
208
- end
209
208
 
210
209
  path = '/functions/{functionId}'
211
- .gsub('{functionId}', function_id)
212
210
 
213
211
  params = {
214
212
  }
215
-
213
+
216
214
  headers = {
217
215
  "content-type": 'application/json',
218
216
  }
217
+ if function_id.nil?
218
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
219
+ end
220
+
221
+ .gsub('{functionId}', function_id)
219
222
 
220
223
  @client.call(
221
224
  method: 'DELETE',
@@ -225,38 +228,32 @@ module Appwrite
225
228
  )
226
229
  end
227
230
 
231
+
228
232
  # Get a list of all the project's code deployments. You can use the query
229
233
  # params to filter your results.
230
234
  #
231
- # @param [string] function_id Function ID.
232
- # @param [string] search Search term to filter your list results. Max length: 256 chars.
233
- # @param [number] limit Maximum number of deployments to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
234
- # @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)
235
- # @param [string] cursor ID of the deployment used as the starting point for the query, excluding the deployment itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
236
- # @param [string] cursor_direction Direction of the cursor.
237
- # @param [string] order_type Order result by ASC or DESC order.
235
+ # @param [String] function_id Function ID.
236
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: entrypoint, size, buildId, activate
237
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
238
238
  #
239
239
  # @return [DeploymentList]
240
- def list_deployments(function_id:, search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
241
- if function_id.nil?
242
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
243
- end
240
+ def list_deployments(function_id:, queries: nil, search: nil)
244
241
 
245
242
  path = '/functions/{functionId}/deployments'
246
- .gsub('{functionId}', function_id)
247
243
 
248
244
  params = {
245
+ queries: queries,
249
246
  search: search,
250
- limit: limit,
251
- offset: offset,
252
- cursor: cursor,
253
- cursorDirection: cursor_direction,
254
- orderType: order_type,
255
247
  }
256
-
248
+
257
249
  headers = {
258
250
  "content-type": 'application/json',
259
251
  }
252
+ if function_id.nil?
253
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
254
+ end
255
+
256
+ .gsub('{functionId}', function_id)
260
257
 
261
258
  @client.call(
262
259
  method: 'GET',
@@ -267,6 +264,7 @@ module Appwrite
267
264
  )
268
265
  end
269
266
 
267
+
270
268
  # Create a new function code deployment. Use this endpoint to upload a new
271
269
  # version of your code function. To execute your newly uploaded code, you'll
272
270
  # need to update the function's deployment to use your new deployment UID.
@@ -278,13 +276,25 @@ module Appwrite
278
276
  #
279
277
  # Use the "command" param to set the entry point used to execute your code.
280
278
  #
281
- # @param [string] function_id Function ID.
282
- # @param [string] entrypoint Entrypoint File.
279
+ # @param [String] function_id Function ID.
280
+ # @param [String] entrypoint Entrypoint File.
283
281
  # @param [file] code Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.
284
- # @param [boolean] activate Automatically activate the deployment when it is finished building.
282
+ # @param [] activate Automatically activate the deployment when it is finished building.
285
283
  #
286
284
  # @return [Deployment]
287
285
  def create_deployment(function_id:, entrypoint:, code:, activate:, on_progress: nil)
286
+
287
+ path = '/functions/{functionId}/deployments'
288
+
289
+ params = {
290
+ entrypoint: entrypoint,
291
+ code: code,
292
+ activate: activate,
293
+ }
294
+
295
+ headers = {
296
+ "content-type": 'multipart/form-data',
297
+ }
288
298
  if function_id.nil?
289
299
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
290
300
  end
@@ -301,19 +311,8 @@ module Appwrite
301
311
  raise Appwrite::Exception.new('Missing required parameter: "activate"')
302
312
  end
303
313
 
304
- path = '/functions/{functionId}/deployments'
305
314
  .gsub('{functionId}', function_id)
306
315
 
307
- params = {
308
- entrypoint: entrypoint,
309
- code: code,
310
- activate: activate,
311
- }
312
-
313
- headers = {
314
- "content-type": 'multipart/form-data',
315
- }
316
-
317
316
  id_param_name = nil
318
317
  param_name = 'code'
319
318
 
@@ -328,13 +327,23 @@ module Appwrite
328
327
  )
329
328
  end
330
329
 
330
+
331
331
  # Get a code deployment by its unique ID.
332
332
  #
333
- # @param [string] function_id Function ID.
334
- # @param [string] deployment_id Deployment ID.
333
+ # @param [String] function_id Function ID.
334
+ # @param [String] deployment_id Deployment ID.
335
335
  #
336
- # @return [DeploymentList]
336
+ # @return [Deployment]
337
337
  def get_deployment(function_id:, deployment_id:)
338
+
339
+ path = '/functions/{functionId}/deployments/{deploymentId}'
340
+
341
+ params = {
342
+ }
343
+
344
+ headers = {
345
+ "content-type": 'application/json',
346
+ }
338
347
  if function_id.nil?
339
348
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
340
349
  end
@@ -343,35 +352,37 @@ module Appwrite
343
352
  raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
344
353
  end
345
354
 
346
- path = '/functions/{functionId}/deployments/{deploymentId}'
347
355
  .gsub('{functionId}', function_id)
348
356
  .gsub('{deploymentId}', deployment_id)
349
357
 
350
- params = {
351
- }
352
-
353
- headers = {
354
- "content-type": 'application/json',
355
- }
356
-
357
358
  @client.call(
358
359
  method: 'GET',
359
360
  path: path,
360
361
  headers: headers,
361
362
  params: params,
362
- response_type: Models::DeploymentList
363
+ response_type: Models::Deployment
363
364
  )
364
365
  end
365
366
 
367
+
366
368
  # Update the function code deployment ID using the unique function ID. Use
367
369
  # this endpoint to switch the code deployment that should be executed by the
368
370
  # execution endpoint.
369
371
  #
370
- # @param [string] function_id Function ID.
371
- # @param [string] deployment_id Deployment ID.
372
+ # @param [String] function_id Function ID.
373
+ # @param [String] deployment_id Deployment ID.
372
374
  #
373
375
  # @return [Function]
374
376
  def update_deployment(function_id:, deployment_id:)
377
+
378
+ path = '/functions/{functionId}/deployments/{deploymentId}'
379
+
380
+ params = {
381
+ }
382
+
383
+ headers = {
384
+ "content-type": 'application/json',
385
+ }
375
386
  if function_id.nil?
376
387
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
377
388
  end
@@ -380,17 +391,9 @@ module Appwrite
380
391
  raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
381
392
  end
382
393
 
383
- path = '/functions/{functionId}/deployments/{deploymentId}'
384
394
  .gsub('{functionId}', function_id)
385
395
  .gsub('{deploymentId}', deployment_id)
386
396
 
387
- params = {
388
- }
389
-
390
- headers = {
391
- "content-type": 'application/json',
392
- }
393
-
394
397
  @client.call(
395
398
  method: 'PATCH',
396
399
  path: path,
@@ -400,13 +403,23 @@ module Appwrite
400
403
  )
401
404
  end
402
405
 
406
+
403
407
  # Delete a code deployment by its unique ID.
404
408
  #
405
- # @param [string] function_id Function ID.
406
- # @param [string] deployment_id Deployment ID.
409
+ # @param [String] function_id Function ID.
410
+ # @param [String] deployment_id Deployment ID.
407
411
  #
408
412
  # @return []
409
413
  def delete_deployment(function_id:, deployment_id:)
414
+
415
+ path = '/functions/{functionId}/deployments/{deploymentId}'
416
+
417
+ params = {
418
+ }
419
+
420
+ headers = {
421
+ "content-type": 'application/json',
422
+ }
410
423
  if function_id.nil?
411
424
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
412
425
  end
@@ -415,17 +428,9 @@ module Appwrite
415
428
  raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
416
429
  end
417
430
 
418
- path = '/functions/{functionId}/deployments/{deploymentId}'
419
431
  .gsub('{functionId}', function_id)
420
432
  .gsub('{deploymentId}', deployment_id)
421
433
 
422
- params = {
423
- }
424
-
425
- headers = {
426
- "content-type": 'application/json',
427
- }
428
-
429
434
  @client.call(
430
435
  method: 'DELETE',
431
436
  path: path,
@@ -434,14 +439,24 @@ module Appwrite
434
439
  )
435
440
  end
436
441
 
442
+
437
443
  #
438
444
  #
439
- # @param [string] function_id Function ID.
440
- # @param [string] deployment_id Deployment ID.
441
- # @param [string] build_id Build unique ID.
445
+ # @param [String] function_id Function ID.
446
+ # @param [String] deployment_id Deployment ID.
447
+ # @param [String] build_id Build unique ID.
442
448
  #
443
449
  # @return []
444
450
  def retry_build(function_id:, deployment_id:, build_id:)
451
+
452
+ path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'
453
+
454
+ params = {
455
+ }
456
+
457
+ headers = {
458
+ "content-type": 'application/json',
459
+ }
445
460
  if function_id.nil?
446
461
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
447
462
  end
@@ -454,18 +469,10 @@ module Appwrite
454
469
  raise Appwrite::Exception.new('Missing required parameter: "buildId"')
455
470
  end
456
471
 
457
- path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'
458
472
  .gsub('{functionId}', function_id)
459
473
  .gsub('{deploymentId}', deployment_id)
460
474
  .gsub('{buildId}', build_id)
461
475
 
462
- params = {
463
- }
464
-
465
- headers = {
466
- "content-type": 'application/json',
467
- }
468
-
469
476
  @client.call(
470
477
  method: 'POST',
471
478
  path: path,
@@ -474,38 +481,34 @@ module Appwrite
474
481
  )
475
482
  end
476
483
 
484
+
477
485
  # Get a list of all the current user function execution logs. You can use the
478
486
  # query params to filter your results. On admin mode, this endpoint will
479
487
  # return a list of all of the project's executions. [Learn more about
480
488
  # different API modes](/docs/admin).
481
489
  #
482
- # @param [string] function_id Function ID.
483
- # @param [number] limit Maximum number of executions to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
484
- # @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)
485
- # @param [string] search Search term to filter your list results. Max length: 256 chars.
486
- # @param [string] cursor ID of the execution used as the starting point for the query, excluding the execution itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
487
- # @param [string] cursor_direction Direction of the cursor.
490
+ # @param [String] function_id Function ID.
491
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, statusCode, time
492
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
488
493
  #
489
494
  # @return [ExecutionList]
490
- def list_executions(function_id:, limit: nil, offset: nil, search: nil, cursor: nil, cursor_direction: nil)
491
- if function_id.nil?
492
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
493
- end
495
+ def list_executions(function_id:, queries: nil, search: nil)
494
496
 
495
497
  path = '/functions/{functionId}/executions'
496
- .gsub('{functionId}', function_id)
497
498
 
498
499
  params = {
499
- limit: limit,
500
- offset: offset,
500
+ queries: queries,
501
501
  search: search,
502
- cursor: cursor,
503
- cursorDirection: cursor_direction,
504
502
  }
505
-
503
+
506
504
  headers = {
507
505
  "content-type": 'application/json',
508
506
  }
507
+ if function_id.nil?
508
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
509
+ end
510
+
511
+ .gsub('{functionId}', function_id)
509
512
 
510
513
  @client.call(
511
514
  method: 'GET',
@@ -516,32 +519,34 @@ module Appwrite
516
519
  )
517
520
  end
518
521
 
522
+
519
523
  # Trigger a function execution. The returned object will return you the
520
524
  # current execution status. You can ping the `Get Execution` endpoint to get
521
525
  # updates on the current execution status. Once this endpoint is called, your
522
526
  # function execution process will start asynchronously.
523
527
  #
524
- # @param [string] function_id Function ID.
525
- # @param [string] data String of custom data to send to function.
526
- # @param [boolean] async Execute code asynchronously. Default value is true.
528
+ # @param [String] function_id Function ID.
529
+ # @param [String] data String of custom data to send to function.
530
+ # @param [] async Execute code asynchronously. Default value is true.
527
531
  #
528
532
  # @return [Execution]
529
533
  def create_execution(function_id:, data: nil, async: nil)
530
- if function_id.nil?
531
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
532
- end
533
534
 
534
535
  path = '/functions/{functionId}/executions'
535
- .gsub('{functionId}', function_id)
536
536
 
537
537
  params = {
538
538
  data: data,
539
539
  async: async,
540
540
  }
541
-
541
+
542
542
  headers = {
543
543
  "content-type": 'application/json',
544
544
  }
545
+ if function_id.nil?
546
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
547
+ end
548
+
549
+ .gsub('{functionId}', function_id)
545
550
 
546
551
  @client.call(
547
552
  method: 'POST',
@@ -552,13 +557,23 @@ module Appwrite
552
557
  )
553
558
  end
554
559
 
560
+
555
561
  # Get a function execution log by its unique ID.
556
562
  #
557
- # @param [string] function_id Function ID.
558
- # @param [string] execution_id Execution ID.
563
+ # @param [String] function_id Function ID.
564
+ # @param [String] execution_id Execution ID.
559
565
  #
560
566
  # @return [Execution]
561
567
  def get_execution(function_id:, execution_id:)
568
+
569
+ path = '/functions/{functionId}/executions/{executionId}'
570
+
571
+ params = {
572
+ }
573
+
574
+ headers = {
575
+ "content-type": 'application/json',
576
+ }
562
577
  if function_id.nil?
563
578
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
564
579
  end
@@ -567,25 +582,215 @@ module Appwrite
567
582
  raise Appwrite::Exception.new('Missing required parameter: "executionId"')
568
583
  end
569
584
 
570
- path = '/functions/{functionId}/executions/{executionId}'
571
585
  .gsub('{functionId}', function_id)
572
586
  .gsub('{executionId}', execution_id)
573
587
 
588
+ @client.call(
589
+ method: 'GET',
590
+ path: path,
591
+ headers: headers,
592
+ params: params,
593
+ response_type: Models::Execution
594
+ )
595
+ end
596
+
597
+
598
+ # Get a list of all variables of a specific function.
599
+ #
600
+ # @param [String] function_id Function unique ID.
601
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/databases#querying-documents). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: key
602
+ # @param [String] search Search term to filter your list results. Max length: 256 chars.
603
+ #
604
+ # @return [VariableList]
605
+ def list_variables(function_id:, queries: nil, search: nil)
606
+
607
+ path = '/functions/{functionId}/variables'
608
+
574
609
  params = {
610
+ queries: queries,
611
+ search: search,
612
+ }
613
+
614
+ headers = {
615
+ "content-type": 'application/json',
575
616
  }
617
+ if function_id.nil?
618
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
619
+ end
576
620
 
621
+ .gsub('{functionId}', function_id)
622
+
623
+ @client.call(
624
+ method: 'GET',
625
+ path: path,
626
+ headers: headers,
627
+ params: params,
628
+ response_type: Models::VariableList
629
+ )
630
+ end
631
+
632
+
633
+ # Create a new function variable. These variables can be accessed within
634
+ # function in the `env` object under the request variable.
635
+ #
636
+ # @param [String] function_id Function unique ID.
637
+ # @param [String] key Variable key. Max length: 255 chars.
638
+ # @param [String] value Variable value. Max length: 8192 chars.
639
+ #
640
+ # @return [Variable]
641
+ def create_variable(function_id:, key:, value:)
642
+
643
+ path = '/functions/{functionId}/variables'
644
+
645
+ params = {
646
+ key: key,
647
+ value: value,
648
+ }
649
+
577
650
  headers = {
578
651
  "content-type": 'application/json',
579
652
  }
653
+ if function_id.nil?
654
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
655
+ end
656
+
657
+ if key.nil?
658
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
659
+ end
660
+
661
+ if value.nil?
662
+ raise Appwrite::Exception.new('Missing required parameter: "value"')
663
+ end
664
+
665
+ .gsub('{functionId}', function_id)
666
+
667
+ @client.call(
668
+ method: 'POST',
669
+ path: path,
670
+ headers: headers,
671
+ params: params,
672
+ response_type: Models::Variable
673
+ )
674
+ end
675
+
676
+
677
+ # Get a variable by its unique ID.
678
+ #
679
+ # @param [String] function_id Function unique ID.
680
+ # @param [String] variable_id Variable unique ID.
681
+ #
682
+ # @return [Variable]
683
+ def get_variable(function_id:, variable_id:)
684
+
685
+ path = '/functions/{functionId}/variables/{variableId}'
686
+
687
+ params = {
688
+ }
689
+
690
+ headers = {
691
+ "content-type": 'application/json',
692
+ }
693
+ if function_id.nil?
694
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
695
+ end
696
+
697
+ if variable_id.nil?
698
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
699
+ end
700
+
701
+ .gsub('{functionId}', function_id)
702
+ .gsub('{variableId}', variable_id)
580
703
 
581
704
  @client.call(
582
705
  method: 'GET',
583
706
  path: path,
584
707
  headers: headers,
585
708
  params: params,
586
- response_type: Models::Execution
709
+ response_type: Models::Variable
710
+ )
711
+ end
712
+
713
+
714
+ # Update variable by its unique ID.
715
+ #
716
+ # @param [String] function_id Function unique ID.
717
+ # @param [String] variable_id Variable unique ID.
718
+ # @param [String] key Variable key. Max length: 255 chars.
719
+ # @param [String] value Variable value. Max length: 8192 chars.
720
+ #
721
+ # @return [Variable]
722
+ def update_variable(function_id:, variable_id:, key:, value: nil)
723
+
724
+ path = '/functions/{functionId}/variables/{variableId}'
725
+
726
+ params = {
727
+ key: key,
728
+ value: value,
729
+ }
730
+
731
+ headers = {
732
+ "content-type": 'application/json',
733
+ }
734
+ if function_id.nil?
735
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
736
+ end
737
+
738
+ if variable_id.nil?
739
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
740
+ end
741
+
742
+ if key.nil?
743
+ raise Appwrite::Exception.new('Missing required parameter: "key"')
744
+ end
745
+
746
+ .gsub('{functionId}', function_id)
747
+ .gsub('{variableId}', variable_id)
748
+
749
+ @client.call(
750
+ method: 'PUT',
751
+ path: path,
752
+ headers: headers,
753
+ params: params,
754
+ response_type: Models::Variable
755
+ )
756
+ end
757
+
758
+
759
+ # Delete a variable by its unique ID.
760
+ #
761
+ # @param [String] function_id Function unique ID.
762
+ # @param [String] variable_id Variable unique ID.
763
+ #
764
+ # @return []
765
+ def delete_variable(function_id:, variable_id:)
766
+
767
+ path = '/functions/{functionId}/variables/{variableId}'
768
+
769
+ params = {
770
+ }
771
+
772
+ headers = {
773
+ "content-type": 'application/json',
774
+ }
775
+ if function_id.nil?
776
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
777
+ end
778
+
779
+ if variable_id.nil?
780
+ raise Appwrite::Exception.new('Missing required parameter: "variableId"')
781
+ end
782
+
783
+ .gsub('{functionId}', function_id)
784
+ .gsub('{variableId}', variable_id)
785
+
786
+ @client.call(
787
+ method: 'DELETE',
788
+ path: path,
789
+ headers: headers,
790
+ params: params,
587
791
  )
588
792
  end
589
793
 
794
+
590
795
  end
591
796
  end