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

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

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

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to activate.

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

    the optional parameters

Returns:



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

def functions_activate(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_activate_with_http_info(project_id, function_id, opts)
  data
end

#functions_activate_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)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to activate.

  • 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 functions_activate_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_activate ...'
  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.functions_activate"
  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.functions_activate"
  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] || ['ApiKeyAuth', 'BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_activate",
    :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#functions_activate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

Create function Create a new serverless function. Trigger types: http, document, file, webhook, wallet, cron, messaging. Sandbox utilities available: db, files, messaging, wallet, utils, env, console.

Parameters:

  • project_id (String)

    Project ID.

  • create_function_request (CreateFunctionRequest)

    Function name, description, code, trigger config, and optional environment.

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

    the optional parameters

Returns:



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

def functions_create(project_id, create_function_request, opts = {})
  data, _status_code, _headers = functions_create_with_http_info(project_id, create_function_request, opts)
  data
end

#functions_create_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 utilities available: db, files, messaging, wallet, utils, env, console.

Parameters:

  • project_id (String)

    Project ID.

  • create_function_request (CreateFunctionRequest)

    Function name, description, code, trigger config, and optional environment.

  • 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 functions_create_with_http_info(project_id, create_function_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_create ...'
  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.functions_create"
  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.functions_create"
  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] || ['ApiKeyAuth', 'BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_create",
    :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#functions_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

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

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to deactivate.

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

    the optional parameters

Returns:



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

def functions_deactivate(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_deactivate_with_http_info(project_id, function_id, opts)
  data
end

#functions_deactivate_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)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to deactivate.

  • 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 functions_deactivate_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_deactivate ...'
  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.functions_deactivate"
  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.functions_deactivate"
  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] || ['ApiKeyAuth', 'BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_deactivate",
    :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#functions_deactivate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_delete(project_id, function_id, opts = {}) ⇒ FunctionsDelete200Response

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

Parameters:

  • project_id (String)

    Project ID.

  • function_id (String)

    Function ID to delete.

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

    the optional parameters

Returns:



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

def functions_delete(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_delete_with_http_info(project_id, function_id, opts)
  data
end

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

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

Parameters:

  • project_id (String)

    Project ID.

  • function_id (String)

    Function ID to delete.

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

    the optional parameters

Returns:

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

    FunctionsDelete200Response 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 functions_delete_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_delete ...'
  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.functions_delete"
  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.functions_delete"
  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] || 'FunctionsDelete200Response'

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

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_delete",
    :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#functions_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_execute(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.

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to execute.

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

    the optional parameters

Options Hash (opts):

  • :functions_execute_request (FunctionsExecuteRequest)

    Optional JSON payload merged with trigger context (e.g. document, file, webhook body). Omit for no custom input.

Returns:



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

def functions_execute(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_execute_with_http_info(project_id, function_id, opts)
  data
end

#functions_execute_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.

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to execute.

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

    the optional parameters

Options Hash (opts):

  • :functions_execute_request (FunctionsExecuteRequest)

    Optional JSON payload merged with trigger context (e.g. document, file, webhook body). Omit for no custom input.

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 functions_execute_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_execute ...'
  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.functions_execute"
  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.functions_execute"
  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[:'functions_execute_request'])

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

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

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_execute",
    :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#functions_execute\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

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

Parameters:

  • project_id (String)

    Project ID.

  • function_id (String)

    Function ID.

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

    the optional parameters

Returns:



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

def functions_get(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_get_with_http_info(project_id, function_id, opts)
  data
end

#functions_get_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)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to get logs for.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of log entries to return. (default to 50)

  • :offset (Integer)

    Number of log entries to skip for pagination. (default to 0)

Returns:



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

def functions_get_logs(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_get_logs_with_http_info(project_id, function_id, opts)
  data
end

#functions_get_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)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to get logs for.

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    Maximum number of log entries to return. (default to 50)

  • :offset (Integer)

    Number of log entries to skip for pagination. (default to 0)

Returns:

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

    FunctionLogsResponse data, response status code and response headers



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 469

def functions_get_logs_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_get_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.functions_get_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.functions_get_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] || ['BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_get_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#functions_get_logs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_get_versions(project_id, function_id, opts = {}) ⇒ FunctionsGetVersions200Response

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

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to list versions for.

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

    the optional parameters

Returns:



529
530
531
532
# File 'lib/mudbase/api/functions_api.rb', line 529

def functions_get_versions(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_get_versions_with_http_info(project_id, function_id, opts)
  data
end

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

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

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to list versions for.

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

    the optional parameters

Returns:



540
541
542
543
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
# File 'lib/mudbase/api/functions_api.rb', line 540

def functions_get_versions_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_get_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.functions_get_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.functions_get_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] || 'FunctionsGetVersions200Response'

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

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_get_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#functions_get_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_get_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)

    Project ID.

  • function_id (String)

    Function ID.

  • 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 functions_get_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_get ...'
  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.functions_get"
  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.functions_get"
  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] || ['ApiKeyAuth', 'BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_get",
    :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#functions_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_list(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)

    Project ID.

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (1-based). (default to 1)

  • :limit (Integer)

    Number of functions per page. (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:



602
603
604
605
# File 'lib/mudbase/api/functions_api.rb', line 602

def functions_list(project_id, opts = {})
  data, _status_code, _headers = functions_list_with_http_info(project_id, opts)
  data
end

#functions_list_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)

    Project ID.

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    Page number (1-based). (default to 1)

  • :limit (Integer)

    Number of functions per page. (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



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
666
667
668
669
670
671
672
# File 'lib/mudbase/api/functions_api.rb', line 617

def functions_list_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_list ...'
  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.functions_list"
  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] || ['ApiKeyAuth', 'BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_list",
    :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#functions_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_retry(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)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to retry execution for.

  • execution_index (Integer)

    0-based index of the execution in logs

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

    the optional parameters

Returns:



681
682
683
684
# File 'lib/mudbase/api/functions_api.rb', line 681

def functions_retry(project_id, function_id, execution_index, opts = {})
  data, _status_code, _headers = functions_retry_with_http_info(project_id, function_id, execution_index, opts)
  data
end

#functions_retry_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)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to retry execution for.

  • 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



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 693

def functions_retry_with_http_info(project_id, function_id, execution_index, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_retry ...'
  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.functions_retry"
  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.functions_retry"
  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.functions_retry"
  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] || ['ApiKeyAuth', 'BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_retry",
    :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#functions_retry\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

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

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to rollback.

  • functions_rollback_request (FunctionsRollbackRequest)

    Version number (integer) to rollback to; use GET …/versions to list available versions.

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

    the optional parameters

Returns:



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

def functions_rollback(project_id, function_id, functions_rollback_request, opts = {})
  data, _status_code, _headers = functions_rollback_with_http_info(project_id, function_id, functions_rollback_request, opts)
  data
end

#functions_rollback_with_http_info(project_id, function_id, functions_rollback_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)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to rollback.

  • functions_rollback_request (FunctionsRollbackRequest)

    Version number (integer) to rollback to; use GET …/versions to list available versions.

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

    the optional parameters

Returns:

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

    FunctionResponse 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
823
824
825
826
827
# File 'lib/mudbase/api/functions_api.rb', line 768

def functions_rollback_with_http_info(project_id, function_id, functions_rollback_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_rollback ...'
  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.functions_rollback"
  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.functions_rollback"
  end
  # verify the required parameter 'functions_rollback_request' is set
  if @api_client.config.client_side_validation && functions_rollback_request.nil?
    fail ArgumentError, "Missing the required parameter 'functions_rollback_request' when calling FunctionsApi.functions_rollback"
  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(functions_rollback_request)

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

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

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_rollback",
    :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#functions_rollback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_simulate(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.

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to simulate.

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

    the optional parameters

Options Hash (opts):

  • :functions_simulate_request (FunctionsSimulateRequest)

    Simulated trigger (type, event) and eventContext (document, file, webhook, wallet, message, or cron). Merged into the function payload for testing.

Returns:



836
837
838
839
# File 'lib/mudbase/api/functions_api.rb', line 836

def functions_simulate(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_simulate_with_http_info(project_id, function_id, opts)
  data
end

#functions_simulate_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.

Parameters:

  • project_id (String)

    Project ID (MongoDB ObjectId) that owns the function.

  • function_id (String)

    Function ID (MongoDB ObjectId) to simulate.

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

    the optional parameters

Options Hash (opts):

  • :functions_simulate_request (FunctionsSimulateRequest)

    Simulated trigger (type, event) and eventContext (document, file, webhook, wallet, message, or cron). Merged into the function payload for testing.

Returns:

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

    FunctionExecutionResponse data, response status code and response headers



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
903
# File 'lib/mudbase/api/functions_api.rb', line 848

def functions_simulate_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_simulate ...'
  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.functions_simulate"
  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.functions_simulate"
  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[:'functions_simulate_request'])

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

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

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_simulate",
    :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#functions_simulate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#functions_trigger_webhook(project_id, opts = {}) ⇒ FunctionsTriggerWebhook200Response

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 30 requests per 15 minutes per IP.

Parameters:

  • project_id (String)

    Project ID.

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

    the optional parameters

Options Hash (opts):

  • :x_webhook_secret (String)

    Optional webhook secret for verification

  • :body (Object)

    Payload sent to the triggered function(s).

Returns:



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

def functions_trigger_webhook(project_id, opts = {})
  data, _status_code, _headers = functions_trigger_webhook_with_http_info(project_id, opts)
  data
end

#functions_trigger_webhook_with_http_info(project_id, opts = {}) ⇒ Array<(FunctionsTriggerWebhook200Response, Integer, Hash)>

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

Parameters:

  • project_id (String)

    Project ID.

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

    the optional parameters

Options Hash (opts):

  • :x_webhook_secret (String)

    Optional webhook secret for verification

  • :body (Object)

    Payload sent to the triggered function(s).

Returns:



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
# File 'lib/mudbase/api/functions_api.rb', line 924

def functions_trigger_webhook_with_http_info(project_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_trigger_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.functions_trigger_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] || 'FunctionsTriggerWebhook200Response'

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

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_trigger_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#functions_trigger_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

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

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

Parameters:

  • project_id (String)

    Project ID.

  • function_id (String)

    Function ID.

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

    the optional parameters

Options Hash (opts):

  • :update_function_request (UpdateFunctionRequest)

    Fields to update (name, description, code, trigger, environment, isActive, limits, retryPolicy).

Returns:



985
986
987
988
# File 'lib/mudbase/api/functions_api.rb', line 985

def functions_update(project_id, function_id, opts = {})
  data, _status_code, _headers = functions_update_with_http_info(project_id, function_id, opts)
  data
end

#functions_update_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)

    Project ID.

  • function_id (String)

    Function ID.

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

    the optional parameters

Options Hash (opts):

  • :update_function_request (UpdateFunctionRequest)

    Fields to update (name, description, code, trigger, environment, isActive, limits, retryPolicy).

Returns:

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

    FunctionResponse data, response status code and response headers



997
998
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
1052
# File 'lib/mudbase/api/functions_api.rb', line 997

def functions_update_with_http_info(project_id, function_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FunctionsApi.functions_update ...'
  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.functions_update"
  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.functions_update"
  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] || ['ApiKeyAuth', 'BearerToken']

  new_options = opts.merge(
    :operation => :"FunctionsApi.functions_update",
    :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#functions_update\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end