=begin #Svix API #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 1.1.1 Generated by: https://openapi-generator.tech Generator version: 7.9.0 =end require 'cgi' module Svix class BackgroundTasksApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get Background Task # Get a background task by ID. # @param task_id [String] # @param [Hash] opts the optional parameters # @return [BackgroundTaskOut] def get_background_task(task_id, opts = {}) data, _status_code, _headers = get_background_task_with_http_info(task_id, opts) data end # Get Background Task # Get a background task by ID. # @param task_id [String] # @param [Hash] opts the optional parameters # @return [Array<(BackgroundTaskOut, Integer, Hash)>] BackgroundTaskOut data, response status code and response headers def get_background_task_with_http_info(task_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BackgroundTasksApi.get_background_task ...' end # verify the required parameter 'task_id' is set if @api_client.config.client_side_validation && task_id.nil? fail ArgumentError, "Missing the required parameter 'task_id' when calling BackgroundTasksApi.get_background_task" end # resource path local_var_path = '/api/v1/background-task/{task_id}'.sub('{' + 'task_id' + '}', CGI.escape(task_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] || 'BackgroundTaskOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"BackgroundTasksApi.get_background_task", :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: BackgroundTasksApi#get_background_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Background Tasks # List background tasks executed in the past 90 days. # @param [Hash] opts the optional parameters # @option opts [BackgroundTaskStatus] :status Filter the response based on the status. # @option opts [BackgroundTaskType] :task Filter the response based on the type. # @option opts [Integer] :limit Limit the number of returned items # @option opts [String] :iterator The iterator returned from a prior invocation # @option opts [Ordering] :order The sorting order of the returned items # @return [ListResponseBackgroundTaskOut] def list_background_tasks(opts = {}) data, _status_code, _headers = list_background_tasks_with_http_info(opts) data end # List Background Tasks # List background tasks executed in the past 90 days. # @param [Hash] opts the optional parameters # @option opts [BackgroundTaskStatus] :status Filter the response based on the status. # @option opts [BackgroundTaskType] :task Filter the response based on the type. # @option opts [Integer] :limit Limit the number of returned items # @option opts [String] :iterator The iterator returned from a prior invocation # @option opts [Ordering] :order The sorting order of the returned items # @return [Array<(ListResponseBackgroundTaskOut, Integer, Hash)>] ListResponseBackgroundTaskOut data, response status code and response headers def list_background_tasks_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BackgroundTasksApi.list_background_tasks ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BackgroundTasksApi.list_background_tasks, must be smaller than or equal to 250.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling BackgroundTasksApi.list_background_tasks, must be greater than or equal to 1.' end # resource path local_var_path = '/api/v1/background-task' # query parameters query_params = opts[:query_params] || {} query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'task'] = opts[:'task'] if !opts[:'task'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'iterator'] = opts[:'iterator'] if !opts[:'iterator'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].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] || 'ListResponseBackgroundTaskOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"BackgroundTasksApi.list_background_tasks", :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: BackgroundTasksApi#list_background_tasks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end