Class: Mudbase::FunctionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mudbase/api/functions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FunctionsApi

Returns a new instance of FunctionsApi.



19
20
21
# File 'lib/mudbase/api/functions_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/mudbase/api/functions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#activate_function(project_id, function_id, opts = {}) ⇒ FunctionResponse

Activate function Activate a deactivated function. Active functions can be triggered.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/mudbase/api/functions_api.rb', line 28

def activate_function(project_id, function_id, opts = {})
  data, _status_code, _headers = activate_function_with_http_info(project_id, function_id, opts)
  data
end

#activate_function_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(FunctionResponse, Integer, Hash)>

Activate function Activate a deactivated function. Active functions can be triggered.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FunctionResponse, Integer, Hash)>)

    FunctionResponse data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/mudbase/api/functions_api.rb', line 39

def activate_function_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.activate_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.activate_function"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.activate_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/activate'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.activate_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#activate_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_function(project_id, create_function_request, opts = {}) ⇒ FunctionResponse

Create function Create a new serverless function. Trigger types: http, document, file, webhook, wallet, cron, messaging. Sandbox globals available today: payload, context, env, console. Function code runs in an isolated worker with no ambient network or database access — it can only read its trigger payload, the env vars you configure, and return a JSON-serializable result; it cannot yet call back into your project's database, storage, messaging, or wallet APIs from inside the function body. If you need to read or write project data from a function, call the regular REST API (with your own API key) from your own backend in response to the function's returned result, rather than from within the function's own code.

Parameters:

  • project_id (String)
  • create_function_request (CreateFunctionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



97
98
99
100
# File 'lib/mudbase/api/functions_api.rb', line 97

def create_function(project_id, create_function_request, opts = {})
  data, _status_code, _headers = create_function_with_http_info(project_id, create_function_request, opts)
  data
end

#create_function_with_http_info(project_id, create_function_request, opts = {}) ⇒ Array<(FunctionResponse, Integer, Hash)>

Create function Create a new serverless function. Trigger types: http, document, file, webhook, wallet, cron, messaging. Sandbox globals available today: `payload`, `context`, `env`, `console`. Function code runs in an isolated worker with no ambient network or database access — it can only read its trigger payload, the `env` vars you configure, and return a JSON-serializable result; it cannot yet call back into your project's database, storage, messaging, or wallet APIs from inside the function body. If you need to read or write project data from a function, call the regular REST API (with your own API key) from your own backend in response to the function's returned result, rather than from within the function's own code.

Parameters:

  • project_id (String)
  • create_function_request (CreateFunctionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FunctionResponse, Integer, Hash)>)

    FunctionResponse data, response status code and response headers



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/mudbase/api/functions_api.rb', line 108

def create_function_with_http_info(project_id, create_function_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.create_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.create_function"
  end
  # verify the required parameter 'create_function_request' is set
  if @api_client.config.client_side_validation && create_function_request.nil?
    fail ArgumentError, "Missing the required parameter 'create_function_request' when calling FunctionsApi.create_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(create_function_request)

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.create_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#create_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#deactivate_function(project_id, function_id, opts = {}) ⇒ FunctionResponse

Deactivate function Deactivate a function. Deactivated functions will not be triggered.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



171
172
173
174
# File 'lib/mudbase/api/functions_api.rb', line 171

def deactivate_function(project_id, function_id, opts = {})
  data, _status_code, _headers = deactivate_function_with_http_info(project_id, function_id, opts)
  data
end

#deactivate_function_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(FunctionResponse, Integer, Hash)>

Deactivate function Deactivate a function. Deactivated functions will not be triggered.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FunctionResponse, Integer, Hash)>)

    FunctionResponse data, response status code and response headers



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/mudbase/api/functions_api.rb', line 182

def deactivate_function_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.deactivate_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.deactivate_function"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.deactivate_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/deactivate'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.deactivate_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#deactivate_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_function(project_id, function_id, opts = {}) ⇒ DeleteFunction200Response

Delete function Delete a function permanently. This is a destructive operation.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



240
241
242
243
# File 'lib/mudbase/api/functions_api.rb', line 240

def delete_function(project_id, function_id, opts = {})
  data, _status_code, _headers = delete_function_with_http_info(project_id, function_id, opts)
  data
