class Ittybit::TasksClient
def create(kind:, url: nil, input: nil, file_id: nil, workflow: nil, webhook_url: nil, filename: nil, folder: nil,
-
(Ittybit::TaskResponse)
-
Parameters:
-
request_options
(Ittybit::RequestOptions
) -- -
quality
(Integer
) -- Output quality setting (e.g., for video/image tasks, 0-100). -
height
(Integer
) -- Output height (for video/image tasks). -
width
(Integer
) -- Output width (for video/image tasks). -
format
(String
) -- Output format (e.g., for video/image tasks). -
folder
(String
) -- Desired output folder (if applicable). -
filename
(String
) -- Desired filename for the output (if applicable). -
webhook_url
(String
) -- An optional HTTPS URL to send a webhook notification to upon task completion or -
workflow
(Array
) -- An array of task definition objects for a workflow.Object}> -
file_id
(String
) -- ID of an existing file to use as input (alternative to url). -
input
(Hash{String => Object}
) -- Task-specific input parameters depending on the kind of task. -
url
(String
) -- URL of the source file (required for 'ingest' kind unless file_id is used, can -
kind
(Ittybit::Tasks::TasksCreateRequestKind
) -- The type of task to create.
def create(kind:, url: nil, input: nil, file_id: nil, workflow: nil, webhook_url: nil, filename: nil, folder: nil, format: nil, width: nil, height: nil, quality: nil, request_options: nil) response = @request_client.conn.post do |req| req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil? req.headers["Authorization"] = request_options.token unless request_options&.token.nil? req.headers["ACCEPT_VERSION"] = request_options.version unless request_options&.version.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(request_options&.additional_headers || {}) }.compact unless request_options.nil? || request_options&.additional_query_parameters.nil? req.params = { **(request_options&.additional_query_parameters || {}) }.compact end req.body = { **(request_options&.additional_body_parameters || {}), kind: kind, url: url, input: input, file_id: file_id, workflow: workflow, webhook_url: webhook_url, filename: filename, folder: folder, format: format, width: width, height: height, quality: quality }.compact req.url "#{@request_client.get_url(request_options: request_options)}/tasks" end Ittybit::TaskResponse.from_json(json_object: response.body) end