appwrite 6.0.0 → 7.0.0.pre.RC1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +5 -2
  3. data/lib/appwrite/id.rb +11 -0
  4. data/lib/appwrite/models/account.rb +82 -0
  5. data/lib/appwrite/models/algo_argon2.rb +37 -0
  6. data/lib/appwrite/models/algo_bcrypt.rb +22 -0
  7. data/lib/appwrite/models/algo_md5.rb +22 -0
  8. data/lib/appwrite/models/algo_phpass.rb +22 -0
  9. data/lib/appwrite/models/algo_scrypt.rb +42 -0
  10. data/lib/appwrite/models/algo_scrypt_modified.rb +37 -0
  11. data/lib/appwrite/models/algo_sha.rb +22 -0
  12. data/lib/appwrite/models/attribute_datetime.rb +57 -0
  13. data/lib/appwrite/models/bucket.rb +15 -15
  14. data/lib/appwrite/models/collection.rb +10 -15
  15. data/lib/appwrite/models/database.rb +13 -3
  16. data/lib/appwrite/models/document.rb +5 -10
  17. data/lib/appwrite/models/execution.rb +10 -5
  18. data/lib/appwrite/models/file.rb +5 -10
  19. data/lib/appwrite/models/function.rb +2 -2
  20. data/lib/appwrite/models/index.rb +1 -1
  21. data/lib/appwrite/models/user.rb +15 -0
  22. data/lib/appwrite/models/variable.rb +52 -0
  23. data/lib/appwrite/models/variable_list.rb +32 -0
  24. data/lib/appwrite/permission.rb +21 -0
  25. data/lib/appwrite/query.rb +43 -14
  26. data/lib/appwrite/role.rb +31 -0
  27. data/lib/appwrite/services/account.rb +184 -143
  28. data/lib/appwrite/services/avatars.rb +72 -56
  29. data/lib/appwrite/services/databases.rb +638 -552
  30. data/lib/appwrite/services/functions.rb +380 -176
  31. data/lib/appwrite/services/health.rb +33 -10
  32. data/lib/appwrite/services/locale.rb +24 -7
  33. data/lib/appwrite/services/storage.rb +194 -193
  34. data/lib/appwrite/services/teams.rb +137 -128
  35. data/lib/appwrite/services/users.rb +572 -163
  36. data/lib/appwrite.rb +15 -0
  37. metadata +18 -4
@@ -3,30 +3,26 @@
3
3
  module Appwrite
4
4
  class Functions < Service
5
5
 
6
+ def initialize(client)
7
+ @client = client
8
+ end
6
9
 
7
10
  # Get a list of all the project's functions. You can use the query params to
8
11
  # filter your results.
9
12
  #
10
- # @param [string] search Search term to filter your list results. Max length: 256 chars.
11
- # @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.
12
- # @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)
13
- # @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)
14
- # @param [string] cursor_direction Direction of the cursor, can be either &#039;before&#039; or &#039;after&#039;.
15
- # @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.
16
15
  #
17
16
  # @return [FunctionList]
18
- def list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
17
+ def list(queries: nil, search: nil)
18
+
19
19
  path = '/functions'
20
20
 
21
21
  params = {
22
+ queries: queries,
22
23
  search: search,
23
- limit: limit,
24
- offset: offset,
25
- cursor: cursor,
26
- cursorDirection: cursor_direction,
27
- orderType: order_type,
28
24
  }
29
-
25
+
30
26
  headers = {
31
27
  "content-type": 'application/json',
32
28
  }
@@ -40,21 +36,37 @@ module Appwrite
40
36
  )
41
37
  end
42
38
 
39
+
43
40
  # Create a new function. You can pass a list of
44
41
  # [permissions](/docs/permissions) to allow different project users or team
45
42
  # with access to execute the function using the client API.
46
43
  #
47
- # @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.
48
- # @param [string] name Function name. Max length: 128 chars.
49
- # @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. Maximum of 100 scopes are allowed, each 64 characters long.
50
- # @param [string] runtime Execution runtime.
51
- # @param [object] vars Key-value JSON object that will be passed to the function as environment variables.
52
- # @param [array] events Events list. Maximum of 100 events are allowed.
53
- # @param [string] schedule Schedule CRON syntax.
54
- # @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.
55
51
  #