end

#delete_function_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(DeleteFunction200Response, Integer, Hash)>

Delete function Delete a function permanently. This is a destructive operation.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DeleteFunction200Response, Integer, Hash)>)

    DeleteFunction200Response data, response status code and response headers



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/mudbase/api/functions_api.rb', line 251

def delete_function_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.delete_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.delete_function"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.delete_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'DeleteFunction200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.delete_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#delete_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#execute_function(project_id, function_id, opts = {}) ⇒ FunctionExecutionResponse

Execute function Manually execute a function with custom payload. Payload is merged with auto-injected trigger context. Rate limited (data mutation rate limiter). Enforces maxExecutionsPerMinute/maxExecutionsPerHour. This endpoint is asynchronous: it returns 202 immediately with an executionId, before the function has necessarily finished running. Poll GET /api/functions/projects/{projectId}/functions/{functionId}/executions/{executionId} until status leaves queued/running to get the real result, error, and duration.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



310
311
312
313
# File 'lib/mudbase/api/functions_api.rb', line 310

def execute_function(project_id, function_id, opts = {})
  data, _status_code, _headers = execute_function_with_http_info(project_id, function_id, opts)
  data
end

#execute_function_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(FunctionExecutionResponse, Integer, Hash)>

Execute function Manually execute a function with custom payload. Payload is merged with auto-injected trigger context. Rate limited (data mutation rate limiter). Enforces maxExecutionsPerMinute/maxExecutionsPerHour. This endpoint is asynchronous: it returns 202 immediately with an `executionId`, before the function has necessarily finished running. Poll `GET /api/functions/projects/projectId/functions/functionId/executions/executionId` until `status` leaves `queued`/`running` to get the real result, error, and duration.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(FunctionExecutionResponse, Integer, Hash)>)

    FunctionExecutionResponse data, response status code and response headers



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/mudbase/api/functions_api.rb', line 322

def execute_function_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.execute_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.execute_function"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.execute_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/execute'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'execute_function_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionExecutionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.execute_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#execute_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_function(project_id, function_id, opts = {}) ⇒ FunctionResponse

Get function Get function details by ID including createdBy/updatedBy.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



385
386
387
388
# File 'lib/mudbase/api/functions_api.rb', line 385

def get_function(project_id, function_id, opts = {})
  data, _status_code, _headers = get_function_with_http_info(project_id, function_id, opts)
  data
end

#get_function_execution(project_id, function_id, execution_id, opts = {}) ⇒ FunctionExecutionStatusResponse

Get execution status Poll this after Execute function or Simulate trigger to get the real outcome — both of those endpoints return 202 immediately and do not carry the result themselves. status is one of queued, provisioning, running, success, failed, timeout; result/error/durationMs/logs are only populated once status leaves queued/running.

Parameters:

  • project_id (String)
  • function_id (String)
  • execution_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



455
456
457
458
# File 'lib/mudbase/api/functions_api.rb', line 455

def get_function_execution(project_id, function_id, execution_id, opts = {})
  data, _status_code, _headers = get_function_execution_with_http_info(project_id, function_id, execution_id, opts)
  data
end

#get_function_execution_with_http_info(project_id, function_id, execution_id, opts = {}) ⇒ Array<(FunctionExecutionStatusResponse, Integer, Hash)>

Get execution status Poll this after Execute function or Simulate trigger to get the real outcome — both of those endpoints return 202 immediately and do not carry the result themselves. `status` is one of `queued`, `provisioning`, `running`, `success`, `failed`, `timeout`; `result`/`error`/`durationMs`/`logs` are only populated once `status` leaves `queued`/`running`.

Parameters:

  • project_id (String)
  • function_id (String)
  • execution_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/mudbase/api/functions_api.rb', line 467

