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