56
52
  # @return [Function]
57
- 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
+ }
58
70
  if function_id.nil?
59
71
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
60
72
  end
@@ -71,22 +83,6 @@ module Appwrite
71
83
  raise Appwrite::Exception.new('Missing required parameter: "runtime"')
72
84
  end
73
85
 
74
- path = '/functions'
75
-
76
- params = {
77
- functionId: function_id,
78
- name: name,
79
- execute: execute,
80
- runtime: runtime,
81
- vars: vars,
82
- events: events,
83
- schedule: schedule,
84
- timeout: timeout,
85
- }
86
-
87
- headers = {
88
- "content-type": 'application/json',
89
- }
90
86
 
91
87
  @client.call(
92
88
  method: 'POST',
@@ -97,16 +93,18 @@ module Appwrite
97
93
  )
98
94
  end
99
95
 
96
+
100
97
  # Get a list of all runtimes that are currently active on your instance.
101
98
  #
102
99
  #
103
100
  # @return [RuntimeList]
104
101
  def list_runtimes()
102
+
105
103
  path = '/functions/runtimes'
106
104
 
107
105
  params = {
108
106
  }
109
-
107
+
110
108
  headers = {
111
109
  "content-type": 'application/json',
112
110
  }
@@ -120,25 +118,27 @@ module Appwrite
120
118
  )
121
119
  end
122
120
 
121
+
123
122
  # Get a function by its unique ID.
124
123
  #
125
- # @param [string] function_id Function ID.
124
+ # @param [String] function_id Function ID.
126
125
  #
127
126
  # @return [Function]
128
127
  def get(function_id:)
129
- if function_id.nil?
130
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
131
- end
132
128
 
133
129
  path = '/functions/{functionId}'
134
- .gsub('{functionId}', function_id)
135
130
 
136
131
  params = {
137
132
  }
138
-
133
+
139
134
  headers = {
140
135
  "content-type": 'application/json',
141
136
  }
137
+ if function_id.nil?
138
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
139
+ end
140
+
141
+ .gsub('{functionId}', function_id)
142
142
 
143
143
  @client.call(
144
144
  method: 'GET',
@@ -149,45 +149,45 @@ module Appwrite
149
149
  )
150
150
  end
151
151
 
152
+
152
153
  # Update function by its unique ID.
153
154
  #
154
- # @param [string] function_id Function ID.
155
- # @param [string] name Function name. Max length: 128 chars.
156
- # @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. Maximum of 100 scopes are allowed, each 64 characters long.
157
- # @param [object] vars Key-value JSON object that will be passed to the function as environment variables.
158
- # @param [array] events Events list. Maximum of 100 events are allowed.
159
- # @param [string] schedule Schedule CRON syntax.
160
- # @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.
161
161
  #
162
162
  # @return [Function]
163
- def update(function_id:, name:, execute:, vars: nil, events: nil, schedule: nil, timeout: nil)
164
- if function_id.nil?
165
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
166
- end
167
-
168
- if name.nil?
169
- raise Appwrite::Exception.new('Missing required parameter: "name"')
170
- end
171
-
172
- if execute.nil?
173
- raise Appwrite::Exception.new('Missing required parameter: "execute"')
174
- end
163
+ def update(function_id:, name:, execute:, events: nil, schedule: nil, timeout: nil)
175
164
 
176
165
  path = '/functions/{functionId}'
177
- .gsub('{functionId}', function_id)
178
166
 
179
167
  params = {
180
168
  name: name,
181
169
  execute: execute,
182
- vars: vars,
183
170
  events: events,
184
171
  schedule: schedule,
185
172
  timeout: timeout,
186
173
  }
187
-
174
+
188
175
  headers = {
189
176
  "content-type": 'application/json',
190
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)
191
191
 
192
192
  @client.call(
193
193
  method: 'PUT',
@@ -198,25 +198,27 @@ module Appwrite
198
198
  )
199
199
  end
200
200
 
201
+
201
202
  # Delete a function by its unique ID.
202
203
  #
203
- # @param [string] function_id Function ID.
204
+ # @param [String] function_id Function ID.
204
205
  #