def get_function_execution_with_http_info(project_id, function_id, execution_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.get_function_execution ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.get_function_execution"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.get_function_execution"
  end
  # verify the required parameter 'execution_id' is set
  if @api_client.config.client_side_validation && execution_id.nil?
    fail ArgumentError, "Missing the required parameter 'execution_id' when calling FunctionsApi.get_function_execution"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/executions/{executionId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s)).sub('{' + 'executionId' + '}', CGI.escape(execution_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionExecutionStatusResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.get_function_execution",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#get_function_execution\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_function_logs(project_id, function_id, opts = {}) ⇒ FunctionLogsResponse

Get function execution logs Get execution logs with pagination. Includes stats (totalExecutions, successful, failed, successRate, avgExecutionTime, lastRun).

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 50
  • :offset (Integer) — default: default to 0

Returns:



531
532
533
534
# File 'lib/mudbase/api/functions_api.rb', line 531

def get_function_logs(project_id, function_id, opts = {})
  data, _status_code, _headers = get_function_logs_with_http_info(project_id, function_id, opts)
  data
end

#get_function_logs_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(FunctionLogsResponse, Integer, Hash)>

Get function execution logs Get execution logs with pagination. Includes stats (totalExecutions, successful, failed, successRate, avgExecutionTime, lastRun).

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer) — default: default to 50
  • :offset (Integer) — default: default to 0

Returns:

  • (Array<(FunctionLogsResponse, Integer, Hash)>)

    FunctionLogsResponse data, response status code and response headers



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
# File 'lib/mudbase/api/functions_api.rb', line 544

def get_function_logs_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.get_function_logs ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.get_function_logs"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.get_function_logs"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/logs'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionLogsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.get_function_logs",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#get_function_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_function_versions(project_id, function_id, opts = {}) ⇒ GetFunctionVersions200Response

Get function versions List all code versions for a function. Used for rollback.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



604
605
606
607
# File 'lib/mudbase/api/functions_api.rb', line 604

def get_function_versions(project_id, function_id, opts = {})
  data, _status_code, _headers = get_function_versions_with_http_info(project_id, function_id, opts)
  data
end

#get_function_versions_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(GetFunctionVersions200Response, Integer, Hash)>

Get function versions List all code versions for a function. Used for rollback.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/mudbase/api/functions_api.rb', line 615

def get_function_versions_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.get_function_versions ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.get_function_versions"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.get_function_versions"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/versions'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetFunctionVersions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.get_function_versions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#get_function_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_function_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(FunctionResponse, Integer, Hash)>

Get function Get function details by ID including createdBy/updatedBy.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FunctionResponse, Integer, Hash)>)

    FunctionResponse data, response status code and response headers



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/mudbase/api/functions_api.rb', line 396

def get_function_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.get_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.get_function"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.get_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.get_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#get_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_functions(project_id, opts = {}) ⇒ FunctionListResponse

List functions List serverless functions in a project with optional search and filters. Supports trigger types: http, event, document, file, webhook, wallet, cron, messaging.

Parameters:

  • project_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 20
  • :search (String)

    Search by name or description

  • :trigger_type (String)

    Filter by trigger type

  • :is_active (Boolean)

    Filter by active status (true/false)

Returns:



677
678
679
680
# File 'lib/mudbase/api/functions_api.rb', line 677

def list_functions(project_id, opts = {})
  data, _status_code, _headers = list_functions_with_http_info(project_id, opts)
  data
end

#list_functions_with_http_info(project_id, opts = {}) ⇒ Array<(FunctionListResponse, Integer, Hash)>

List functions List serverless functions in a project with optional search and filters. Supports trigger types: http, event, document, file, webhook, wallet, cron, messaging.

Parameters:

  • project_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :page (Integer) — default: default to 1
  • :limit (Integer) — default: default to 20
  • :search (String)

    Search by name or description

  • :trigger_type (String)

    Filter by trigger type

  • :is_active (Boolean)

    Filter by active status (true/false)

Returns:

  • (Array<(FunctionListResponse, Integer, Hash)>)

    FunctionListResponse data, response status code and response headers



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
# File 'lib/mudbase/api/functions_api.rb', line 692

