appwrite 2.2.0 → 3.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 +134 -57
- data/lib/appwrite/exception.rb +5 -7
- data/lib/appwrite/file.rb +5 -13
- data/lib/appwrite/models/attribute_boolean.rb +52 -0
- data/lib/appwrite/models/attribute_email.rb +57 -0
- data/lib/appwrite/models/attribute_enum.rb +62 -0
- data/lib/appwrite/models/attribute_float.rb +62 -0
- data/lib/appwrite/models/attribute_integer.rb +62 -0
- data/lib/appwrite/models/attribute_ip.rb +57 -0
- data/lib/appwrite/models/attribute_list.rb +32 -0
- data/lib/appwrite/models/attribute_string.rb +57 -0
- data/lib/appwrite/models/attribute_url.rb +57 -0
- data/lib/appwrite/models/collection.rb +62 -0
- data/lib/appwrite/models/collection_list.rb +32 -0
- data/lib/appwrite/models/continent.rb +32 -0
- data/lib/appwrite/models/continent_list.rb +32 -0
- data/lib/appwrite/models/country.rb +32 -0
- data/lib/appwrite/models/country_list.rb +32 -0
- data/lib/appwrite/models/currency.rb +57 -0
- data/lib/appwrite/models/currency_list.rb +32 -0
- data/lib/appwrite/models/document.rb +50 -0
- data/lib/appwrite/models/document_list.rb +36 -0
- data/lib/appwrite/models/execution.rb +72 -0
- data/lib/appwrite/models/execution_list.rb +32 -0
- data/lib/appwrite/models/file.rb +62 -0
- data/lib/appwrite/models/file_list.rb +32 -0
- data/lib/appwrite/models/function.rb +92 -0
- data/lib/appwrite/models/function_list.rb +32 -0
- data/lib/appwrite/models/health_antivirus.rb +32 -0
- data/lib/appwrite/models/health_queue.rb +27 -0
- data/lib/appwrite/models/health_status.rb +32 -0
- data/lib/appwrite/models/health_time.rb +37 -0
- data/lib/appwrite/models/index.rb +47 -0
- data/lib/appwrite/models/index_list.rb +32 -0
- data/lib/appwrite/models/language.rb +37 -0
- data/lib/appwrite/models/language_list.rb +32 -0
- data/lib/appwrite/models/locale.rb +57 -0
- data/lib/appwrite/models/log.rb +127 -0
- data/lib/appwrite/models/log_list.rb +32 -0
- data/lib/appwrite/models/membership.rb +67 -0
- data/lib/appwrite/models/membership_list.rb +32 -0
- data/lib/appwrite/models/phone.rb +37 -0
- data/lib/appwrite/models/phone_list.rb +32 -0
- data/lib/appwrite/models/preferences.rb +30 -0
- data/lib/appwrite/models/runtime.rb +57 -0
- data/lib/appwrite/models/runtime_list.rb +32 -0
- data/lib/appwrite/models/session.rb +132 -0
- data/lib/appwrite/models/session_list.rb +32 -0
- data/lib/appwrite/models/tag.rb +47 -0
- data/lib/appwrite/models/tag_list.rb +32 -0
- data/lib/appwrite/models/team.rb +42 -0
- data/lib/appwrite/models/team_list.rb +32 -0
- data/lib/appwrite/models/token.rb +42 -0
- data/lib/appwrite/models/user.rb +62 -0
- data/lib/appwrite/models/user_list.rb +32 -0
- data/lib/appwrite/query.rb +42 -0
- data/lib/appwrite/service.rb +0 -5
- data/lib/appwrite/services/account.rb +380 -133
- data/lib/appwrite/services/avatars.rb +189 -125
- data/lib/appwrite/services/database.rb +876 -130
- data/lib/appwrite/services/functions.rb +366 -184
- data/lib/appwrite/services/health.rb +202 -58
- data/lib/appwrite/services/locale.rb +134 -32
- data/lib/appwrite/services/storage.rb +211 -118
- data/lib/appwrite/services/teams.rb +299 -118
- data/lib/appwrite/services/users.rb +372 -85
- data/lib/appwrite.rb +55 -0
- metadata +72 -103
- data/.travis.yml +0 -16
- data/CHANGELOG.md +0 -1
- data/Gemfile +0 -4
- data/LICENSE +0 -12
- data/README.md +0 -97
- data/appwrite.gemspec +0 -11
- data/docs/examples/account/create-recovery.md +0 -15
- data/docs/examples/account/create-verification.md +0 -15
- data/docs/examples/account/delete-session.md +0 -15
- data/docs/examples/account/delete-sessions.md +0 -15
- data/docs/examples/account/delete.md +0 -15
- data/docs/examples/account/get-logs.md +0 -15
- data/docs/examples/account/get-prefs.md +0 -15
- data/docs/examples/account/get-sessions.md +0 -15
- data/docs/examples/account/get.md +0 -15
- data/docs/examples/account/update-email.md +0 -15
- data/docs/examples/account/update-name.md +0 -15
- data/docs/examples/account/update-password.md +0 -15
- data/docs/examples/account/update-prefs.md +0 -15
- data/docs/examples/account/update-recovery.md +0 -15
- data/docs/examples/account/update-verification.md +0 -15
- data/docs/examples/avatars/get-browser.md +0 -15
- data/docs/examples/avatars/get-credit-card.md +0 -15
- data/docs/examples/avatars/get-favicon.md +0 -15
- data/docs/examples/avatars/get-flag.md +0 -15
- data/docs/examples/avatars/get-image.md +0 -15
- data/docs/examples/avatars/get-initials.md +0 -15
- data/docs/examples/avatars/get-q-r.md +0 -15
- data/docs/examples/database/create-collection.md +0 -15
- data/docs/examples/database/create-document.md +0 -15
- data/docs/examples/database/delete-collection.md +0 -15
- data/docs/examples/database/delete-document.md +0 -15
- data/docs/examples/database/get-collection.md +0 -15
- data/docs/examples/database/get-document.md +0 -15
- data/docs/examples/database/list-collections.md +0 -15
- data/docs/examples/database/list-documents.md +0 -15
- data/docs/examples/database/update-collection.md +0 -15
- data/docs/examples/database/update-document.md +0 -15
- data/docs/examples/functions/create-execution.md +0 -15
- data/docs/examples/functions/create-tag.md +0 -15
- data/docs/examples/functions/create.md +0 -15
- data/docs/examples/functions/delete-tag.md +0 -15
- data/docs/examples/functions/delete.md +0 -15
- data/docs/examples/functions/get-execution.md +0 -15
- data/docs/examples/functions/get-tag.md +0 -15
- data/docs/examples/functions/get.md +0 -15
- data/docs/examples/functions/list-executions.md +0 -15
- data/docs/examples/functions/list-tags.md +0 -15
- data/docs/examples/functions/list.md +0 -15
- data/docs/examples/functions/update-tag.md +0 -15
- data/docs/examples/functions/update.md +0 -15
- data/docs/examples/health/get-anti-virus.md +0 -15
- data/docs/examples/health/get-cache.md +0 -15
- data/docs/examples/health/get-d-b.md +0 -15
- data/docs/examples/health/get-queue-certificates.md +0 -15
- data/docs/examples/health/get-queue-functions.md +0 -15
- data/docs/examples/health/get-queue-logs.md +0 -15
- data/docs/examples/health/get-queue-tasks.md +0 -15
- data/docs/examples/health/get-queue-usage.md +0 -15
- data/docs/examples/health/get-queue-webhooks.md +0 -15
- data/docs/examples/health/get-storage-local.md +0 -15
- data/docs/examples/health/get-time.md +0 -15
- data/docs/examples/health/get.md +0 -15
- data/docs/examples/locale/get-continents.md +0 -15
- data/docs/examples/locale/get-countries-e-u.md +0 -15
- data/docs/examples/locale/get-countries-phones.md +0 -15
- data/docs/examples/locale/get-countries.md +0 -15
- data/docs/examples/locale/get-currencies.md +0 -15
- data/docs/examples/locale/get-languages.md +0 -15
- data/docs/examples/locale/get.md +0 -15
- data/docs/examples/storage/create-file.md +0 -15
- data/docs/examples/storage/delete-file.md +0 -15
- data/docs/examples/storage/get-file-download.md +0 -15
- data/docs/examples/storage/get-file-preview.md +0 -15
- data/docs/examples/storage/get-file-view.md +0 -15
- data/docs/examples/storage/get-file.md +0 -15
- data/docs/examples/storage/list-files.md +0 -15
- data/docs/examples/storage/update-file.md +0 -15
- data/docs/examples/teams/create-membership.md +0 -15
- data/docs/examples/teams/create.md +0 -15
- data/docs/examples/teams/delete-membership.md +0 -15
- data/docs/examples/teams/delete.md +0 -15
- data/docs/examples/teams/get-memberships.md +0 -15
- data/docs/examples/teams/get.md +0 -15
- data/docs/examples/teams/list.md +0 -15
- data/docs/examples/teams/update-membership-roles.md +0 -15
- data/docs/examples/teams/update-membership-status.md +0 -15
- data/docs/examples/teams/update.md +0 -15
- data/docs/examples/users/create.md +0 -15
- data/docs/examples/users/delete-session.md +0 -15
- data/docs/examples/users/delete-sessions.md +0 -15
- data/docs/examples/users/delete.md +0 -15
- data/docs/examples/users/get-logs.md +0 -15
- data/docs/examples/users/get-prefs.md +0 -15
- data/docs/examples/users/get-sessions.md +0 -15
- data/docs/examples/users/get.md +0 -15
- data/docs/examples/users/list.md +0 -15
- data/docs/examples/users/update-prefs.md +0 -15
- data/docs/examples/users/update-status.md +0 -15
|
@@ -1,33 +1,64 @@
|
|
|
1
|
+
#frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module Appwrite
|
|
2
4
|
class Functions < Service
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
include Models
|
|
7
|
+
# Get a list of all the project's functions. You can use the query params to
|
|
8
|
+
# filter your results.
|
|
9
|
+
#
|
|
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.
|
|
15
|
+
# @param [string] order_type Order result by ASC or DESC order.
|
|
16
|
+
#
|
|
17
|
+
# @return [FunctionList]
|
|
18
|
+
def list(search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
|
|
5
19
|
path = '/functions'
|
|
6
20
|
|
|
7
|
-
params = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
params = {
|
|
22
|
+
search: search,
|
|
23
|
+
limit: limit,
|
|
24
|
+
offset: offset,
|
|
25
|
+
cursor: cursor,
|
|
26
|
+
cursorDirection: cursor_direction,
|
|
27
|
+
orderType: order_type,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
headers = {
|
|
31
|
+
"content-type": 'application/json',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@client.call(
|
|
35
|
+
method: 'GET',
|
|
36
|
+
path: path,
|
|
37
|
+
params: params,
|
|
38
|
+
headers: headers,
|
|
39
|
+
response_type: FunctionList
|
|
40
|
+
)
|
|
41
|
+
end
|
|
20
42
|
|
|
21
|
-
|
|
22
|
-
|
|
43
|
+
# Create a new function. You can pass a list of
|
|
44
|
+
# [permissions](/docs/permissions) to allow different project users or team
|
|
45
|
+
# with access to execute the function using the client API.
|
|
46
|
+
#
|
|
47
|
+
# @param [string] function_id Function ID. Choose your own unique ID or pass the string `unique()` to auto generate it. 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.
|
|
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.
|
|
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.
|
|
53
|
+
# @param [string] schedule Schedule CRON syntax.
|
|
54
|
+
# @param [number] timeout Function maximum execution time in seconds.
|
|
55
|
+
#
|
|
56
|
+
# @return [Function]
|
|
57
|
+
def create(function_id:, name:, execute:, runtime:, vars: nil, events: nil, schedule: nil, timeout: nil)
|
|
58
|
+
if function_id.nil?
|
|
59
|
+
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
23
60
|
end
|
|
24
61
|
|
|
25
|
-
return @client.call('get', path, {
|
|
26
|
-
'content-type' => 'application/json',
|
|
27
|
-
}, params);
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def create(name:, execute:, env:, vars: nil, events: nil, schedule: nil, timeout: nil)
|
|
31
62
|
if name.nil?
|
|
32
63
|
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
33
64
|
end
|
|
@@ -36,47 +67,64 @@ module Appwrite
|
|
|
36
67
|
raise Appwrite::Exception.new('Missing required parameter: "execute"')
|
|
37
68
|
end
|
|
38
69
|
|
|
39
|
-
if
|
|
40
|
-
raise Appwrite::Exception.new('Missing required parameter: "
|
|
70
|
+
if runtime.nil?
|
|
71
|
+
raise Appwrite::Exception.new('Missing required parameter: "runtime"')
|
|
41
72
|
end
|
|
42
73
|
|
|
43
74
|
path = '/functions'
|
|
44
75
|
|
|
45
|
-
params = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
params[:schedule] = schedule
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
if !timeout.nil?
|
|
72
|
-
params[:timeout] = timeout
|
|
73
|
-
end
|
|
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
|
+
|
|
91
|
+
@client.call(
|
|
92
|
+
method: 'POST',
|
|
93
|
+
path: path,
|
|
94
|
+
params: params,
|
|
95
|
+
headers: headers,
|
|
96
|
+
response_type: Function
|
|
97
|
+
)
|
|
98
|
+
end
|
|
74
99
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
100
|
+
# Get a list of all runtimes that are currently active in your project.
|
|
101
|
+
#
|
|
102
|
+
#
|
|
103
|
+
# @return [RuntimeList]
|
|
104
|
+
def list_runtimes()
|
|
105
|
+
path = '/functions/runtimes'
|
|
106
|
+
|
|
107
|
+
params = {
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
headers = {
|
|
111
|
+
"content-type": 'application/json',
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@client.call(
|
|
115
|
+
method: 'GET',
|
|
116
|
+
path: path,
|
|
117
|
+
params: params,
|
|
118
|
+
headers: headers,
|
|
119
|
+
response_type: RuntimeList
|
|
120
|
+
)
|
|
78
121
|
end
|
|
79
122
|
|
|
123
|
+
# Get a function by its unique ID.
|
|
124
|
+
#
|
|
125
|
+
# @param [string] function_id Function ID.
|
|
126
|
+
#
|
|
127
|
+
# @return [Function]
|
|
80
128
|
def get(function_id:)
|
|
81
129
|
if function_id.nil?
|
|
82
130
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -85,13 +133,33 @@ module Appwrite
|
|
|
85
133
|
path = '/functions/{functionId}'
|
|
86
134
|
.gsub('{functionId}', function_id)
|
|
87
135
|
|
|
88
|
-
params = {
|
|
136
|
+
params = {
|
|
137
|
+
}
|
|
89
138
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
139
|
+
headers = {
|
|
140
|
+
"content-type": 'application/json',
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@client.call(
|
|
144
|
+
method: 'GET',
|
|
145
|
+
path: path,
|
|
146
|
+
params: params,
|
|
147
|
+
headers: headers,
|
|
148
|
+
response_type: Function
|
|
149
|
+
)
|
|
93
150
|
end
|
|
94
151
|
|
|
152
|
+
# Update function by its unique ID.
|
|
153
|
+
#
|
|
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.
|
|
157
|
+
# @param [object] vars Key-value JSON object that will be passed to the function as environment variables.
|
|
158
|
+
# @param [array] events Events list.
|
|
159
|
+
# @param [string] schedule Schedule CRON syntax.
|
|
160
|
+
# @param [number] timeout Maximum execution time in seconds.
|
|
161
|
+
#
|
|
162
|
+
# @return [Function]
|
|
95
163
|
def update(function_id:, name:, execute:, vars: nil, events: nil, schedule: nil, timeout: nil)
|
|
96
164
|
if function_id.nil?
|
|
97
165
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -108,37 +176,33 @@ module Appwrite
|
|
|
108
176
|
path = '/functions/{functionId}'
|
|
109
177
|
.gsub('{functionId}', function_id)
|
|
110
178
|
|
|
111
|
-
params = {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
if !timeout.nil?
|
|
134
|
-
params[:timeout] = timeout
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
return @client.call('put', path, {
|
|
138
|
-
'content-type' => 'application/json',
|
|
139
|
-
}, params);
|
|
179
|
+
params = {
|
|
180
|
+
name: name,
|
|
181
|
+
execute: execute,
|
|
182
|
+
vars: vars,
|
|
183
|
+
events: events,
|
|
184
|
+
schedule: schedule,
|
|
185
|
+
timeout: timeout,
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
headers = {
|
|
189
|
+
"content-type": 'application/json',
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@client.call(
|
|
193
|
+
method: 'PUT',
|
|
194
|
+
path: path,
|
|
195
|
+
params: params,
|
|
196
|
+
headers: headers,
|
|
197
|
+
response_type: Function
|
|
198
|
+
)
|
|
140
199
|
end
|
|
141
200
|
|
|
201
|
+
# Delete a function by its unique ID.
|
|
202
|
+
#
|
|
203
|
+
# @param [string] function_id Function ID.
|
|
204
|
+
#
|
|
205
|
+
# @return []
|
|
142
206
|
def delete(function_id:)
|
|
143
207
|
if function_id.nil?
|
|
144
208
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -147,14 +211,35 @@ module Appwrite
|
|
|
147
211
|
path = '/functions/{functionId}'
|
|
148
212
|
.gsub('{functionId}', function_id)
|
|
149
213
|
|
|
150
|
-
params = {
|
|
214
|
+
params = {
|
|
215
|
+
}
|
|
151
216
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
217
|
+
headers = {
|
|
218
|
+
"content-type": 'application/json',
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
@client.call(
|
|
222
|
+
method: 'DELETE',
|
|
223
|
+
path: path,
|
|
224
|
+
params: params,
|
|
225
|
+
headers: headers,
|
|
226
|
+
)
|
|
155
227
|
end
|
|
156
228
|
|
|
157
|
-
|
|
229
|
+
# Get a list of all the current user function execution logs. You can use the
|
|
230
|
+
# query params to filter your results. On admin mode, this endpoint will
|
|
231
|
+
# return a list of all of the project's executions. [Learn more about
|
|
232
|
+
# different API modes](/docs/admin).
|
|
233
|
+
#
|
|
234
|
+
# @param [string] function_id Function ID.
|
|
235
|
+
# @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.
|
|
236
|
+
# @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)
|
|
237
|
+
# @param [string] search Search term to filter your list results. Max length: 256 chars.
|
|
238
|
+
# @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)
|
|
239
|
+
# @param [string] cursor_direction Direction of the cursor.
|
|
240
|
+
#
|
|
241
|
+
# @return [ExecutionList]
|
|
242
|
+
def list_executions(function_id:, limit: nil, offset: nil, search: nil, cursor: nil, cursor_direction: nil)
|
|
158
243
|
if function_id.nil?
|
|
159
244
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
160
245
|
end
|
|
@@ -162,29 +247,36 @@ module Appwrite
|
|
|
162
247
|
path = '/functions/{functionId}/executions'
|
|
163
248
|
.gsub('{functionId}', function_id)
|
|
164
249
|
|
|
165
|
-
params = {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
params
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
'content-type' => 'application/json',
|
|
185
|
-
}, params);
|
|
250
|
+
params = {
|
|
251
|
+
limit: limit,
|
|
252
|
+
offset: offset,
|
|
253
|
+
search: search,
|
|
254
|
+
cursor: cursor,
|
|
255
|
+
cursorDirection: cursor_direction,
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
headers = {
|
|
259
|
+
"content-type": 'application/json',
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
@client.call(
|
|
263
|
+
method: 'GET',
|
|
264
|
+
path: path,
|
|
265
|
+
params: params,
|
|
266
|
+
headers: headers,
|
|
267
|
+
response_type: ExecutionList
|
|
268
|
+
)
|
|
186
269
|
end
|
|
187
270
|
|
|
271
|
+
# Trigger a function execution. The returned object will return you the
|
|
272
|
+
# current execution status. You can ping the `Get Execution` endpoint to get
|
|
273
|
+
# updates on the current execution status. Once this endpoint is called, your
|
|
274
|
+
# function execution process will start asynchronously.
|
|
275
|
+
#
|
|
276
|
+
# @param [string] function_id Function ID.
|
|
277
|
+
# @param [string] data String of custom data to send to function.
|
|
278
|
+
#
|
|
279
|
+
# @return [Execution]
|
|
188
280
|
def create_execution(function_id:, data: nil)
|
|
189
281
|
if function_id.nil?
|
|
190
282
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -193,17 +285,29 @@ module Appwrite
|
|
|
193
285
|
path = '/functions/{functionId}/executions'
|
|
194
286
|
.gsub('{functionId}', function_id)
|
|
195
287
|
|
|
196
|
-
params = {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
288
|
+
params = {
|
|
289
|
+
data: data,
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
headers = {
|
|
293
|
+
"content-type": 'application/json',
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@client.call(
|
|
297
|
+
method: 'POST',
|
|
298
|
+
path: path,
|
|
299
|
+
params: params,
|
|
300
|
+
headers: headers,
|
|
301
|
+
response_type: Execution
|
|
302
|
+
)
|
|
205
303
|
end
|
|
206
304
|
|
|
305
|
+
# Get a function execution log by its unique ID.
|
|
306
|
+
#
|
|
307
|
+
# @param [string] function_id Function ID.
|
|
308
|
+
# @param [string] execution_id Execution ID.
|
|
309
|
+
#
|
|
310
|
+
# @return [Execution]
|
|
207
311
|
def get_execution(function_id:, execution_id:)
|
|
208
312
|
if function_id.nil?
|
|
209
313
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -217,13 +321,30 @@ module Appwrite
|
|
|
217
321
|
.gsub('{functionId}', function_id)
|
|
218
322
|
.gsub('{executionId}', execution_id)
|
|
219
323
|
|
|
220
|
-
params = {
|
|
324
|
+
params = {
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
headers = {
|
|
328
|
+
"content-type": 'application/json',
|
|
329
|
+
}
|
|
221
330
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
331
|
+
@client.call(
|
|
332
|
+
method: 'GET',
|
|
333
|
+
path: path,
|
|
334
|
+
params: params,
|
|
335
|
+
headers: headers,
|
|
336
|
+
response_type: Execution
|
|
337
|
+
)
|
|
225
338
|
end
|
|
226
339
|
|
|
340
|
+
# Update the function code tag ID using the unique function ID. Use this
|
|
341
|
+
# endpoint to switch the code tag that should be executed by the execution
|
|
342
|
+
# endpoint.
|
|
343
|
+
#
|
|
344
|
+
# @param [string] function_id Function ID.
|
|
345
|
+
# @param [string] tag Tag ID.
|
|
346
|
+
#
|
|
347
|
+
# @return [Function]
|
|
227
348
|
def update_tag(function_id:, tag:)
|
|
228
349
|
if function_id.nil?
|
|
229
350
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -236,18 +357,36 @@ module Appwrite
|
|
|
236
357
|
path = '/functions/{functionId}/tag'
|
|
237
358
|
.gsub('{functionId}', function_id)
|
|
238
359
|
|
|
239
|
-
params = {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
360
|
+
params = {
|
|
361
|
+
tag: tag,
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
headers = {
|
|
365
|
+
"content-type": 'application/json',
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
@client.call(
|
|
369
|
+
method: 'PATCH',
|
|
370
|
+
path: path,
|
|
371
|
+
params: params,
|
|
372
|
+
headers: headers,
|
|
373
|
+
response_type: Function
|
|
374
|
+
)
|
|
248
375
|
end
|
|
249
376
|
|
|
250
|
-
|
|
377
|
+
# Get a list of all the project's code tags. You can use the query params to
|
|
378
|
+
# filter your results.
|
|
379
|
+
#
|
|
380
|
+
# @param [string] function_id Function ID.
|
|
381
|
+
# @param [string] search Search term to filter your list results. Max length: 256 chars.
|
|
382
|
+
# @param [number] limit Maximum number of tags to return in response. By default will return maximum 25 results. Maximum of 100 results allowed per request.
|
|
383
|
+
# @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)
|
|
384
|
+
# @param [string] cursor ID of the tag used as the starting point for the query, excluding the tag itself. Should be used for efficient pagination when working with large sets of data. [learn more about pagination](https://appwrite.io/docs/pagination)
|
|
385
|
+
# @param [string] cursor_direction Direction of the cursor.
|
|
386
|
+
# @param [string] order_type Order result by ASC or DESC order.
|
|
387
|
+
#
|
|
388
|
+
# @return [TagList]
|
|
389
|
+
def list_tags(function_id:, search: nil, limit: nil, offset: nil, cursor: nil, cursor_direction: nil, order_type: nil)
|
|
251
390
|
if function_id.nil?
|
|
252
391
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
253
392
|
end
|
|
@@ -255,29 +394,44 @@ module Appwrite
|
|
|
255
394
|
path = '/functions/{functionId}/tags'
|
|
256
395
|
.gsub('{functionId}', function_id)
|
|
257
396
|
|
|
258
|
-
params = {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}, params);
|
|
397
|
+
params = {
|
|
398
|
+
search: search,
|
|
399
|
+
limit: limit,
|
|
400
|
+
offset: offset,
|
|
401
|
+
cursor: cursor,
|
|
402
|
+
cursorDirection: cursor_direction,
|
|
403
|
+
orderType: order_type,
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
headers = {
|
|
407
|
+
"content-type": 'application/json',
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
@client.call(
|
|
411
|
+
method: 'GET',
|
|
412
|
+
path: path,
|
|
413
|
+
params: params,
|
|
414
|
+
headers: headers,
|
|
415
|
+
response_type: TagList
|
|
416
|
+
)
|
|
279
417
|
end
|
|
280
418
|
|
|
419
|
+
# Create a new function code tag. Use this endpoint to upload a new version
|
|
420
|
+
# of your code function. To execute your newly uploaded code, you'll need to
|
|
421
|
+
# update the function's tag to use your new tag UID.
|
|
422
|
+
#
|
|
423
|
+
# This endpoint accepts a tar.gz file compressed with your code. Make sure to
|
|
424
|
+
# include any dependencies your code has within the compressed file. You can
|
|
425
|
+
# learn more about code packaging in the [Appwrite Cloud Functions
|
|
426
|
+
# tutorial](/docs/functions).
|
|
427
|
+
#
|
|
428
|
+
# Use the "command" param to set the entry point used to execute your code.
|
|
429
|
+
#
|
|
430
|
+
# @param [string] function_id Function ID.
|
|
431
|
+
# @param [string] command Code execution command.
|
|
432
|
+
# @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.
|
|
433
|
+
#
|
|
434
|
+
# @return [Tag]
|
|
281
435
|
def create_tag(function_id:, command:, code:)
|
|
282
436
|
if function_id.nil?
|
|
283
437
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -294,21 +448,30 @@ module Appwrite
|
|
|
294
448
|
path = '/functions/{functionId}/tags'
|
|
295
449
|
.gsub('{functionId}', function_id)
|
|
296
450
|
|
|
297
|
-
params = {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
451
|
+
params = {
|
|
452
|
+
command: command,
|
|
453
|
+
code: code,
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
headers = {
|
|
457
|
+
"content-type": 'multipart/form-data',
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
@client.call(
|
|
461
|
+
method: 'POST',
|
|
462
|
+
path: path,
|
|
463
|
+
params: params,
|
|
464
|
+
headers: headers,
|
|
465
|
+
response_type: Tag
|
|
466
|
+
)
|
|
310
467
|
end
|
|
311
468
|
|
|
469
|
+
# Get a code tag by its unique ID.
|
|
470
|
+
#
|
|
471
|
+
# @param [string] function_id Function ID.
|
|
472
|
+
# @param [string] tag_id Tag ID.
|
|
473
|
+
#
|
|
474
|
+
# @return [Tag]
|
|
312
475
|
def get_tag(function_id:, tag_id:)
|
|
313
476
|
if function_id.nil?
|
|
314
477
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -322,13 +485,28 @@ module Appwrite
|
|
|
322
485
|
.gsub('{functionId}', function_id)
|
|
323
486
|
.gsub('{tagId}', tag_id)
|
|
324
487
|
|
|
325
|
-
params = {
|
|
488
|
+
params = {
|
|
489
|
+
}
|
|
326
490
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
491
|
+
headers = {
|
|
492
|
+
"content-type": 'application/json',
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
@client.call(
|
|
496
|
+
method: 'GET',
|
|
497
|
+
path: path,
|
|
498
|
+
params: params,
|
|
499
|
+
headers: headers,
|
|
500
|
+
response_type: Tag
|
|
501
|
+
)
|
|
330
502
|
end
|
|
331
503
|
|
|
504
|
+
# Delete a code tag by its unique ID.
|
|
505
|
+
#
|
|
506
|
+
# @param [string] function_id Function ID.
|
|
507
|
+
# @param [string] tag_id Tag ID.
|
|
508
|
+
#
|
|
509
|
+
# @return []
|
|
332
510
|
def delete_tag(function_id:, tag_id:)
|
|
333
511
|
if function_id.nil?
|
|
334
512
|
raise Appwrite::Exception.new('Missing required parameter: "functionId"')
|
|
@@ -342,16 +520,20 @@ module Appwrite
|
|
|
342
520
|
.gsub('{functionId}', function_id)
|
|
343
521
|
.gsub('{tagId}', tag_id)
|
|
344
522
|
|
|
345
|
-
params = {
|
|
346
|
-
|
|
347
|
-
return @client.call('delete', path, {
|
|
348
|
-
'content-type' => 'application/json',
|
|
349
|
-
}, params);
|
|
350
|
-
end
|
|
523
|
+
params = {
|
|
524
|
+
}
|
|
351
525
|
|
|
526
|
+
headers = {
|
|
527
|
+
"content-type": 'application/json',
|
|
528
|
+
}
|
|
352
529
|
|
|
353
|
-
|
|
530
|
+
@client.call(
|
|
531
|
+
method: 'DELETE',
|
|
532
|
+
path: path,
|
|
533
|
+
params: params,
|
|
534
|
+
headers: headers,
|
|
535
|
+
)
|
|
536
|
+
end
|
|
354
537
|
|
|
355
|
-
private
|
|
356
538
|
end
|
|
357
539
|
end
|