205
206
  # @return []
206
207
  def delete(function_id:)
207
- if function_id.nil?
208
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
209
- end
210
208
 
211
209
  path = '/functions/{functionId}'
212
- .gsub('{functionId}', function_id)
213
210
 
214
211
  params = {
215
212
  }
216
-
213
+
217
214
  headers = {
218
215
  "content-type": 'application/json',
219
216
  }
217
+ if function_id.nil?
218
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
219
+ end
220
+
221
+ .gsub('{functionId}', function_id)
220
222
 
221
223
  @client.call(
222
224
  method: 'DELETE',
@@ -226,38 +228,32 @@ module Appwrite
226
228
  )
227
229
  end
228
230
 
231
+
229
232
  # Get a list of all the project's code deployments. You can use the query
230
233
  # params to filter your results.
231
234
  #
232
- # @param [string] function_id Function ID.
233
- # @param [string] search Search term to filter your list results. Max length: 256 chars.
234
- # @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.
235
- # @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)
236
- # @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)
237
- # @param [string] cursor_direction Direction of the cursor, can be either &#039;before&#039; or &#039;after&#039;.
238
- # @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.
239
238
  #
240
239
  # @return [DeploymentList]
241
- def list_deployments(function_id:, search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
242
- if function_id.nil?
243
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
244
- end
240
+ def list_deployments(function_id:, queries: nil, search: nil)
245
241
 
246
242
  path = '/functions/{functionId}/deployments'
247
- .gsub('{functionId}', function_id)
248
243
 
249
244
  params = {
245
+ queries: queries,
250
246
  search: search,
251
- limit: limit,
252
- offset: offset,
253
- cursor: cursor,
254
- cursorDirection: cursor_direction,
255
- orderType: order_type,
256
247
  }
257
-
248
+
258
249
  headers = {
259
250
  "content-type": 'application/json',
260
251
  }
252
+ if function_id.nil?
253
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
254
+ end
255
+
256
+ .gsub('{functionId}', function_id)
261
257
 
262
258
  @client.call(
263
259
  method: 'GET',
@@ -268,6 +264,7 @@ module Appwrite
268
264
  )
269
265
  end
270
266
 
267
+
271
268
  # Create a new function code deployment. Use this endpoint to upload a new
272
269
  # version of your code function. To execute your newly uploaded code, you'll
273
270
  # need to update the function's deployment to use your new deployment UID.
@@ -279,13 +276,25 @@ module Appwrite
279
276
  #
280
277
  # Use the "command" param to set the entry point used to execute your code.
281
278
  #
282
- # @param [string] function_id Function ID.
283
- # @param [string] entrypoint Entrypoint File.
279
+ # @param [String] function_id Function ID.
280
+ # @param [String] entrypoint Entrypoint File.
284
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.
285
- # @param [boolean] activate Automatically activate the deployment when it is finished building.
282
+ # @param [] activate Automatically activate the deployment when it is finished building.
286
283
  #
287
284
  # @return [Deployment]
288
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
+ }
289
298
  if function_id.nil?
290
299
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
291
300
  end
@@ -302,19 +311,8 @@ module Appwrite
302
311
  raise Appwrite::Exception.new('Missing required parameter: "activate"')
303
312
  end
304
313
 
305
- path = '/functions/{functionId}/deployments'
306
314
  .gsub('{functionId}', function_id)
307
315
 
308
- params = {
309
- entrypoint: entrypoint,
310
- code: code,
311
- activate: activate,
312
- }
313
-
314
- headers = {
315
- "content-type": 'multipart/form-data',
316
- }
317
-
318
316
  id_param_name = nil
319
317
  param_name = 'code'
320
318
 
@@ -329,13 +327,23 @@ module Appwrite
329
327
  )
330
328
  end
331
329
 
330
+
332
331
  # Get a code deployment by its unique ID.
333
332
  #
334
- # @param [string] function_id Function ID.
335
- # @param [string] deployment_id Deployment ID.
333
+ # @param [String] function_id Function ID.
334
+ # @param [String] deployment_id Deployment ID.
336
335
  #
337
- # @return [DeploymentList]
336
+ # @return [Deployment]
338
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
+ }
339
347
  if function_id.nil?