def list_functions_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.list_functions ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.list_functions"
  end
  allowable_values = ["http", "event", "document", "file", "webhook", "wallet", "cron", "messaging"]
  if @api_client.config.client_side_validation && opts[:'trigger_type'] && !allowable_values.include?(opts[:'trigger_type'])
    fail ArgumentError, "invalid value for \"trigger_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?
  query_params[:'triggerType'] = opts[:'trigger_type'] if !opts[:'trigger_type'].nil?
  query_params[:'isActive'] = opts[:'is_active'] if !opts[:'is_active'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.list_functions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#list_functions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#retry_function_execution(project_id, function_id, execution_index, opts = {}) ⇒ FunctionExecutionResponse

Retry failed execution Retry a failed execution by its index (0-based) in the logs. Cannot retry successful executions.

Parameters:

  • project_id (String)
  • function_id (String)
  • execution_index (Integer)

    0-based index of the execution in logs

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



756
757
758
759
# File 'lib/mudbase/api/functions_api.rb', line 756

def retry_function_execution(project_id, function_id, execution_index, opts = {})
  data, _status_code, _headers = retry_function_execution_with_http_info(project_id, function_id, execution_index, opts)
  data
end

#retry_function_execution_with_http_info(project_id, function_id, execution_index, opts = {}) ⇒ Array<(FunctionExecutionResponse, Integer, Hash)>

Retry failed execution Retry a failed execution by its index (0-based) in the logs. Cannot retry successful executions.

Parameters:

  • project_id (String)
  • function_id (String)
  • execution_index (Integer)

    0-based index of the execution in logs

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FunctionExecutionResponse, Integer, Hash)>)

    FunctionExecutionResponse data, response status code and response headers



768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
# File 'lib/mudbase/api/functions_api.rb', line 768

def retry_function_execution_with_http_info(project_id, function_id, execution_index, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.retry_function_execution ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.retry_function_execution"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.retry_function_execution"
  end
  # verify the required parameter 'execution_index' is set
  if @api_client.config.client_side_validation && execution_index.nil?
    fail ArgumentError, "Missing the required parameter 'execution_index' when calling FunctionsApi.retry_function_execution"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/retry/{executionIndex}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s)).sub('{' + 'executionIndex' + '}', CGI.escape(execution_index.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionExecutionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.retry_function_execution",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#retry_function_execution\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#rollback_function(project_id, function_id, rollback_function_request, opts = {}) ⇒ FunctionResponse

Rollback to previous version Rollback function code to a previous version. Version number is required.

Parameters:

  • project_id (String)
  • function_id (String)
  • rollback_function_request (RollbackFunctionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



831
832
833
834
# File 'lib/mudbase/api/functions_api.rb', line 831

def rollback_function(project_id, function_id, rollback_function_request, opts = {})
  data, _status_code, _headers = rollback_function_with_http_info(project_id, function_id, rollback_function_request, opts)
  data
end

#rollback_function_with_http_info(project_id, function_id, rollback_function_request, opts = {}) ⇒ Array<(FunctionResponse, Integer, Hash)>

Rollback to previous version Rollback function code to a previous version. Version number is required.

Parameters:

  • project_id (String)
  • function_id (String)
  • rollback_function_request (RollbackFunctionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(FunctionResponse, Integer, Hash)>)

    FunctionResponse data, response status code and response headers



843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'lib/mudbase/api/functions_api.rb', line 843

def rollback_function_with_http_info(project_id, function_id, rollback_function_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.rollback_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.rollback_function"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.rollback_function"
  end
  # verify the required parameter 'rollback_function_request' is set
  if @api_client.config.client_side_validation && rollback_function_request.nil?
    fail ArgumentError, "Missing the required parameter 'rollback_function_request' when calling FunctionsApi.rollback_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/rollback'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(rollback_function_request)

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.rollback_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#rollback_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#simulate_function_trigger(project_id, function_id, opts = {}) ⇒ FunctionExecutionResponse

Simulate trigger Test a function with simulated trigger context. Use to verify document, file, webhook, wallet, or cron payloads. Executes the function with the provided eventContext merged into the payload. Asynchronous, same pattern as Execute function: returns 202 immediately with an executionId. Poll GET /api/functions/projects/{projectId}/functions/{functionId}/executions/{executionId} for the real result.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



911
912
913
914
# File 'lib/mudbase/api/functions_api.rb', line 911

def simulate_function_trigger(project_id, function_id, opts = {})
  data, _status_code, _headers = simulate_function_trigger_with_http_info(project_id, function_id, opts)
  data
end

#simulate_function_trigger_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(FunctionExecutionResponse, Integer, Hash)>

Simulate trigger Test a function with simulated trigger context. Use to verify document, file, webhook, wallet, or cron payloads. Executes the function with the provided eventContext merged into the payload. Asynchronous, same pattern as Execute function: returns 202 immediately with an `executionId`. Poll `GET /api/functions/projects/projectId/functions/functionId/executions/executionId` for the real result.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(FunctionExecutionResponse, Integer, Hash)>)

    FunctionExecutionResponse data, response status code and response headers



923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
# File 'lib/mudbase/api/functions_api.rb', line 923

def simulate_function_trigger_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.simulate_function_trigger ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.simulate_function_trigger"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.simulate_function_trigger"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}/simulate'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'simulate_function_trigger_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionExecutionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.simulate_function_trigger",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#simulate_function_trigger\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#trigger_function_webhook(project_id, opts = {}) ⇒ TriggerFunctionWebhook200Response

Trigger webhook functions Public endpoint for external services to trigger functions with trigger.type: webhook. No authentication required. Optionally verify using X-Webhook-Secret header (configure per project or via FUNCTION_WEBHOOK_SECRET). Rate limited to 120 requests per 15 minutes per IP (per-org adjustable).

Parameters:

  • project_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_webhook_secret (String)

    Optional webhook secret for verification

  • :body (Object)

Returns:



987
988
989
990
# File 'lib/mudbase/api/functions_api.rb', line 987

def trigger_function_webhook(project_id, opts = {})
  data, _status_code, _headers = trigger_function_webhook_with_http_info(project_id, opts)
  data
end

#trigger_function_webhook_with_http_info(project_id, opts = {}) ⇒ Array<(TriggerFunctionWebhook200Response, Integer, Hash)>

Trigger webhook functions Public endpoint for external services to trigger functions with `trigger.type: webhook`. No authentication required. Optionally verify using `X-Webhook-Secret` header (configure per project or via FUNCTION_WEBHOOK_SECRET). Rate limited to 120 requests per 15 minutes per IP (per-org adjustable).

Parameters:

  • project_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_webhook_secret (String)

    Optional webhook secret for verification

  • :body (Object)

Returns:



999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
# File 'lib/mudbase/api/functions_api.rb', line 999

def trigger_function_webhook_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.trigger_function_webhook ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.trigger_function_webhook"
  end
  # resource path
  local_var_path = '/api/functions/webhook/{projectId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'text/plain'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Webhook-Secret'] = opts[:'x_webhook_secret'] if !opts[:'x_webhook_secret'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'body'])

  # return_type
  return_type = opts[:debug_return_type] || 'TriggerFunctionWebhook200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"FunctionsApi.trigger_function_webhook",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#trigger_function_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_function(project_id, function_id, opts = {}) ⇒ FunctionResponse

