=begin #Subskribe API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 1.0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.41 =end require 'uri' module SubskribeDevClient class ReportsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Generate a report # Generates a report with the specified parameters. This report can later be downloaded via /reports/{reportRunId}/result # @param body json definition of the report # @param [Hash] opts the optional parameters # @return [ReportJobResponse] def generate(body, opts = {}) data, _status_code, _headers = generate_with_http_info(body, opts) data end # Generate a report # Generates a report with the specified parameters. This report can later be downloaded via /reports/{reportRunId}/result # @param body json definition of the report # @param [Hash] opts the optional parameters # @return [Array<(ReportJobResponse, Fixnum, Hash)>] ReportJobResponse data, response status code and response headers def generate_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReportsApi.generate ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling ReportsApi.generate" end # resource path local_var_path = '/reports/generate' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ReportJobResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ReportsApi#generate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get report definitions # Returns the definitions of the reports defined for your tenant. # @param [Hash] opts the optional parameters # @return [PredefinedReportDefsJson] def get_predefined_report_defs(opts = {}) data, _status_code, _headers = get_predefined_report_defs_with_http_info(opts) data end # Get report definitions # Returns the definitions of the reports defined for your tenant. # @param [Hash] opts the optional parameters # @return [Array<(PredefinedReportDefsJson, Fixnum, Hash)>] PredefinedReportDefsJson data, response status code and response headers def get_predefined_report_defs_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReportsApi.get_predefined_report_defs ...' end # resource path local_var_path = '/reports' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PredefinedReportDefsJson') if @api_client.config.debugging @api_client.config.logger.debug "API called: ReportsApi#get_predefined_report_defs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Run a generated report # Runs a report generated with /generate. On success a csv of the report is returned. # @param report_run_id id of the report # @param [Hash] opts the optional parameters # @return [nil] def get_report_output(report_run_id, opts = {}) get_report_output_with_http_info(report_run_id, opts) nil end # Run a generated report # Runs a report generated with /generate. On success a csv of the report is returned. # @param report_run_id id of the report # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def get_report_output_with_http_info(report_run_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReportsApi.get_report_output ...' end # verify the required parameter 'report_run_id' is set if @api_client.config.client_side_validation && report_run_id.nil? fail ArgumentError, "Missing the required parameter 'report_run_id' when calling ReportsApi.get_report_output" end # resource path local_var_path = '/reports/{reportRunId}/result'.sub('{' + 'reportRunId' + '}', report_run_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ReportsApi#get_report_output\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Run a report # Runs the specified report and returns the result as a csv. # @param body definition of the report in json # @param [Hash] opts the optional parameters # @return [nil] def run(body, opts = {}) run_with_http_info(body, opts) nil end # Run a report # Runs the specified report and returns the result as a csv. # @param body definition of the report in json # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def run_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ReportsApi.run ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling ReportsApi.run" end # resource path local_var_path = '/reports/run' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = ['ApiKeyAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: ReportsApi#run\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end