appwrite 7.1.0 → 9.0.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.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +2 -2
- data/lib/appwrite/models/algo_argon2.rb +5 -0
- data/lib/appwrite/models/algo_bcrypt.rb +5 -0
- data/lib/appwrite/models/algo_md5.rb +5 -0
- data/lib/appwrite/models/algo_phpass.rb +5 -0
- data/lib/appwrite/models/algo_scrypt.rb +5 -0
- data/lib/appwrite/models/algo_scrypt_modified.rb +5 -0
- data/lib/appwrite/models/algo_sha.rb +5 -0
- data/lib/appwrite/models/attribute_boolean.rb +5 -0
- data/lib/appwrite/models/attribute_datetime.rb +5 -0
- data/lib/appwrite/models/attribute_email.rb +5 -0
- data/lib/appwrite/models/attribute_enum.rb +5 -0
- data/lib/appwrite/models/attribute_float.rb +5 -0
- data/lib/appwrite/models/attribute_integer.rb +5 -0
- data/lib/appwrite/models/attribute_ip.rb +5 -0
- data/lib/appwrite/models/attribute_relationship.rb +82 -0
- data/lib/appwrite/models/attribute_string.rb +5 -0
- data/lib/appwrite/models/attribute_url.rb +5 -0
- data/lib/appwrite/models/database.rb +8 -3
- data/lib/appwrite/models/deployment.rb +65 -10
- data/lib/appwrite/models/execution.rb +40 -20
- data/lib/appwrite/models/function.rb +53 -13
- data/lib/appwrite/models/headers.rb +32 -0
- data/lib/appwrite/models/health_status.rb +5 -0
- data/lib/appwrite/models/identity.rb +72 -0
- data/lib/appwrite/models/identity_list.rb +32 -0
- data/lib/appwrite/models/index.rb +5 -0
- data/lib/appwrite/models/locale_code.rb +32 -0
- data/lib/appwrite/models/locale_code_list.rb +32 -0
- data/lib/appwrite/models/team.rb +8 -3
- data/lib/appwrite/models/user.rb +16 -6
- data/lib/appwrite/models/variable.rb +10 -5
- data/lib/appwrite/query.rb +41 -17
- data/lib/appwrite/services/account.rb +120 -65
- data/lib/appwrite/services/avatars.rb +14 -14
- data/lib/appwrite/services/databases.rb +834 -188
- data/lib/appwrite/services/functions.rb +150 -74
- data/lib/appwrite/services/graphql.rb +71 -0
- data/lib/appwrite/services/health.rb +71 -22
- data/lib/appwrite/services/locale.rb +39 -14
- data/lib/appwrite/services/storage.rb +43 -42
- data/lib/appwrite/services/teams.rb +123 -50
- data/lib/appwrite/services/users.rb +158 -60
- data/lib/appwrite.rb +7 -1
- metadata +10 -4
- data/lib/appwrite/models/account.rb +0 -82
@@ -10,12 +10,12 @@ module Appwrite
|
|
10
10
|
# Get a list of all the project's functions. You can use the query params to
|
11
11
|
# filter your results.
|
12
12
|
#
|
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/
|
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/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, enabled, runtime, deployment, schedule, scheduleNext, schedulePrevious, timeout, entrypoint, commands, installationId
|
14
14
|
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
15
15
|
#
|
16
16
|
# @return [FunctionList]
|
17
17
|
def list(queries: nil, search: nil)
|
18
|
-
|
18
|
+
api_path = '/functions'
|
19
19
|
|
20
20
|
params = {
|
21
21
|
queries: queries,
|
@@ -28,7 +28,7 @@ module Appwrite
|
|
28
28
|
|
29
29
|
@client.call(
|
30
30
|
method: 'GET',
|
31
|
-
path:
|
31
|
+
path: api_path,
|
32
32
|
headers: headers,
|
33
33
|
params: params,
|
34
34
|
response_type: Models::FunctionList
|
@@ -40,18 +40,30 @@ module Appwrite
|
|
40
40
|
# [permissions](/docs/permissions) to allow different project users or team
|
41
41
|
# with access to execute the function using the client API.
|
42
42
|
#
|
43
|
-
# @param [String] function_id Function ID. Choose
|
43
|
+
# @param [String] function_id Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
44
44
|
# @param [String] name Function name. Max length: 128 chars.
|
45
|
-
# @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.
|
46
45
|
# @param [String] runtime Execution runtime.
|
46
|
+
# @param [Array] execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
|
47
47
|
# @param [Array] events Events list. Maximum of 100 events are allowed.
|
48
48
|
# @param [String] schedule Schedule CRON syntax.
|
49
49
|
# @param [Integer] timeout Function maximum execution time in seconds.
|
50
|
-
# @param [] enabled Is function enabled?
|
50
|
+
# @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
|
51
|
+
# @param [] logging Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
|
52
|
+
# @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory".
|
53
|
+
# @param [String] commands Build Commands.
|
54
|
+
# @param [String] installation_id Appwrite Installation ID for VCS (Version Control System) deployment.
|
55
|
+
# @param [String] provider_repository_id Repository ID of the repo linked to the function.
|
56
|
+
# @param [String] provider_branch Production branch for the repo linked to the function.
|
57
|
+
# @param [] provider_silent_mode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
|
58
|
+
# @param [String] provider_root_directory Path to function code in the linked repo.
|
59
|
+
# @param [String] template_repository Repository name of the template.
|
60
|
+
# @param [String] template_owner The name of the owner of the template.
|
61
|
+
# @param [String] template_root_directory Path to function code in the template repo.
|
62
|
+
# @param [String] template_branch Production branch for the repo linked to the function template.
|
51
63
|
#
|
52
64
|
# @return [Function]
|
53
|
-
def create(function_id:, name:,
|
54
|
-
|
65
|
+
def create(function_id:, name:, runtime:, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil, template_repository: nil, template_owner: nil, template_root_directory: nil, template_branch: nil)
|
66
|
+
api_path = '/functions'
|
55
67
|
|
56
68
|
if function_id.nil?
|
57
69
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
@@ -61,10 +73,6 @@ module Appwrite
|
|
61
73
|
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
62
74
|
end
|
63
75
|
|
64
|
-
if execute.nil?
|
65
|
-
raise Appwrite::Exception.new('Missing required parameter: "execute"')
|
66
|
-
end
|
67
|
-
|
68
76
|
if runtime.nil?
|
69
77
|
raise Appwrite::Exception.new('Missing required parameter: "runtime"')
|
70
78
|
end
|
@@ -72,12 +80,24 @@ module Appwrite
|
|
72
80
|
params = {
|
73
81
|
functionId: function_id,
|
74
82
|
name: name,
|
75
|
-
execute: execute,
|
76
83
|
runtime: runtime,
|
84
|
+
execute: execute,
|
77
85
|
events: events,
|
78
86
|
schedule: schedule,
|
79
87
|
timeout: timeout,
|
80
88
|
enabled: enabled,
|
89
|
+
logging: logging,
|
90
|
+
entrypoint: entrypoint,
|
91
|
+
commands: commands,
|
92
|
+
installationId: installation_id,
|
93
|
+
providerRepositoryId: provider_repository_id,
|
94
|
+
providerBranch: provider_branch,
|
95
|
+
providerSilentMode: provider_silent_mode,
|
96
|
+
providerRootDirectory: provider_root_directory,
|
97
|
+
templateRepository: template_repository,
|
98
|
+
templateOwner: template_owner,
|
99
|
+
templateRootDirectory: template_root_directory,
|
100
|
+
templateBranch: template_branch,
|
81
101
|
}
|
82
102
|
|
83
103
|
headers = {
|
@@ -86,7 +106,7 @@ module Appwrite
|
|
86
106
|
|
87
107
|
@client.call(
|
88
108
|
method: 'POST',
|
89
|
-
path:
|
109
|
+
path: api_path,
|
90
110
|
headers: headers,
|
91
111
|
params: params,
|
92
112
|
response_type: Models::Function
|
@@ -99,7 +119,7 @@ module Appwrite
|
|
99
119
|
#
|
100
120
|
# @return [RuntimeList]
|
101
121
|
def list_runtimes()
|
102
|
-
|
122
|
+
api_path = '/functions/runtimes'
|
103
123
|
|
104
124
|
params = {
|
105
125
|
}
|
@@ -110,7 +130,7 @@ module Appwrite
|
|
110
130
|
|
111
131
|
@client.call(
|
112
132
|
method: 'GET',
|
113
|
-
path:
|
133
|
+
path: api_path,
|
114
134
|
headers: headers,
|
115
135
|
params: params,
|
116
136
|
response_type: Models::RuntimeList
|
@@ -124,7 +144,7 @@ module Appwrite
|
|
124
144
|
#
|
125
145
|
# @return [Function]
|
126
146
|
def get(function_id:)
|
127
|
-
|
147
|
+
api_path = '/functions/{functionId}'
|
128
148
|
.gsub('{functionId}', function_id)
|
129
149
|
|
130
150
|
if function_id.nil?
|
@@ -140,7 +160,7 @@ module Appwrite
|
|
140
160
|
|
141
161
|
@client.call(
|
142
162
|
method: 'GET',
|
143
|
-
path:
|
163
|
+
path: api_path,
|
144
164
|
headers: headers,
|
145
165
|
params: params,
|
146
166
|
response_type: Models::Function
|
@@ -152,15 +172,24 @@ module Appwrite
|
|
152
172
|
#
|
153
173
|
# @param [String] function_id Function ID.
|
154
174
|
# @param [String] name Function name. Max length: 128 chars.
|
155
|
-
# @param [
|
175
|
+
# @param [String] runtime Execution runtime.
|
176
|
+
# @param [Array] execute An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of 100 roles are allowed, each 64 characters long.
|
156
177
|
# @param [Array] events Events list. Maximum of 100 events are allowed.
|
157
178
|
# @param [String] schedule Schedule CRON syntax.
|
158
179
|
# @param [Integer] timeout Maximum execution time in seconds.
|
159
|
-
# @param [] enabled Is function enabled?
|
180
|
+
# @param [] enabled Is function enabled? When set to 'disabled', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.
|
181
|
+
# @param [] logging Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.
|
182
|
+
# @param [String] entrypoint Entrypoint File. This path is relative to the "providerRootDirectory".
|
183
|
+
# @param [String] commands Build Commands.
|
184
|
+
# @param [String] installation_id Appwrite Installation ID for VCS (Version Controle System) deployment.
|
185
|
+
# @param [String] provider_repository_id Repository ID of the repo linked to the function
|
186
|
+
# @param [String] provider_branch Production branch for the repo linked to the function
|
187
|
+
# @param [] provider_silent_mode Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.
|
188
|
+
# @param [String] provider_root_directory Path to function code in the linked repo.
|
160
189
|
#
|
161
190
|
# @return [Function]
|
162
|
-
def update(function_id:, name:,
|
163
|
-
|
191
|
+
def update(function_id:, name:, runtime:, execute: nil, events: nil, schedule: nil, timeout: nil, enabled: nil, logging: nil, entrypoint: nil, commands: nil, installation_id: nil, provider_repository_id: nil, provider_branch: nil, provider_silent_mode: nil, provider_root_directory: nil)
|
192
|
+
api_path = '/functions/{functionId}'
|
164
193
|
.gsub('{functionId}', function_id)
|
165
194
|
|
166
195
|
if function_id.nil?
|
@@ -171,17 +200,26 @@ module Appwrite
|
|
171
200
|
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
172
201
|
end
|
173
202
|
|
174
|
-
if
|
175
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
203
|
+
if runtime.nil?
|
204
|
+
raise Appwrite::Exception.new('Missing required parameter: "runtime"')
|
176
205
|
end
|
177
206
|
|
178
207
|
params = {
|
179
208
|
name: name,
|
209
|
+
runtime: runtime,
|
180
210
|
execute: execute,
|
181
211
|
events: events,
|
182
212
|
schedule: schedule,
|
183
213
|
timeout: timeout,
|
184
214
|
enabled: enabled,
|
215
|
+
logging: logging,
|
216
|
+
entrypoint: entrypoint,
|
217
|
+
commands: commands,
|
218
|
+
installationId: installation_id,
|
219
|
+
providerRepositoryId: provider_repository_id,
|
220
|
+
providerBranch: provider_branch,
|
221
|
+
providerSilentMode: provider_silent_mode,
|
222
|
+
providerRootDirectory: provider_root_directory,
|
185
223
|
}
|
186
224
|
|
187
225
|
headers = {
|
@@ -190,7 +228,7 @@ module Appwrite
|
|
190
228
|
|
191
229
|
@client.call(
|
192
230
|
method: 'PUT',
|
193
|
-
path:
|
231
|
+
path: api_path,
|
194
232
|
headers: headers,
|
195
233
|
params: params,
|
196
234
|
response_type: Models::Function
|
@@ -204,7 +242,7 @@ module Appwrite
|
|
204
242
|
#
|
205
243
|
# @return []
|
206
244
|
def delete(function_id:)
|
207
|
-
|
245
|
+
api_path = '/functions/{functionId}'
|
208
246
|
.gsub('{functionId}', function_id)
|
209
247
|
|
210
248
|
if function_id.nil?
|
@@ -220,7 +258,7 @@ module Appwrite
|
|
220
258
|
|
221
259
|
@client.call(
|
222
260
|
method: 'DELETE',
|
223
|
-
path:
|
261
|
+
path: api_path,
|
224
262
|
headers: headers,
|
225
263
|
params: params,
|
226
264
|
)
|
@@ -231,12 +269,12 @@ module Appwrite
|
|
231
269
|
# params to filter your results.
|
232
270
|
#
|
233
271
|
# @param [String] function_id Function ID.
|
234
|
-
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/
|
272
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: size, buildId, activate, entrypoint, commands
|
235
273
|
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
236
274
|
#
|
237
275
|
# @return [DeploymentList]
|
238
276
|
def list_deployments(function_id:, queries: nil, search: nil)
|
239
|
-
|
277
|
+
api_path = '/functions/{functionId}/deployments'
|
240
278
|
.gsub('{functionId}', function_id)
|
241
279
|
|
242
280
|
if function_id.nil?
|
@@ -254,7 +292,7 @@ module Appwrite
|
|
254
292
|
|
255
293
|
@client.call(
|
256
294
|
method: 'GET',
|
257
|
-
path:
|
295
|
+
path: api_path,
|
258
296
|
headers: headers,
|
259
297
|
params: params,
|
260
298
|
response_type: Models::DeploymentList
|
@@ -271,26 +309,23 @@ module Appwrite
|
|
271
309
|
# learn more about code packaging in the [Appwrite Cloud Functions
|
272
310
|
# tutorial](/docs/functions).
|
273
311
|
#
|
274
|
-
# Use the "command" param to set the
|
312
|
+
# Use the "command" param to set the entrypoint used to execute your code.
|
275
313
|
#
|
276
314
|
# @param [String] function_id Function ID.
|
277
|
-
# @param [String] entrypoint Entrypoint File.
|
278
315
|
# @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.
|
279
316
|
# @param [] activate Automatically activate the deployment when it is finished building.
|
317
|
+
# @param [String] entrypoint Entrypoint File.
|
318
|
+
# @param [String] commands Build Commands.
|
280
319
|
#
|
281
320
|
# @return [Deployment]
|
282
|
-
def create_deployment(function_id:,
|
283
|
-
|
321
|
+
def create_deployment(function_id:, code:, activate:, entrypoint: nil, commands: nil, on_progress: nil)
|
322
|
+
api_path = '/functions/{functionId}/deployments'
|
284
323
|
.gsub('{functionId}', function_id)
|
285
324
|
|
286
325
|
if function_id.nil?
|
287
326
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
288
327
|
end
|
289
328
|
|
290
|
-
if entrypoint.nil?
|
291
|
-
raise Appwrite::Exception.new('Missing required parameter: "entrypoint"')
|
292
|
-
end
|
293
|
-
|
294
329
|
if code.nil?
|
295
330
|
raise Appwrite::Exception.new('Missing required parameter: "code"')
|
296
331
|
end
|
@@ -301,6 +336,7 @@ module Appwrite
|
|
301
336
|
|
302
337
|
params = {
|
303
338
|
entrypoint: entrypoint,
|
339
|
+
commands: commands,
|
304
340
|
code: code,
|
305
341
|
activate: activate,
|
306
342
|
}
|
@@ -313,7 +349,7 @@ module Appwrite
|
|
313
349
|
param_name = 'code'
|
314
350
|
|
315
351
|
@client.chunked_upload(
|
316
|
-
path:
|
352
|
+
path: api_path,
|
317
353
|
headers: headers,
|
318
354
|
params: params,
|
319
355
|
param_name: param_name,
|
@@ -331,7 +367,7 @@ module Appwrite
|
|
331
367
|
#
|
332
368
|
# @return [Deployment]
|
333
369
|
def get_deployment(function_id:, deployment_id:)
|
334
|
-
|
370
|
+
api_path = '/functions/{functionId}/deployments/{deploymentId}'
|
335
371
|
.gsub('{functionId}', function_id)
|
336
372
|
.gsub('{deploymentId}', deployment_id)
|
337
373
|
|
@@ -352,7 +388,7 @@ module Appwrite
|
|
352
388
|
|
353
389
|
@client.call(
|
354
390
|
method: 'GET',
|
355
|
-
path:
|
391
|
+
path: api_path,
|
356
392
|
headers: headers,
|
357
393
|
params: params,
|
358
394
|
response_type: Models::Deployment
|
@@ -369,7 +405,7 @@ module Appwrite
|
|
369
405
|
#
|
370
406
|
# @return [Function]
|
371
407
|
def update_deployment(function_id:, deployment_id:)
|
372
|
-
|
408
|
+
api_path = '/functions/{functionId}/deployments/{deploymentId}'
|
373
409
|
.gsub('{functionId}', function_id)
|
374
410
|
.gsub('{deploymentId}', deployment_id)
|
375
411
|
|
@@ -390,7 +426,7 @@ module Appwrite
|
|
390
426
|
|
391
427
|
@client.call(
|
392
428
|
method: 'PATCH',
|
393
|
-
path:
|
429
|
+
path: api_path,
|
394
430
|
headers: headers,
|
395
431
|
params: params,
|
396
432
|
response_type: Models::Function
|
@@ -405,7 +441,7 @@ module Appwrite
|
|
405
441
|
#
|
406
442
|
# @return []
|
407
443
|
def delete_deployment(function_id:, deployment_id:)
|
408
|
-
|
444
|
+
api_path = '/functions/{functionId}/deployments/{deploymentId}'
|
409
445
|
.gsub('{functionId}', function_id)
|
410
446
|
.gsub('{deploymentId}', deployment_id)
|
411
447
|
|
@@ -426,22 +462,23 @@ module Appwrite
|
|
426
462
|
|
427
463
|
@client.call(
|
428
464
|
method: 'DELETE',
|
429
|
-
path:
|
465
|
+
path: api_path,
|
430
466
|
headers: headers,
|
431
467
|
params: params,
|
432
468
|
)
|
433
469
|
end
|
434
470
|
|
435
471
|
|
436
|
-
#
|
472
|
+
# Create a new build for an Appwrite Function deployment. This endpoint can
|
473
|
+
# be used to retry a failed build.
|
437
474
|
#
|
438
475
|
# @param [String] function_id Function ID.
|
439
476
|
# @param [String] deployment_id Deployment ID.
|
440
477
|
# @param [String] build_id Build unique ID.
|
441
478
|
#
|
442
479
|
# @return []
|
443
|
-
def
|
444
|
-
|
480
|
+
def create_build(function_id:, deployment_id:, build_id:)
|
481
|
+
api_path = '/functions/{functionId}/deployments/{deploymentId}/builds/{buildId}'
|
445
482
|
.gsub('{functionId}', function_id)
|
446
483
|
.gsub('{deploymentId}', deployment_id)
|
447
484
|
.gsub('{buildId}', build_id)
|
@@ -467,7 +504,42 @@ module Appwrite
|
|
467
504
|
|
468
505
|
@client.call(
|
469
506
|
method: 'POST',
|
470
|
-
path:
|
507
|
+
path: api_path,
|
508
|
+
headers: headers,
|
509
|
+
params: params,
|
510
|
+
)
|
511
|
+
end
|
512
|
+
|
513
|
+
|
514
|
+
#
|
515
|
+
#
|
516
|
+
# @param [String] function_id Function ID.
|
517
|
+
# @param [String] deployment_id Deployment ID.
|
518
|
+
#
|
519
|
+
# @return []
|
520
|
+
def download_deployment(function_id:, deployment_id:)
|
521
|
+
api_path = '/functions/{functionId}/deployments/{deploymentId}/download'
|
522
|
+
.gsub('{functionId}', function_id)
|
523
|
+
.gsub('{deploymentId}', deployment_id)
|
524
|
+
|
525
|
+
if function_id.nil?
|
526
|
+
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
527
|
+
end
|
528
|
+
|
529
|
+
if deployment_id.nil?
|
530
|
+
raise Appwrite::Exception.new('Missing required parameter: "deploymentId"')
|
531
|
+
end
|
532
|
+
|
533
|
+
params = {
|
534
|
+
}
|
535
|
+
|
536
|
+
headers = {
|
537
|
+
"content-type": 'application/json',
|
538
|
+
}
|
539
|
+
|
540
|
+
@client.call(
|
541
|
+
method: 'GET',
|
542
|
+
path: api_path,
|
471
543
|
headers: headers,
|
472
544
|
params: params,
|
473
545
|
)
|
@@ -475,17 +547,15 @@ module Appwrite
|
|
475
547
|
|
476
548
|
|
477
549
|
# Get a list of all the current user function execution logs. You can use the
|
478
|
-
# query params to filter your results.
|
479
|
-
# return a list of all of the project's executions. [Learn more about
|
480
|
-
# different API modes](/docs/admin).
|
550
|
+
# query params to filter your results.
|
481
551
|
#
|
482
552
|
# @param [String] function_id Function ID.
|
483
|
-
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/
|
553
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration
|
484
554
|
# @param [String] search Search term to filter your list results. Max length: 256 chars.
|
485
555
|
#
|
486
556
|
# @return [ExecutionList]
|
487
557
|
def list_executions(function_id:, queries: nil, search: nil)
|
488
|
-
|
558
|
+
api_path = '/functions/{functionId}/executions'
|
489
559
|
.gsub('{functionId}', function_id)
|
490
560
|
|
491
561
|
if function_id.nil?
|
@@ -503,7 +573,7 @@ module Appwrite
|
|
503
573
|
|
504
574
|
@client.call(
|
505
575
|
method: 'GET',
|
506
|
-
path:
|
576
|
+
path: api_path,
|
507
577
|
headers: headers,
|
508
578
|
params: params,
|
509
579
|
response_type: Models::ExecutionList
|
@@ -517,12 +587,15 @@ module Appwrite
|
|
517
587
|
# function execution process will start asynchronously.
|
518
588
|
#
|
519
589
|
# @param [String] function_id Function ID.
|
520
|
-
# @param [String]
|
590
|
+
# @param [String] body HTTP body of execution. Default value is empty string.
|
521
591
|
# @param [] async Execute code in the background. Default value is false.
|
592
|
+
# @param [String] xpath HTTP path of execution. Path can include query params. Default value is /
|
593
|
+
# @param [String] method HTTP method of execution. Default value is GET.
|
594
|
+
# @param [Hash] headers HTTP headers of execution. Defaults to empty.
|
522
595
|
#
|
523
596
|
# @return [Execution]
|
524
|
-
def create_execution(function_id:,
|
525
|
-
|
597
|
+
def create_execution(function_id:, body: nil, async: nil, xpath: nil, method: nil, headers: nil)
|
598
|
+
api_path = '/functions/{functionId}/executions'
|
526
599
|
.gsub('{functionId}', function_id)
|
527
600
|
|
528
601
|
if function_id.nil?
|
@@ -530,8 +603,11 @@ module Appwrite
|
|
530
603
|
end
|
531
604
|
|
532
605
|
params = {
|
533
|
-
|
606
|
+
body: body,
|
534
607
|
async: async,
|
608
|
+
path: xpath,
|
609
|
+
method: method,
|
610
|
+
headers: headers,
|
535
611
|
}
|
536
612
|
|
537
613
|
headers = {
|
@@ -540,7 +616,7 @@ module Appwrite
|
|
540
616
|
|
541
617
|
@client.call(
|
542
618
|
method: 'POST',
|
543
|
-
path:
|
619
|
+
path: api_path,
|
544
620
|
headers: headers,
|
545
621
|
params: params,
|
546
622
|
response_type: Models::Execution
|
@@ -555,7 +631,7 @@ module Appwrite
|
|
555
631
|
#
|
556
632
|
# @return [Execution]
|
557
633
|
def get_execution(function_id:, execution_id:)
|
558
|
-
|
634
|
+
api_path = '/functions/{functionId}/executions/{executionId}'
|
559
635
|
.gsub('{functionId}', function_id)
|
560
636
|
.gsub('{executionId}', execution_id)
|
561
637
|
|
@@ -576,7 +652,7 @@ module Appwrite
|
|
576
652
|
|
577
653
|
@client.call(
|
578
654
|
method: 'GET',
|
579
|
-
path:
|
655
|
+
path: api_path,
|
580
656
|
headers: headers,
|
581
657
|
params: params,
|
582
658
|
response_type: Models::Execution
|
@@ -590,7 +666,7 @@ module Appwrite
|
|
590
666
|
#
|
591
667
|
# @return [VariableList]
|
592
668
|
def list_variables(function_id:)
|
593
|
-
|
669
|
+
api_path = '/functions/{functionId}/variables'
|
594
670
|
.gsub('{functionId}', function_id)
|
595
671
|
|
596
672
|
if function_id.nil?
|
@@ -606,7 +682,7 @@ module Appwrite
|
|
606
682
|
|
607
683
|
@client.call(
|
608
684
|
method: 'GET',
|
609
|
-
path:
|
685
|
+
path: api_path,
|
610
686
|
headers: headers,
|
611
687
|
params: params,
|
612
688
|
response_type: Models::VariableList
|
@@ -614,8 +690,8 @@ module Appwrite
|
|
614
690
|
end
|
615
691
|
|
616
692
|
|
617
|
-
# Create a new function variable. These variables can be accessed
|
618
|
-
#
|
693
|
+
# Create a new function environment variable. These variables can be accessed
|
694
|
+
# in the function at runtime as environment variables.
|
619
695
|
#
|
620
696
|
# @param [String] function_id Function unique ID.
|
621
697
|
# @param [String] key Variable key. Max length: 255 chars.
|
@@ -623,7 +699,7 @@ module Appwrite
|
|
623
699
|
#
|
624
700
|
# @return [Variable]
|
625
701
|
def create_variable(function_id:, key:, value:)
|
626
|
-
|
702
|
+
api_path = '/functions/{functionId}/variables'
|
627
703
|
.gsub('{functionId}', function_id)
|
628
704
|
|
629
705
|
if function_id.nil?
|
@@ -649,7 +725,7 @@ module Appwrite
|
|
649
725
|
|
650
726
|
@client.call(
|
651
727
|
method: 'POST',
|
652
|
-
path:
|
728
|
+
path: api_path,
|
653
729
|
headers: headers,
|
654
730
|
params: params,
|
655
731
|
response_type: Models::Variable
|
@@ -664,7 +740,7 @@ module Appwrite
|
|
664
740
|
#
|
665
741
|
# @return [Variable]
|
666
742
|
def get_variable(function_id:, variable_id:)
|
667
|
-
|
743
|
+
api_path = '/functions/{functionId}/variables/{variableId}'
|
668
744
|
.gsub('{functionId}', function_id)
|
669
745
|
.gsub('{variableId}', variable_id)
|
670
746
|
|
@@ -685,7 +761,7 @@ module Appwrite
|
|
685
761
|
|
686
762
|
@client.call(
|
687
763
|
method: 'GET',
|
688
|
-
path:
|
764
|
+
path: api_path,
|
689
765
|
headers: headers,
|
690
766
|
params: params,
|
691
767
|
response_type: Models::Variable
|
@@ -702,7 +778,7 @@ module Appwrite
|
|
702
778
|
#
|
703
779
|
# @return [Variable]
|
704
780
|
def update_variable(function_id:, variable_id:, key:, value: nil)
|
705
|
-
|
781
|
+
api_path = '/functions/{functionId}/variables/{variableId}'
|
706
782
|
.gsub('{functionId}', function_id)
|
707
783
|
.gsub('{variableId}', variable_id)
|
708
784
|
|
@@ -729,7 +805,7 @@ module Appwrite
|
|
729
805
|
|
730
806
|
@client.call(
|
731
807
|
method: 'PUT',
|
732
|
-
path:
|
808
|
+
path: api_path,
|
733
809
|
headers: headers,
|
734
810
|
params: params,
|
735
811
|
response_type: Models::Variable
|
@@ -744,7 +820,7 @@ module Appwrite
|
|
744
820
|
#
|
745
821
|
# @return []
|
746
822
|
def delete_variable(function_id:, variable_id:)
|
747
|
-
|
823
|
+
api_path = '/functions/{functionId}/variables/{variableId}'
|
748
824
|
.gsub('{functionId}', function_id)
|
749
825
|
.gsub('{variableId}', variable_id)
|
750
826
|
|
@@ -765,7 +841,7 @@ module Appwrite
|
|
765
841
|
|
766
842
|
@client.call(
|
767
843
|
method: 'DELETE',
|
768
|
-
path:
|
844
|
+
path: api_path,
|
769
845
|
headers: headers,
|
770
846
|
params: params,
|
771
847
|
)
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appwrite
|
4
|
+
class Graphql < Service
|
5
|
+
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
# Execute a GraphQL mutation.
|
11
|
+
#
|
12
|
+
# @param [Hash] query The query or queries to execute.
|
13
|
+
#
|
14
|
+
# @return [Any]
|
15
|
+
def query(query:)
|
16
|
+
api_path = '/graphql'
|
17
|
+
|
18
|
+
if query.nil?
|
19
|
+
raise Appwrite::Exception.new('Missing required parameter: "query"')
|
20
|
+
end
|
21
|
+
|
22
|
+
params = {
|
23
|
+
query: query,
|
24
|
+
}
|
25
|
+
|
26
|
+
headers = {
|
27
|
+
"x-sdk-graphql": 'true',
|
28
|
+
"content-type": 'application/json',
|
29
|
+
}
|
30
|
+
|
31
|
+
@client.call(
|
32
|
+
method: 'POST',
|
33
|
+
path: api_path,
|
34
|
+
headers: headers,
|
35
|
+
params: params,
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# Execute a GraphQL mutation.
|
41
|
+
#
|
42
|
+
# @param [Hash] query The query or queries to execute.
|
43
|
+
#
|
44
|
+
# @return [Any]
|
45
|
+
def mutation(query:)
|
46
|
+
api_path = '/graphql/mutation'
|
47
|
+
|
48
|
+
if query.nil?
|
49
|
+
raise Appwrite::Exception.new('Missing required parameter: "query"')
|
50
|
+
end
|
51
|
+
|
52
|
+
params = {
|
53
|
+
query: query,
|
54
|
+
}
|
55
|
+
|
56
|
+
headers = {
|
57
|
+
"x-sdk-graphql": 'true',
|
58
|
+
"content-type": 'application/json',
|
59
|
+
}
|
60
|
+
|
61
|
+
@client.call(
|
62
|
+
method: 'POST',
|
63
|
+
path: api_path,
|
64
|
+
headers: headers,
|
65
|
+
params: params,
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|