Update function Update function configuration. Code changes are versioned automatically.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



1060
1061
1062
1063
# File 'lib/mudbase/api/functions_api.rb', line 1060

def update_function(project_id, function_id, opts = {})
  data, _status_code, _headers = update_function_with_http_info(project_id, function_id, opts)
  data
end

#update_function_with_http_info(project_id, function_id, opts = {}) ⇒ Array<(FunctionResponse, Integer, Hash)>

Update function Update function configuration. Code changes are versioned automatically.

Parameters:

  • project_id (String)
  • function_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(FunctionResponse, Integer, Hash)>)

    FunctionResponse data, response status code and response headers



1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
# File 'lib/mudbase/api/functions_api.rb', line 1072

def update_function_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.update_function ...'
  end
  # verify the required parameter 'project_id' is set
  if @api_client.config.client_side_validation && project_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_id' when calling FunctionsApi.update_function"
  end
  # verify the required parameter 'function_id' is set
  if @api_client.config.client_side_validation && function_id.nil?
    fail ArgumentError, "Missing the required parameter 'function_id' when calling FunctionsApi.update_function"
  end
  # resource path
  local_var_path = '/api/functions/projects/{projectId}/functions/{functionId}'.sub('{' + 'projectId' + '}', CGI.escape(project_id.to_s)).sub('{' + 'functionId' + '}', CGI.escape(function_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_function_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'FunctionResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['OrgBearerAuth', 'ApiKeyAuth', 'ProjectBearerAuth']

  new_options = opts.merge(
    :operation => :"FunctionsApi.update_function",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FunctionsApi#update_function\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end