=begin #Mux API #Mux is how developers build online video. This API encompasses both Mux Video and Mux Data functionality to help you build your video-related projects better and faster than ever before. The version of the OpenAPI document: v1 Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.0.1 =end require 'cgi' module MuxRuby class IncidentsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Get an Incident # Returns the details of an incident # @param incident_id [String] ID of the Incident # @param [Hash] opts the optional parameters # @return [IncidentResponse] def get_incident(incident_id, opts = {}) data, _status_code, _headers = get_incident_with_http_info(incident_id, opts) data end # Get an Incident # Returns the details of an incident # @param incident_id [String] ID of the Incident # @param [Hash] opts the optional parameters # @return [Array<(IncidentResponse, Integer, Hash)>] IncidentResponse data, response status code and response headers def get_incident_with_http_info(incident_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IncidentsApi.get_incident ...' end # verify the required parameter 'incident_id' is set if @api_client.config.client_side_validation && incident_id.nil? fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsApi.get_incident" end # resource path local_var_path = '/data/v1/incidents/{INCIDENT_ID}'.sub('{' + 'INCIDENT_ID' + '}', CGI.escape(incident_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']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'IncidentResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"IncidentsApi.get_incident", :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: IncidentsApi#get_incident\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Incidents # Returns a list of incidents # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of items to include in the response (default to 25) # @option opts [Integer] :page Offset by this many pages, of the size of `limit` (default to 1) # @option opts [String] :order_by Value to order the results by # @option opts [String] :order_direction Sort order. # @option opts [String] :status Status to filter incidents by # @option opts [String] :severity Severity to filter incidents by # @return [ListIncidentsResponse] def list_incidents(opts = {}) data, _status_code, _headers = list_incidents_with_http_info(opts) data end # List Incidents # Returns a list of incidents # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of items to include in the response # @option opts [Integer] :page Offset by this many pages, of the size of `limit` # @option opts [String] :order_by Value to order the results by # @option opts [String] :order_direction Sort order. # @option opts [String] :status Status to filter incidents by # @option opts [String] :severity Severity to filter incidents by # @return [Array<(ListIncidentsResponse, Integer, Hash)>] ListIncidentsResponse data, response status code and response headers def list_incidents_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IncidentsApi.list_incidents ...' end allowable_values = ["negative_impact", "value", "views", "field"] if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by']) fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}" end allowable_values = ["asc", "desc"] if @api_client.config.client_side_validation && opts[:'order_direction'] && !allowable_values.include?(opts[:'order_direction']) fail ArgumentError, "invalid value for \"order_direction\", must be one of #{allowable_values}" end allowable_values = ["open", "closed", "expired"] if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status']) fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}" end allowable_values = ["warning", "alert"] if @api_client.config.client_side_validation && opts[:'severity'] && !allowable_values.include?(opts[:'severity']) fail ArgumentError, "invalid value for \"severity\", must be one of #{allowable_values}" end # resource path local_var_path = '/data/v1/incidents' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil? query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil? query_params[:'severity'] = opts[:'severity'] if !opts[:'severity'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListIncidentsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"IncidentsApi.list_incidents", :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: IncidentsApi#list_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Related Incidents # Returns all the incidents that seem related to a specific incident # @param incident_id [String] ID of the Incident # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of items to include in the response (default to 25) # @option opts [Integer] :page Offset by this many pages, of the size of `limit` (default to 1) # @option opts [String] :order_by Value to order the results by # @option opts [String] :order_direction Sort order. # @return [ListRelatedIncidentsResponse] def list_related_incidents(incident_id, opts = {}) data, _status_code, _headers = list_related_incidents_with_http_info(incident_id, opts) data end # List Related Incidents # Returns all the incidents that seem related to a specific incident # @param incident_id [String] ID of the Incident # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Number of items to include in the response # @option opts [Integer] :page Offset by this many pages, of the size of `limit` # @option opts [String] :order_by Value to order the results by # @option opts [String] :order_direction Sort order. # @return [Array<(ListRelatedIncidentsResponse, Integer, Hash)>] ListRelatedIncidentsResponse data, response status code and response headers def list_related_incidents_with_http_info(incident_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: IncidentsApi.list_related_incidents ...' end # verify the required parameter 'incident_id' is set if @api_client.config.client_side_validation && incident_id.nil? fail ArgumentError, "Missing the required parameter 'incident_id' when calling IncidentsApi.list_related_incidents" end allowable_values = ["negative_impact", "value", "views", "field"] if @api_client.config.client_side_validation && opts[:'order_by'] && !allowable_values.include?(opts[:'order_by']) fail ArgumentError, "invalid value for \"order_by\", must be one of #{allowable_values}" end allowable_values = ["asc", "desc"] if @api_client.config.client_side_validation && opts[:'order_direction'] && !allowable_values.include?(opts[:'order_direction']) fail ArgumentError, "invalid value for \"order_direction\", must be one of #{allowable_values}" end # resource path local_var_path = '/data/v1/incidents/{INCIDENT_ID}/related'.sub('{' + 'INCIDENT_ID' + '}', CGI.escape(incident_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order_direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListRelatedIncidentsResponse' # auth_names auth_names = opts[:debug_auth_names] || ['accessToken'] new_options = opts.merge( :operation => :"IncidentsApi.list_related_incidents", :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: IncidentsApi#list_related_incidents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end