340
348
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
341
349
  end
@@ -344,35 +352,37 @@ module Appwrite
344
352
  raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
345
353
  end
346
354
 
347
- path = '/functions/{functionId}/deployments/{deploymentId}'
348
355
  .gsub('{functionId}', function_id)
349
356
  .gsub('{deploymentId}', deployment_id)
350
357
 
351
- params = {
352
- }
353
-
354
- headers = {
355
- "content-type": 'application/json',
356
- }
357
-
358
358
  @client.call(
359
359
  method: 'GET',
360
360
  path: path,
361
361
  headers: headers,
362
362
  params: params,
363
- response_type: Models::DeploymentList
363
+ response_type: Models::Deployment
364
364
  )
365
365
  end
366
366
 
367
+
367
368
  # Update the function code deployment ID using the unique function ID. Use
368
369
  # this endpoint to switch the code deployment that should be executed by the
369
370
  # execution endpoint.
370
371
  #
371
- # @param [string] function_id Function ID.
372
- # @param [string] deployment_id Deployment ID.
372
+ # @param [String] function_id Function ID.
373
+ # @param [String] deployment_id Deployment ID.
373
374
  #
374
375
  # @return [Function]
375
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
+ }
376
386
  if function_id.nil?
377
387
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
378
388
  end
@@ -381,17 +391,9 @@ module Appwrite
381
391
  raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
382
392
  end
383
393
 
384
- path = '/functions/{functionId}/deployments/{deploymentId}'
385
394
  .gsub('{functionId}', function_id)
386
395
  .gsub('{deploymentId}', deployment_id)
387
396
 
388
- params = {
389
- }
390
-
391
- headers = {
392
- "content-type": 'application/json',
393
- }
394
-
395
397
  @client.call(
396
398
  method: 'PATCH',
397
399
  path: path,
@@ -401,13 +403,23 @@ module Appwrite
401
403
  )
402
404
  end
403
405
 
406
+
404
407
  # Delete a code deployment by its unique ID.
405
408
  #
406
- # @param [string] function_id Function ID.
407
- # @param [string] deployment_id Deployment ID.
409
+ # @param [String] function_id Function ID.
410
+ # @param [String] deployment_id Deployment ID.
408
411
  #
409
412
  # @return []
410
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
+ }
411
423
  if function_id.nil?
412
424
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
413
425
  end
@@ -416,17 +428,9 @@ module Appwrite
416
428
  raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
417
429
  end
418
430
 
419
- path = '/functions/{functionId}/deployments/{deploymentId}'
420
431
  .gsub('{functionId}', function_id)
421
432
  .gsub('{deploymentId}', deployment_id)
422
433
 
423
- params = {
424
- }
425
-
426
- headers = {
427
- "content-type": 'application/json',
428
- }
429
-
430
434
  @client.call(
431
435
  method: 'DELETE',
432
436
  path: path,
@@ -435,14 +439,24 @@ module Appwrite
435
439
  )
436
440
  end
437
441
 
442
+
438
443
  #
439
444
  #
440
- # @param [string] function_id Function ID.
441
- # @param [string] deployment_id Deployment ID.
442
- # @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.
443
448
  #
444
449
  # @return []
445
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
+ }
446
460
  if function_id.nil?
447
461
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
448
462
  end
@@ -455,18 +469,10 @@ module Appwrite
455
469
  raise Appwrite::Exception.new('Missing required parameter: "buildId"')
456
470
  end
457
471
 
458
- path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'
459
472
  .gsub('{functionId}', function_id)
460
473
  .gsub('{deploymentId}', deployment_id)
461
474
  .gsub('{buildId}', build_id)
462
475
 
463
- params = {
464
- }
465
-
466
- headers = {
467
- "content-type": 'application/json',
468
- }
469
-
470
476
  @client.call(
471
477
  method: 'POST',
472
478
  path: path,
@@ -475,38 +481,34 @@ module Appwrite
475
481
  )
476
482
  end
477
483
 
484
+
478
485
  # Get a list of all the current user function execution logs. You can use the
479
486
  # query params to filter your results. On admin mode, this endpoint will
480
487
  # return a list of all of the project's executions. [Learn more about
481
488
  # different API modes](/docs/admin).
482
489
  #
483
- # @param [string] function_id Function ID.
484
- # @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.
485
- # @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)
486
- # @param [string] search Search term to filter your list results. Max length: 256 chars.
487
- # @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)
488
- # @param [string] cursor_direction Direction of the cursor, can be either &#039;before&#039; or &#039;after&#039;.
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.
489
493
  #
490
494
  # @return [ExecutionList]
491
- def list_executions(function_id:, limit: nil, offset: nil, search: nil, cursor: nil, cursor_direction: nil)
492
- if function_id.nil?
493
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
494
- end
495
+ def list_executions(function_id:, queries: nil, search: nil)
495
496
 
496
497
  path = '/functions/{functionId}/executions'
497
- .gsub('{functionId}', function_id)
498
498
 
499
499
  params = {
500
- limit: limit,
501
- offset: offset,
500
+ queries: queries,
502
501
  search: search,
503
- cursor: cursor,
504
- cursorDirection: cursor_direction,
505
502
  }
506
-
503
+
507
504
  headers = {
508
505
  "content-type": 'application/json',
509
506
  }
507
+ if function_id.nil?
508
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
509
+ end
510
+
511
+ .gsub('{functionId}', function_id)
510
512
 
511
513
  @client.call(
512
514
  method: 'GET',
@@ -517,32 +519,34 @@ module Appwrite
517
519
  )
518
520
  end
519
521
 
522
+
520
523
  # Trigger a function execution. The returned object will return you the
521
524
  # current execution status. You can ping the `Get Execution` endpoint to get
522
525
  # updates on the current execution status. Once this endpoint is called, your
523
526
  # function execution process will start asynchronously.
524
527
  #
525
- # @param [string] function_id Function ID.
526
- # @param [string] data String of custom data to send to function.
527
- # @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.
528
531
  #
529
532
  # @return [Execution]
530
533
  def create_execution(function_id:, data: nil, async: nil)
531
- if function_id.nil?
532
- raise Appwrite::Exception.new('Missing required parameter: "functionId"')
533
- end
534
534
 
535
535
  path = '/functions/{functionId}/executions'
536
- .gsub('{functionId}', function_id)
537
536
 
538
537
  params = {
539
538
  data: data,
540
539
  async: async,
541
540
  }
542
-
541
+
543
542
  headers = {
544
543
  "content-type": 'application/json',
545
544
  }
545
+ if function_id.nil?
546
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
547
+ end
548
+
549
+ .gsub('{functionId}', function_id)
546
550
 
547
551
  @client.call(
548
552
  method: 'POST',
@@ -553,13 +557,23 @@ module Appwrite
553
557
  )
554
558
  end
555
559
 
560
+
556
561
  # Get a function execution log by its unique ID.
557
562
  #
558
- # @param [string] function_id Function ID.
559
- # @param [string] execution_id Execution ID.
563
+ # @param [String] function_id Function ID.
564
+ # @param [String] execution_id Execution ID.
560
565
  #
561
566
  # @return [Execution]
562
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
+ }
563
577
  if function_id.nil?
564
578
  raise Appwrite::Exception.new('Missing required parameter: "functionId"')
565
579
  end
@@ -568,25 +582,215 @@ module Appwrite
568
582
  raise Appwrite::Exception.new('Missing required parameter: "executionId"')
569
583
  end
570
584
 
571
- path = '/functions/{functionId}/executions/{executionId}'
572
585
  .gsub('{functionId}', function_id)
573
586
  .gsub('{executionId}', execution_id)
574
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
+
575
609
  params = {
610
+ queries: queries,
611
+ search: search,
612
+ }
613
+
614
+ headers = {
615
+ "content-type": 'application/json',
576
616
  }
617
+ if function_id.nil?
618
+ raise Appwrite::Exception.new('Missing required parameter: "functionId"')
619
+ end
577
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
+
578
650
  headers = {
579
651
  "content-type": 'application/json',
580
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)
581
703
 
582
704
  @client.call(
583
705
  method: 'GET',
584
706
  path: path,
585
707
  headers: headers,
586
708
  params: params,
587
- 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,
588
791
  )
589
792
  end
590
793
 
794
+
591
795
  end
592
796
  end